set votefile "scripts/vote.txt"
if {![file exists $votefile]} {
catch {close [open $votefile w]}
}
setudef flag vote
bind pub - !vote votescript
proc votescript {nick uhost hand chan arg} {
global votefile
channel set $chan +vote
putquick "PRIVMSG $chan :Vote initiated by $nick: $arg Type !poll yes and !poll no"
####Here a timer must be inserted. After 1 minute the bot should continue with the rest of this script.
channel set $chan -vote
set fp [open $votefile "r"]
set data [read -nonewline $fp]
close $fp
set lines [split $data "\n"]
set num 0
set randline [lindex $lines $num]
set yes [lindex $randline 0]
set no [lindex $randline 1]
putquick "PRIVMSG $chan :Voting period over. Results: Yes: $yes, No: $no"
set fd [open $::votefile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
set list [lreplace $list 0 0 [list 0 0]]
seek $fd 0
puts -nonewline $fd [join $list \n]
close $fd
}
proc's are not to be put to sleep by timer; you should get your proc chores done as soon as possible and relinquish control to eggdrop, thus conforming to its event-driven I/O model
what you need to do is usually done by registering a timer which will invoke the specified proc after a short period of time
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use