mIRC Homepage
Posted By: da_hype queue system - 30/09/04 02:59 AM
From tabo's scripting tips..
<a href="http://
http://www.mircscripts.org/showdoc.php?type=tutorial&id=916
" target="_blank">
http://www.mircscripts.org/showdoc.php?type=tutorial&id=916
</a>

he said..

Quote:

If your script/addon sends tons of replies (@find, !seen, ctcp help, etc) write a queue system or the user will be easily flooded off.


anyone have an example of code i could look at?
Posted By: LocutusofBorg Re: queue system - 30/09/04 05:28 AM
there would be plenty of scripts out there with a queue system. Just download one off the same website. As for the basic setup, here's what I would do (could be easier, but I like toi account for the possibility of sending multiple stuff top one nick)

when you wanna send, don't send, but use a command like this:

Code:
$addqueue($ctime,nick,eventtype,message)


where nick is obvious, and eventtype can be something like msg, notice, or ctcp. Use the name of the command for ease. Also, nick can be a nick, but also a channel...

Code:
alias addqueue {
  %queue = %queue $1
  hadd Queue $1 $2 $3 $4-
}


This adds the sequence of events to a queue (variable), and when the time comes, the script will yank the necessary information from the hastable (create it when you start mIRC). You could of course do some errorchecking to make sure the hashtable exists, and make it if it doesn't.

Last step: when you start mIRC, start a timer:

Code:
timerqueue -0 0 3 readqueue


and create the alias that runs through the %queue variable and sends the commands. This is set up so it only sends commands to nicks still on at least one channel you're on. With a small modification, you could even use the same code to queue /whois requests in the same queue, as well as kicks, bans, etc.

Code:
alias readqueue {
  tokenize 32 $hget(Queue,$gettok(queue,1,32))
  if ($!comchan($1,0)) { %queue = $deltok(%queue,1,32) | timer 1 0 readqueue }
  $2 $1 $3-
}



Posted By: Sigh Re: queue system - 30/09/04 05:32 AM
You could check out a queue system script on mircscripts.org at http://www.mircscripts.org/comments.php?cid=2309

Not a bad example if you can follow the code
Posted By: da_hype Re: queue system - 30/09/04 06:49 AM
thanks guys...
© mIRC Discussion Forums