mIRC Home    About    Download    Register    News    Help

Print Thread
#269104 12/06/21 12:46 AM
Joined: Jun 2021
Posts: 7
T
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Jun 2021
Posts: 7
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,155
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,155
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
Joined: Jun 2021
Posts: 7
T
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Jun 2021
Posts: 7
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: 146
Vogon poet
Offline
Vogon poet
Joined: Mar 2010
Posts: 146
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,155
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,155
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
Joined: Jun 2021
Posts: 7
T
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Jun 2021
Posts: 7
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