egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Timed Message Help

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Ima
Voice


Joined: 01 May 2007
Posts: 4

PostPosted: Tue May 01, 2007 7:19 pm    Post subject: Timed Message Help Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue May 01, 2007 8:25 pm    Post subject: Reply with quote

Show us your code.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
YooHoo
Owner


Joined: 13 Feb 2003
Posts: 939
Location: Redwood Coast

PostPosted: Tue May 01, 2007 9:00 pm    Post subject: Re: Timed Message Help Reply with quote

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 Mr. Green
_________________
Mr. Green
Johoho's TCL for beginners
Mr. Green
Back to top
View user's profile Send private message Send e-mail
Ima
Voice


Joined: 01 May 2007
Posts: 4

PostPosted: Tue May 01, 2007 10:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
YooHoo
Owner


Joined: 13 Feb 2003
Posts: 939
Location: Redwood Coast

PostPosted: Wed May 02, 2007 11:26 am    Post subject: Reply with quote

where is your proc timedmsg? This isn't the complete code Rolling Eyes
_________________
Mr. Green
Johoho's TCL for beginners
Mr. Green
Back to top
View user's profile Send private message Send e-mail
Ima
Voice


Joined: 01 May 2007
Posts: 4

PostPosted: Wed May 02, 2007 9:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ima
Voice


Joined: 01 May 2007
Posts: 4

PostPosted: Mon May 07, 2007 12:03 am    Post subject: Reply with quote

Bump?
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Mon May 07, 2007 1:41 am    Post subject: Reply with quote

bump what??
you still have not provided proc timedmsg

if you want help with this, post the entire script
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon May 07, 2007 5:28 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
dq
Voice


Joined: 03 Apr 2006
Posts: 32

PostPosted: Mon May 07, 2007 6:02 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber