Author Topic: dodge script  (Read 7541 times)

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
dodge script
« on: February 27, 2006, 11:13:01 AM »
I'm trying to make a script so that I can dodge slaps, but doesn't seem to work:
Code: [Select]
Sub ONACTION(Message,Channel,Nickname,Host,ServerNumber)
  if instr(UCase(Message),"SLAPS") and instr(UCase(Message),"MORIO") then
    SendCommand "/me dodges", servernumber
  End if
End Sub
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: dodge script
« Reply #1 on: February 27, 2006, 11:51:17 AM »
Well, "it doesnt work" does not give much of a hint of what it is or is not doing.
I would suggest giving more detail in the future.

But, I can see this much, it will send the /me command to the wrong channel, if you are in a different channel that the slap occured.

Use the /describe command instead, to allows you to send a /me command to a specific channel.
Code: [Select]
SendCommand "/describe " & Channel & " dodges",ServerNumber
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: dodge script
« Reply #2 on: February 27, 2006, 12:03:20 PM »
ok, thanks that helped.

I guessed that was the problem, but I was only on one channel on the server where I tried it so I didn't know for sure
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: dodge script
« Reply #3 on: February 27, 2006, 12:19:24 PM »
Well, even if you were in the console, it would not have worked. You would have to be in the exact channel, because that is what the /me command does, sends it to the current channel. Well, if your not currently in a channel, like the console or such, it wont work. This is why we have the /describe command :)
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: dodge script
« Reply #4 on: February 28, 2006, 09:11:48 AM »
Code: [Select]
Sub ONACTION(Message,Channel,Nickname,Host,ServerNumber)                     
  if (instr(UCase(Message),"HITS") or instr(UCase(Message),"EATS") or instr(UCase(Message),"BEATS") or instr(UCase(Message),"SLAPS") or instr(UCase(Message),"THROWS") or instr(UCase(Message),"WHIPS")) and instr(UCase(Message),"MORIO") then                     
    SendCommand "/describe " & Channel & " dodges",ServerNumber                     
  End if                     
End Sub             

for some reason it won't trigger for words shorter than 5 letters
« Last Edit: February 28, 2006, 09:13:27 AM by Morio »
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: dodge script
« Reply #5 on: February 28, 2006, 05:33:19 PM »
Yes, that script will error out, because of the AND at the end of the If statement.
Place all the OR's in a Bracket, and stick the AND at the end.

Code: [Select]
IF ( (instr(UCase(Message),"HITS") or instr(UCase(Message),"EATS") or instr(UCase(Message),"BEATS") or instr(UCase(Message),"SLAPS") or instr(UCase(Message),"THROWS") or instr(UCase(Message),"WHIPS")) ) AND instr(UCase(Message),"MORIO") then

If that does not work, then make a seperate if statement for each word.
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: dodge script
« Reply #6 on: March 01, 2006, 12:46:33 AM »
That's not really the problem, as you can see that I already have parentheses around the whole 'or' stuff. The problem is that it won't trigger for words shorter than 5 letters. It will work for the word 'beats' but not for the word 'eats'.

I made separate statements for each word anyway, it looks  better that way
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: dodge script
« Reply #7 on: March 01, 2006, 07:16:05 AM »
Ok. I really have no idea why it does not work for 4 letter words in that long statement, but if it works all as seperate statements, thats all for the better.
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: dodge script
« Reply #8 on: March 01, 2006, 09:35:40 AM »
that's the problem, it doesn't work with separate statements either
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: dodge script
« Reply #9 on: March 01, 2006, 09:43:49 AM »
Ah, ok, I misunderstood.
I will have to try and make one for myself and test it, and post my results when I got it working.

Cheers
The IceChat God

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: dodge script
« Reply #10 on: March 01, 2006, 10:43:20 PM »
Changed it up a bit, and forced the Message to be UCASE to simplify it, but it works.

Code: [Select]
Sub ONACTION(Message,Channel,Nickname,Host,ServerNumber)                                   
  Message = Ucase(Message)   
  if Instr(Message,"MORIO") then 
     If instr(Message,"HITS") or instr(Message,"EATS") or instr(Message,"SLAPS") or instr(Message,"THROWS") or instr(Message,"WHIPS") then 
       SendCommand "/describe " & Channel & " dodges " & NickName, ServerNumber                                   
    end if 
  end if 
End Sub   

The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: dodge script
« Reply #11 on: March 02, 2006, 01:03:24 AM »
ok, thanks that one worked.

I wonder why it didn't work the way I made it, maybe it's some spiriual thing :D
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein