PDA

View Full Version : IRC Trigger help please?


Eric
24-05-2002, 00:52
Ello guys.

I'm starting to dabble in irc scripting atm, and I've written (with a little help in the file reading bit) a small trigger script that responds to !quote with a supposedly humorous quote from a text file :D

;on 1:TEXT:*!quote*:#:{
/rq
/alias /rq
/timer 0 20 /alias /rq /msg $chan [RANDOM QUOTE]2 $read C:\extreme\quotes.log 
}


Right this works to some extent, but is flawed in that it only messages the active channel, rather than the channel the trigger was set off in.

Is there any way I can get the script to return the 'humorous quote' in the channel that !quote was triggered in, even I'm talking on a diff channel?

Also the timer looks a bit sloppy, but it works in that !quote only works once every 20 seconds (although that 20 seconds restarts everytime someone says !quote which is a bit rubbish). Any ideas on improving that please? I'm not too familiar with the timer command to be honest.

Anyway thanks for any input/help/advice. :)

- Eric

DCLXVI
24-05-2002, 12:03
I know nothing about scripting, but it's the $chan that's the problem. Maybe go into a subroutine that tells it what channel it was said in?

Drumbillet
25-05-2002, 03:24
YELLOW-BUS! :D

Kalleth
25-05-2002, 19:44
on 1:TEXT:*!quote*:#: {
/rq
/alias /rq
/timer 0 20 /alias /rq /msg $chan [RANDOM QUOTE]2 $read C:\extreme\quotes.log 
}
several things i'd point out here - firstly that the code is sloppy (sorry :/)
Basically, i'll write something nicer for you:

on *:TEXT:!quote*:#: {
if (%quote.flood != on) {
msg $chan [RANDOM QUOTE]2 $read(C:\extreme\quotes.log) 
set -u20 %quote.flood on
}
}


Okay - let me take you through this.
I Changed '1' to '*' in the on text event, because you want all users to be able to use the !quote script, not just those with the default user level.
The reason you're using timers i suppose is to protect against spam - what i've done here is said:
IF (the variable %quote.flood) DOES NOT EQUAL on THEN
message the channel the random quote string, and set %quote.flood to on for 20 seconds (-u<number> sets the variable for <number> seconds, then unsets it.)
Finally, i changed your $read string so the filename is in brackets afterwards. Not strictly neccesary, but its good practice and gives less errors.
Hope this helps, and keep scripting!
[edit - fixed a little teenie weenie error]

Eric
27-05-2002, 13:22
Thanks for that mate, it worked a treat for getting rid of the floods. In all honesty I had no idea how to do that so just bunged a timer in there, which worked but was spammy and not very effective.

Any ideas on the trigger returning to the same chan thing though? That's got me proper stumped :o

Kalleth
27-05-2002, 17:07
Eric - the script i've written to you now should return to the same channel that !quote is typed in.
The reason? $chan is a variable used in any on * event that contains the channel that the event was triggered in.
in this on TEXT, for example, i might type !quote in #MUDClan, which means that $chan will be #MUDClan.
I dont *think* i'm wrong - but i'm not infallible by anyones reasoning, try getting someone to type !quote in a channel while you're looking at a different one.
if this doesnt help, yell at me some more and i'm sure i'll think of another solution :p

Eric
28-05-2002, 00:12
Doh just asked people to test it, it works fine mate - msg's the channel the !quote was triggered in. Thanks a lot :)

Kalleth
28-05-2002, 07:57
no problem, s'what i'm here for ;)
just tell others about this forum will ya? :P

GameGuru
28-05-2002, 12:33
Kalleth sux0rs ;(

:E

Kalleth
28-05-2002, 17:14
yo, gameguru!
i know, i know, another guide needed :(.
perhaps some input from everyone else on what we should both do number 5 on..
anyway, been a while, get in touch with me on MSN or IRC mate, :D

GameGuru
30-05-2002, 12:22
You were already given my part 5 before I left for uni f00l :P

I'm back home tonight so we can discuss the next part then...

Strembles
01-06-2002, 16:29
Ah so you're back then gameguru :E
Long time no see :)
How long are you gonna be around for?

GameGuru
02-06-2002, 15:22
ITS GameGuru! :angry::mad:

I'm back for a while now :D

although expect not to see me too much to start with, I'm distracted by my Gamecube and Morrowind

Strembles
02-06-2002, 21:13
lol still obsessive about that I see :E