Absolutely. You can also make your script execute something after a certain number of minutes or seconds.Ima wrote:I was wondering if it's possible to have a timer on that.
Like @Set timedmsg 45 Hello
45 would be minutes, seconds, whatever I was just wondering if it's possible to add a timer and if so how I would go about doing it.
}
if { [string tolower [lindex $arg 1]] == "timedmsg" } {
if {[lindex $arg 2 end] == ""} {
if {[file exists $datafolder/$chan/settings/timedmsg]} {
unotice $nick $oldchan "\002TimedMSG\002 [commands_filter [getsettings $chan timedmsg]]"
return
}
unotice $nick $oldchan "\002TimedMSG\002 None"
return
}
if { [string tolower [lindex $arg 2 end]] == "none" } {
file delete -force $datafolder/$chan/settings/timedmsg
unotice $nick $oldchan "\002TimeMSG\002 None (Your timedmsg has been disabled)"
return
}
if { [string tolower [lindex $arg 2 end]] == "off" } {
file delete -force $datafolder/$chan/settings/timedmsg
unotice $nick $oldchan "\002TimeMSG\002 Off (Your timedmsg has been disabled)"
return
}
set fp [open $datafolder/$chan/settings/timedmsg w+]
puts $fp "timedmsg [commands_filter [lrange $arg 2 end]]"
close $fp
unotice $nick $chan "\002TimedMSG\002 [commands_filter [lrange $arg 2 end]]"
unotice $nick $chan "(This msg will be displayed once every hour) To delete the timed msg use [channel get $chan trigger]set timedmsg none"
return
}
And inDragnLord wrote:bump what??
you still have not provided proc timedmsg
if you want help with this, post the entire script
Code: Select all
tags with proper spacing.
Code: Select all
proc start:timer {nick host hand chan text} {
global channel msg interval id
if {[matchattr $hand A] == 0} {noaccess2 $nick ; return}
set name $nick
set interval [lindex $text 0]
set channel [lindex $text 1]
set msg [lrange $text 2 end]
utimer $interval timer
putserv "NOTICE $nick :Starting timer Message: \"$msg\" Every $interval seconds"
}
proc timer {} {
global channel msg interval timerID
putserv "PRIVMSG $channel :$msg"
set timerID [utimer $interval timer]
}
proc stop:timer {nick host hand chan text} {
global timerID
if {[matchattr $hand A] == 0} {noaccess2 $nick ; return}
putserv "NOTICE $nick :Timer stopped"
killutimer $timerID
return 1
}