This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

pauze code for xx secs

Help for those learning Tcl or writing their own scripts.
Post Reply
p
paull
Voice
Posts: 6
Joined: Mon Dec 01, 2008 10:18 am

pauze code for xx secs

Post by paull »

I am looking for a code that will wait xx sec before it goes to th next part.

Past of my code:

Code: Select all

    putallbots "!channel $chan $nick"

    (hold for xx secs)

    set output [::mysql::sel $db "SELECT * FROM channel WHERE nick = '$nick' LIMIT 1;" -list]
    if {[string equal $output ""] != 1} {
        ::mysql::close $db
        return 0
       }

The putallbots send the stuff to the other bots, then I want to code to hold for 2 secs before it goes on to the query part.

Anyone know how I can do this?

Thanks
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

I would recommend splitting this into two separate procs, calling the second one from the first using utimer. Any proc that "blocks" (delays) will block your whole eggdrop, preventing it from taking any further actions until your proc completes.

Keeping that in mind, you could use the after command to simply hold your script for a specified amount of time. I would still strongly advice against this in favour of using timers.
NML_375
p
paull
Voice
Posts: 6
Joined: Mon Dec 01, 2008 10:18 am

Post by paull »

Good idea, thanks.

So the code will be something like(?):

Code: Select all


 putallbots "!channel $test1 $test2"
 utimer 5 [list usetest $test1 $test2]
}



proc usetest {test1 test2} {



Thanks
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Pretty much, yeah
NML_375
Post Reply