mIRC Homepage
Posted By: tribalcoi add delay to on text msg - 12/06/21 12:46 AM
I have set up on text msgs but i need a 1-3 second delay before they are sent. How do i add this?
Posted By: Wims Re: add delay to on text msg - 12/06/21 04:13 PM
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
Posted By: tribalcoi Re: add delay to on text msg - 13/06/21 03:24 AM
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?
Posted By: Masoud Re: add delay to on text msg - 13/06/21 01:44 PM
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...
  }
}
Posted By: Wims Re: add delay to on text msg - 13/06/21 02:31 PM
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'
Posted By: tribalcoi Re: add delay to on text msg - 13/06/21 02:49 PM
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.
© mIRC Discussion Forums