mIRC Homepage
Posted By: SeraphicAsperity A Scripting Question. - 02/10/04 10:42 PM
I'm an IRCOp on the IRC server the website/forum I work at, and in the java applet there are these annoying /me commands that flood the screen pointlessly. We've made it against the rules to use them, but we can't physically remove them from the applet so I was wondering if it would be possible to make a script regarding them.

The basic plot of the script would be to /notice the user with a warning about the use of the automatic actions(I.E. things like "Nick attacks nobody in particular!", "Nick is really very bored.", "Nick slaps everyone in the room.", "Nick smiles at everyone in the room :-)", "Nick Laughs-Out-Loud!!", "Nick is going to be away from the channel.", "Nick bounces around the channel.", "Nick looks at nobody in particular and laughs.") twice before kicking them from the channel for it.

Is it doable?
Posted By: Zyzzyx26 Re: A Scripting Question. - 02/10/04 10:54 PM
If I understood the matter correctly, then yes smile
Code:
on @*:action:*:#: {
 inc $+(%,action,$nick,$chan)
 if ($eval($+(%,action,$nick,$chan),2) < 2) { .notice $nick Please do not use actions (the /me command) in here. Thank you. }
 else { kick # $nick You were warned to not use actions. | unset $+(%,action,$nick,$chan) }
}
This should warn them in the first couple of times. After that, it kicks them. If you would like to have a limit for the actions (Eg: 2 in 30 minutes) you can add -uN between the inc and the $+(%,action,$nick,$chan) part, replacing N for the time in seconds.

I hope this can help smile
Zyzzyx.
Posted By: SeraphicAsperity Re: A Scripting Question. - 02/10/04 11:42 PM
That's basically it, yeah. The only thing is that /me commands themselves are allowed for use. It's these ready-made commands the place's java applet has that are the problem.

* Asperity is really very bored.
* Asperity smiles at everyone in the room :-)
* Asperity slaps everyone in the room.
* Asperity attacks nobody in particular!
* Asperity looks at nobody in particular and laughs.
* Asperity is going to be away from the channel.
* Asperity bounces around the channel.
* Asperity Laughs-Out-Loud!!
Posted By: Zyzzyx26 Re: A Scripting Question. - 02/10/04 11:58 PM
Code:
on @*:action:*:#: {
  if ($istok(%actions,$strip($1-),61)) { 
    inc $+(%,action,$nick,$chan)
    if ($eval($+(%,action,$nick,$chan),2) <= 2) { .notice $nick Please do not use actions (the /me command) in here. Thank you. }
    else { kick # $nick You were warned to not use actions. | unset $+(%,action,$nick,$chan) }
  }
}
You can try this then. The varible %actions should contain the JApplet's sentences, separated by an equal sign (=).

Eg: is really very bored.= smiles at everyone in the room :-)=slaps everyone in the room.=attacks nobody in particular!

and so on... I hope this can help smile
Zyzzy.
Posted By: SeraphicAsperity Re: A Scripting Question. - 03/10/04 12:27 AM
That should work great. Thank you very much.

I take it the %Actions variable would be set up in the Variables window for the Scripts editor, rather than in the script itself. How would it be set up there? I was checking the Help file, but it didn't help too much. I'm rather script illiterate.
Posted By: Zyzzyx26 Re: A Scripting Question. - 03/10/04 12:32 AM
Yes, they should be set up as variables. To do that, use the /set command. /set %actions <value> - would do it. Replace the <value> for the sentences of the Java Applet separated by the equal sign (=), and without the <>.

For more information about variables, you can type /help variables [color:black] or /help /set[/color].

Good luck,
Zyzzyx smile
Posted By: SeraphicAsperity Re: A Scripting Question. - 03/10/04 12:45 AM
I've got it set up, but when I test it out I get "/if: close bracket not found". I've got the whole thing copied, and the variables in place.
Posted By: Zyzzyx26 Re: A Scripting Question. - 03/10/04 12:55 AM
Hmm... wierd smirk By looking at the code above, I can't find any bracket mismatches. There is a closing bracket at the very end of the 4th line, which is kinda hidden. Please try copying the code again and make sure you get that "hidden" bracket as well.

Zyzzyx smile
Posted By: SeraphicAsperity Re: A Scripting Question. - 03/10/04 01:07 AM
I think when I copied and set it up I did some improper spacing. It works fine now.

Thank you very much for your help.
Posted By: Zyzzyx26 Re: A Scripting Question. - 03/10/04 01:11 AM
Awesome! Yw smile
© mIRC Discussion Forums