I wrote a quite nice script that triggers !joined and !returned from gamers and writes them with their actual game-ip and game into a .txt which is displayed on my website and on !gamers in the chan.
Now I got the problem, that - if a gamer times out on IRC during he's on a server, my Bot can't notice when he's back from gaming - so he'd stay on the list forever.
I solved this so far sind i made a !makereturned-proc where I can remove gamers by will, but that's not the best solution since i can't check the list 24/7.
I decided to set up timers that do remove a gamer after a while, let's say five hours from putting on the list. Because I did not find any clear documentation on advanced timers, I hope you guys can tell me how to realize this stuff.
I thougt I would use something like
Code: Select all
timer($hand) 300 returned
In my words:
timer(testgamer) 300 returned
should open the proc returned which should remove "testgamer" from the list. The !returned-proc goes like this:
Code: Select all
proc returned { name uhost hand text { dest ""}} {
putlog "---+++--- Received return-command from $hand. ---+++---"
set found 0
set index ""
set file [open file.txt r]
while {![eof $file]} {
set lines [split [read $file] "\n"]
foreach line $lines {
if {$line == ""} { continue }
if {[lsearch $line $hand] > 0} {
set found 1
} else { lappend index $line }
}
if {$found == 0} {
putlog "---+++--- $hand not in gamer's list. ---+++---"
putquick "NOTICE $name : U were not on the list."
return }
}
catch {close $file}
set file [open file.txt w]
foreach line $index {
puts $file $line
}
catch {close $file}
putlog "---+++--- $hand removed from gamer's list. ---+++---"
putquick "NOTICE $name : Successfully removed."
}
