mIRC Home    About    Download    Register    News    Help

Print Thread
#214885 18/08/09 05:41 PM
Joined: Mar 2008
Posts: 33
S
starr Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2008
Posts: 33
I have a bot in my channel. Chatters can type in the command !drink, and the bot sends a list of available drinks to them via private message. The problem is that if more than one chatter types the command in at the same time, the bot floods out. I need a way to sort of hold the commands in a que or something until it's done sending to one person...then send it to the next one that had typed in the command. Any help would be appreciated.

starr #214887 18/08/09 06:33 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
For example:
Code:
on *:TEXT:!drink:#: {
  if (!%queue) {
    set -z %queue 5
    msg $nick available drinks here
  }
}
This will set a five second queue until it's run out before someone else is able to get the drinks via !drink command. Anyone who tries to get drinks within 5 second will be ignored. This way, your bot won't get flooded out.

Tomao #214888 18/08/09 06:44 PM
Joined: Mar 2008
Posts: 33
S
starr Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2008
Posts: 33
I don't want the second person to be ignored. I just want the bot to not send to them until it has completed sending to the first person. It seems as if it should be an if/then command, but I just don't know how to do it. The second person should not have to retype the command.

Last edited by starr; 18/08/09 06:45 PM.
Tomao #214889 18/08/09 07:30 PM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
That's not a queu thats a flood protection.

starr #214894 18/08/09 08:15 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
You could use the /play command, it allows you to specify both the delay per-line, and the max. number of requests-to-queue for a target / for all targets.

Example:
- /write the line(s) of text to a temporary file
- /play the file to the $nick
- /remove the temporary file

You could also create a [topic] for every drink in some bar.ini and play the respective topic for this or that drink to $nick.


starr #214896 18/08/09 08:23 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Yup, I misunderstood you. Perhaps using timer is another alternative:
Code:
on *:TEXT:!drink:#: {
  hadd -mu5 que $nick
  .timer 1 5 msg $hfind(que,$nick) available drinks here
}

starr #215337 12/09/09 09:52 AM
Joined: Sep 2009
Posts: 52
Z
ziv Offline
Babel fish
Offline
Babel fish
Z
Joined: Sep 2009
Posts: 52
I suggest you read up on mIRC's built in flood protection.
Type /help flood

ziv.


Link Copied to Clipboard