| View previous topic :: View next topic |
| Author |
Message |
Ima Voice
Joined: 01 May 2007 Posts: 4
|
Posted: Tue May 01, 2007 7:19 pm Post subject: Timed Message Help |
|
|
I currently have a bot running, but I can only set a timer to a default time and not a specific time, if the source is needed I can provide it.
Example -
At current it would be @set timedmsg Hello
And it would repeat Hello once every hour
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.
Thank you very much, help would be appreciated. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
YooHoo Owner

Joined: 13 Feb 2003 Posts: 939 Location: Redwood Coast
|
Posted: Tue May 01, 2007 9:00 pm Post subject: Re: Timed Message Help |
|
|
| 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. |
Absolutely. You can also make your script execute something after a certain number of minutes or seconds.
This can be done with the timer and utimer commands.
The syntax of a timer command is timer <time> "<command> [parameters]".
The <time> is after how long your command should be executed.
If you are using timer this would be have to be in minutes and if you are using utimer this would have to be in seconds.
The <command> is the command you want to execute. This can be a TCL command, an Eggdrop command or anything else just as long as it's a valid command.
The [parameters] are the parameters you want to give to your command.
Hope that is helpful  _________________
Johoho's TCL for beginners
 |
|
| Back to top |
|
 |
Ima Voice
Joined: 01 May 2007 Posts: 4
|
Posted: Tue May 01, 2007 10:34 pm Post subject: |
|
|
| Quote: | }
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
} |
That is my current Timedmsg and I'm not quite sure how to add a timer to it, if anyone could help I would appreciate it. |
|
| Back to top |
|
 |
YooHoo Owner

Joined: 13 Feb 2003 Posts: 939 Location: Redwood Coast
|
Posted: Wed May 02, 2007 11:26 am Post subject: |
|
|
where is your proc timedmsg? This isn't the complete code  _________________
Johoho's TCL for beginners
 |
|
| Back to top |
|
 |
Ima Voice
Joined: 01 May 2007 Posts: 4
|
Posted: Wed May 02, 2007 9:27 pm Post subject: |
|
|
My fault I had thought I had two quotes
| Quote: | proc timedmsgcheck {n h handle ch te} {
global channel datafolder
foreach chan [channels] {
if {[file exists $datafolder/$chan/settings/timedmsg]} {
bindmsg BotServ $chan "[commands_filter [getsettings $chan timedmsg]]"
}
}
} |
|
|
| Back to top |
|
 |
Ima Voice
Joined: 01 May 2007 Posts: 4
|
Posted: Mon May 07, 2007 12:03 am Post subject: |
|
|
| Bump? |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Mon May 07, 2007 1:41 am Post subject: |
|
|
bump what??
you still have not provided proc timedmsg
if you want help with this, post the entire script |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon May 07, 2007 5:28 am Post subject: |
|
|
| DragnLord wrote: | bump what??
you still have not provided proc timedmsg
if you want help with this, post the entire script |
And in [code] tags with proper spacing. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
dq Voice
Joined: 03 Apr 2006 Posts: 32
|
Posted: Mon May 07, 2007 6:02 am Post subject: |
|
|
Perhaps this is what you're after?
| Code: | 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
} |
Don't forget to add your binds etc~
.timer interval #channel messagehere
Untested, Unthought-of and only supports one channel, anyone care to add/edit/abuse go for it =p
(Picked this up from another post somewhere here, again using the search function?) |
|
| Back to top |
|
 |
|