mIRC Home    About    Download    Register    News    Help

Print Thread
A Scripting Question. #99595 02/10/04 10:42 PM
Joined: Oct 2004
Posts: 5
S
SeraphicAsperity Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Oct 2004
Posts: 5
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?

Re: A Scripting Question. #99596 02/10/04 10:54 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
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.

Last edited by Zyzzyx26; 02/10/04 10:55 PM.

"All we are saying is give peace a chance" -- John Lennon
Re: A Scripting Question. #99597 02/10/04 11:42 PM
Joined: Oct 2004
Posts: 5
S
SeraphicAsperity Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Oct 2004
Posts: 5
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!!

Re: A Scripting Question. #99598 02/10/04 11:58 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
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.


"All we are saying is give peace a chance" -- John Lennon
Re: A Scripting Question. #99599 03/10/04 12:27 AM
Joined: Oct 2004
Posts: 5
S
SeraphicAsperity Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Oct 2004
Posts: 5
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.

Re: A Scripting Question. #99600 03/10/04 12:32 AM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
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


"All we are saying is give peace a chance" -- John Lennon
Re: A Scripting Question. #99601 03/10/04 12:45 AM
Joined: Oct 2004
Posts: 5
S
SeraphicAsperity Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Oct 2004
Posts: 5
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.

Re: A Scripting Question. #99602 03/10/04 12:55 AM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
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


"All we are saying is give peace a chance" -- John Lennon
Re: A Scripting Question. #99603 03/10/04 01:07 AM
Joined: Oct 2004
Posts: 5
S
SeraphicAsperity Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Oct 2004
Posts: 5
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.

Re: A Scripting Question. #99604 03/10/04 01:11 AM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Awesome! Yw smile


"All we are saying is give peace a chance" -- John Lennon