mIRC Home    About    Download    Register    News    Help

Print Thread
#164614 14/11/06 01:27 PM
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
on !*:OP:#:{
if ($opnick == $me) {
.timer 1 $rand(2,5) msg $chan tnx $nick for my @ %script }
}


how can i say thanks once when someone tries to
/cs op # me me me me me me me me me me me me me me me me ?

is that possible so that i won't get an excess flood...?

Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
You could set a flag variable that is checked before sending the message.

e.g.
if (!$($+(%,thank_flag_,$nick),2)) { .timer .... }
set -u10 $+(%,thank_flag_,$nick) $true

(I really dislike this method of creating dynamic vars - I prefer hash tables myself...someone else probably has a better way of doing the dynamic var)


Sais
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
how bout a auto thanks on op and don't have to use a timer?

but won't thank if op op op or multiple op's using chanserv

Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Err. The .timer was part of the script you posted. It's not necessary in my solution.

The first time on op is triggered, the variable is not set, so the command is executed (send thanks). Then the variable is set, (and -u10 means it will be unset in 10 seconds). The next time on op is triggered, the variable is checked, and it finds it is set, so the message isn't executed. (Note that the set is still performed, so the time that it is prevented from responding is increased by 10 seconds. If you wanted to remove this, just put the set inside an else clause)

Does that make sense?


Sais
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
on !*:OP:#:{ if ($opnick == $me) { .timerGIVE.ME.A.TIMER.NAME.HERE 1 $rand(2,5) msg $chan tnx $nick for my @ %script } }

by supplying a name to the timer, the timer well be replaced by each reoccurance of the event, so apon the last occruance there well still only exist one timer.

Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
on !*:OP:#:{ if ($opnick == $me) { .timerGIVE.ME.A.TIMER.NAME.HERE 1 $rand(2,5) msg $chan tnx $nick for my @ %script } }

by supplying a name to the timer, the timer well be replaced by each reoccurance of the event, so apon the last occruance there well still only exist one timer.


even if i use that the problem won't be solve..

im asking a anti excess on /msg chanserv op me me me me me me me me me me me
that will give me a
+oooooooooooooooooo
then i will continue on doing a thanks msg...
what im asking is how to ignore when i already thank`d the nick that has given me an @.


for a much nicer example i wont use any timers now...
on !*:OP:#:{ if ($opnick == $me) { msg $chan tnx $nick for my @ %script } }

Last edited by learn3r; 14/11/06 10:51 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Using a timer as mentioned or having a variable unset itself as was also mentioned will prevent that from happening.

Scenario (for timer):

Chanserv ops me.
I set the named timer for 5-10 seconds. When it goes off, I say thanks.
User1 ops me before the timer goes off.
I reset the timer.
User2 ops me before the timer goes off.
I reset it again.
No one else ops me before the timer goes off, so now I say thanks.

In that scenario, I only said thanks one time, though I was opped 3 times.

Scenario (set -u):

Chanserv ops me.
I say thanks and set a variable for 10 seconds.
User1 ops me.
I check the variable and because it is set, I do not say thanks. I reset the variable for another 10 seconds.
User2 ops me.
Again, I check the variable and because it's still set, I don't say thanks and I reset it.
The variable unsets after 10 seconds of no one opping me.

In that scenario, I also only said thanks one time.


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2006
Posts: 342
L
learn3r Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Oct 2006
Posts: 342
What i mean is ..
is there a way of doing that by not using any timers?
u10 still a timer

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Not really... and why would you care?


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Well, I suppose you could record the last time you performed it (set $flag $ctime) and compare against the current $ctime....( if (!$var(%flag) || $calc($ctime - %flag) > 10) { ... } )


Sais
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
True, though it does basically the same thing and just complicates it unnecessarily. Oh, well.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard