mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2015
Posts: 7
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
Joined: Feb 2015
Posts: 7
I have a script that sends a message to a room every 10 minutes. Then users send me a private message and instantly receive an automatic response from the script. I need to respond with a margin of 30s ~ 1min between each query because the network detects flood.



I've tried with the code below but it doesn't work since there are users who do not get a response

Code:
on ^*:OPEN:?: {
  if ($nick !isop $chan) { 
    if ($network == [s]XXXXXXXX[/s]) { 
      if (!%delay) {
      set -u60 %delay 1
      msg $nick [s]XXXXXXXXXXXXXXXXXX[/s]
      }
    }
  }
}


Can anybody help me? Thank you all

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
One way you could do this is put your code into an alias which the timer calls, instead of putting the command into the timer. Instead of set -u60 %variable, you can use "set -z %variable 60", which lets you see that if the variable is set, you can know how many seconds until it reaches zero, which you can use as the delay for your timer.

Your alias should use a 2nd variable that contains a space delimited list of the nicks in the queue to get the message. If %listofnicks has a value, then you msg $gettok(%listofnicks,1,32), and then you "set %listofnicks $gettok(%listofnicks,2-,32). Of course your alias should make sure the nick is still in channel by the time of the delayed message. If they're not there, then you can skip them without waiting another 60 seconds. Or possible trap the PART and QUIT events to remove them from the queue.

Your script also needs to trap the NICK event so that if someone changes nick while waiting to receive the delayed message, it should rename their nick in the %listofnicks queue.

Your OPEN event isn't working for anyone who causes the query window to open while %delay has a value. Also, your OPEN event doesn't close the window when anyone queries you, so you'll never respond to the query again until you close the window.


Link Copied to Clipboard