mIRC Home    About    Download    Register    News    Help

Print Thread
#269104 12/06/21 12:46 AM
T
tribalcoi
tribalcoi
T
I have set up on text msgs but i need a 1-3 second delay before they are sent. How do i add this?

Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
Use timer, check this page, the example section has what you need, watch out for timer injection though.

https://en.wikichip.org/wiki/mirc/commands/timer


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
T
tribalcoi
tribalcoi
T
Ty I have the timers figured out and all is good.

I have a new issue id like to work out if you can help out.

If the user spams the trigger, how would i go about getting it to respond only to the first trigger and ignore the rest for a set time?

Joined: Mar 2010
Posts: 144
Vogon poet
Offline
Vogon poet
Joined: Mar 2010
Posts: 144
You can set a (dynamically named) variable when you the code is executed the first time, and check for it the next.
I've been away for a long time, and a bit rusty, but this might help.

Code
ON *:TEXT:*:*:{
  // Check if the variable is set, if not then perform the rest of the code.
  if ($eval($+(%,Timeout.,$chan,$nick),2) != 1) {

    // use -u switch to unset the variable after N seconds.
    set -u3 $+(%,Timeout.,$chan,$nick) 1

    // Do whatever is supposed to happen the first time here...
  }
}


Nothing...
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
One trick would be to use a named timer for his timer, and then you can achieve the same logic by checking if the timer 'exists'


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
T
tribalcoi
tribalcoi
T
This is what im working with right now. It works great as long as the user doesnt spam the trigger. If they spam it i want to only react to the first occurance and ignore the rest of them.

Code
on *:TEXT:sample:#channel:{ timer 1 8 msg #channel !play }


Im moderate with python and ahk but this is killing me.


Link Copied to Clipboard