mirc script question reddit / irc ---------------------------------------------------------------------- Jinjubei · 2015-01-16 16:34 I was just wondering if there is a way to have a script only run once every X amount of time. e.g. when someone types something into chat script echos what they say but will only do this action once every 5 minutes or so. ---------------------------------------------------------------------- FiendKing04 · 2015-01-16 20:12 Yes, I'm pretty sure it's set using timers, but not sure exactly what. Sorry I couldn't be more helpful, I only know it's possible because I've seen something almost exactly like it before. ---------------------------------------------------------------------- [deleted] · 2015-01-16 21:11 [deleted] ---------------------------------------------------------------------- Jinjubei · 2015-01-16 21:14 I may be wrong on how timers work because i've seen the /timer X Y command but I thought that was just for setting a delay. ---------------------------------------------------------------------- Nicd · 2015-01-16 22:59 When running the script, set a variable that is unset after 5 seconds. It's a flag on the variable set command IIRC. Then when the script is triggered again, check if the variable exists and if it does, don't run the rest of the script. ---------------------------------------------------------------------- damiankw · 2015-01-17 00:18 This is how I'd do it. ---------------------------------------------------------------------- tavaryn · 2015-01-17 16:21 In case you haven't found it on Google, you can use the /set command to set a variable that self-deletes in a given amount of seconds. For example: set -u300 %scriptTimer 1 will set %scriptTimer to 1, and it will expire in 300 seconds (5 minutes). To check this, you can use an if statement. on *:TEXT:!myscript:#yourChannel:{ if (%scriptTimer != 1) { echo This script has not been triggered in the past 5 minutes. set -u300 %scriptTimer 1 } } edit: dumb mistake ---------------------------------------------------------------------- Jinjubei · 2015-01-18 21:07 > on *:TEXT:!myscript:#yourChannel:{ > if (%scriptTimer != 1) { > echo This script has not been triggered in the past 5 minutes. > set %scriptTimer -u300 1 > } > } I'm not sure what I'm doing wrong but I have made a minor change to this code to be on \*:TEXT:!test:\*:{ if (%scriptTimer != 1) { echo This script has not been triggered in the past 5 minutes. set %scriptTimer -u300 1 } } and it doesn't seem to fix anything the "this script has not been triggered" text fires every time. ---------------------------------------------------------------------- tavaryn · 2015-01-18 22:49 Derp. I hadn't had my coffee when I posted that. Line 4 should read as follows: set -u300 %scriptTimer 1 Flags for a command always preceed other arguments. ---------------------------------------------------------------------- Jinjubei · 2015-01-18 23:54 good to know thank you very much sir