1)
Code: Select all
utimer 120 [list putquick [encoding convertfrom utf-8 "PRIVMSG $chan :This is a quick message converted to UTF-8"]]
Code: Select all
timer 3 [list putmsg $chan "Hello world"]
Code: Select all
utimer 120 [list putquick [encoding convertfrom utf-8 "PRIVMSG $chan :This is a quick message converted to UTF-8"]]
Code: Select all
timer 3 [list putmsg $chan "Hello world"]
Code: Select all
# May 26, 2015
# http://forum.egghelp.org/viewtopic.php?p=104159&sid=f40235b3e21a35b95678280c8ef33c3f#104159
### this finds only the first instance
bind pub - "!timers" search_timers
proc search_timers {nick uhost handle chan text} {
putserv "privmsg $chan :timers are: [timers]"
putserv "privmsg $chan :text is: $text"
putserv "privmsg $chan :position in list of timers is: [lsearch -index 1 [timers] "*$text*" ] "
set pos [lsearch -index 1 [timers] "*$text*" ]
putserv "privmsg $chan :selected timer is: [lindex [timers] $pos]"
set selected [lindex [timers] $pos]
putserv "privmsg $chan :timer id is: [lindex $selected 2]"
}
###############
#### this will list all timers that match
bind pub - "!timersagain" find_all_timer_matches
proc find_all_timer_matches {nick uhost handle chan text} {
putserv "privmsg $chan :timers are: [timers]"
putserv "privmsg $chan :text is: $text"
set pos "[lsearch -index 1 -all [timers] "*$text*" ]"
putserv "privmsg $chan :selected timers are in these positions : $pos "
foreach num $pos {
putserv "privmsg $chan :timer is: [lindex [timers] $num]"
}
foreach num $pos {
putserv "privmsg $chan :timerid is: [lindex [timers] $num 2]"
}
}
Code: Select all
set utimerid [utimer 120 [list putquick [encoding convertfrom utf-8 "PRIVMSG $chan :This is a quick message converted to UTF-8"]]]
Thanks to the contribution willyw.SpiKe^^ wrote:Also, if you expect to need the timer id often, store it in a variable when you set the timer...Code: Select all
set utimerid [utimer 120 [list putquick [encoding convertfrom utf-8 "PRIVMSG $chan :This is a quick message converted to UTF-8"]]]