Mise en forme de code: pensez à utiliser les balises [ tcl ] et [ /tcl ] (sans les espaces bien sûr) autour de vos codes tcl afin d'avoir un meilleur rendu et une coloration syntaxique. x


stop posts on chan.
#8
Just a random thought there, but shouldn't it be [isop] rather than ![isop] o_o ?

Anyway - if i understood correctly what you want is simply a custom output queue ?
Here's a somewhat different approach than CC's. I tested it quickly with a bare tcl interp, it should work on eggdrops just as well :


Code:
set ::helpQueue {}
set ::helpQueueTimer {}
set ::helpQueueDelay 2500 ;# One message every 2500 ms

# Reset queue status
proc clearHelpQueue {args} {
    set ::helpQueue {}
    set ::helpQueueTimer [after cancel $::helpQueueTimer] }

proc processHelpQueue {args} {
    if {![llength $::helpQueue]} { return [clearHelpQueue] }
    # Pop first element from list and send it to server
    putquick [lindex $::helpQueue 0]
    if {[llength [set ::helpQueue [lrange $::helpQueue 1 end]]]} {
    # Init timer for next iteration if there's more to send, otherwise stop
        set ::helpQueueTimer [after $::helpQueueDelay ::processHelpQueue]
    } else { set ::helpQueueTimer {} }
}

proc pushHelpQueue {request} {
    # Push the message to the queue
    lappend ::helpQueue $request
    # Start it if not running
    if {$::helpQueueTimer == ""} { set ::helpQueueTimer [after $::helpQueueDelay ::processHelpQueue] }
}
You can bind !stop directly to clearHelpQueue, and then just use pushHelpQueue instead of puthelp/putquick in the script.


Messages In This Thread
stop posts on chan. - by heartbroken - 18/11/2012, 10:44
RE: stop posts on chan. - by CrazyCat - 18/11/2012, 11:39
RE: stop posts on chan. - by heartbroken - 19/11/2012, 03:56
RE: stop posts on chan. - by heartbroken - 21/11/2012, 00:59
RE: stop posts on chan. - by CrazyCat - 21/11/2012, 15:17
RE: stop posts on chan. - by heartbroken - 21/11/2012, 17:44
RE: stop posts on chan. - by CrazyCat - 22/11/2012, 10:11
RE: stop posts on chan. - by Artix - 23/11/2012, 22:07

Possibly Related Threads…
Thread Author Replies Views Last Post
  [aide] trivia.tcl, commande !stop inactive blackdevil 3 4,014 19/04/2010, 01:52
Last Post: sebastien

Forum Jump:


Users browsing this thread: 1 Guest(s)