| View previous topic :: View next topic |
| Author |
Message |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sun Jul 26, 2009 3:53 pm Post subject: msg once a day by bind time |
|
|
| Code: | bind time - "33 15 *" BREAKTIME
################
proc BREAKTIME {nick uhost hand chan arg} {
putquick "PRIVMSG $chan :something....."
return 0
} |
Am trying to make the bot say something once a day, but what am I doing wrong? I kept getting errors untill I made it "nick uhost hand chan arg" but doesn't display the message or show any error. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Jul 26, 2009 4:12 pm Post subject: |
|
|
Please read the documentation for the Time binding (quoted below). As you can see, the arguments passed to the proc are minute, hour, day, month, and year, not nickname, userhost, handle, channel, and text. As such, you first need to make sure your proc takes the appropriate number of parameters (5). This is why it started working when you added "arg" at the end of the list. That, however, does not mean "chan" will hold a channel name, but rather the current month (as a number 01-12). As such, I would recommend that you use some other names for those variables, as to avoid confusion.
Secondly, you'll need to alter your PRIVMSG commandline to take a valid destination, either by hardcoding this into the script, or using some global variable.
| Code: | (37) TIME (stackable)
bind time <flags> <mask> <proc>
proc-name <minute> <hour> <day> <month> <year>
Description: allows you to schedule procedure calls at certain
times. mask matches 5 space separated integers of the form:
"minute hour day month year". minute, hour, day, month have a
zero padding so they are exactly two characters long; year is
four characters. Flags are ignored.
Module: core |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sun Jul 26, 2009 4:14 pm Post subject: Re: msg once a day by bind time |
|
|
| cache wrote: | | Code: | bind time - "33 15 *" BREAKTIME
################
proc BREAKTIME {nick uhost hand chan arg} {
putquick "PRIVMSG $chan :something....."
return 0
} |
Am trying to make the bot say something once a day, but what am I doing wrong? I kept getting errors untill I made it "nick uhost hand chan arg" but doesn't display the message or show any error. |
Your not naming your variables correctly, but you kept the 5 expected by a bind to time. You may want to use "minutes hours day month year" instead. Then you can see the next issue you will have. A bind to time doesn't give you any $chan argument to use no matter where you place it. You need to place the message staticly:
putquick "PRIVMSG #chan :something....."
Edit: Nml375 beat me to it.. haw  _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sun Jul 26, 2009 4:31 pm Post subject: |
|
|
| so the $chan part has to be static? No way to make this work in all rooms it is in? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sun Jul 26, 2009 4:39 pm Post subject: |
|
|
| cache wrote: | | so the $chan part has to be static? No way to make this work in all rooms it is in? |
| Code: | # Sure, you just change this:
putquick "PRIVMSG #chan :something....."
# To this:
foreach chan [channels] {
putquick "PRIVMSG $chan :something....."
} |
_________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sun Jul 26, 2009 6:49 pm Post subject: |
|
|
| speechles wrote: | | cache wrote: | | so the $chan part has to be static? No way to make this work in all rooms it is in? |
| Code: | # Sure, you just change this:
putquick "PRIVMSG #chan :something....."
# To this:
foreach chan [channels] {
putquick "PRIVMSG $chan :something....."
} |
|
I have it like this now and it works
| Code: | ##########
bind time - "33 15 *" BREAKTIME
proc BREAKTIME {nick uhost hand chan arg} {
foreach chan [channels] {
putquick "PRIVMSG $chan :something....."
}
return 0
}
########## |
Just want to make sure it is done right, thanks |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Mon Jul 27, 2009 11:48 am Post subject: |
|
|
It is something of a coincidence that this code now functions as expected.
A TIME bind returns {minute hour day month year} to the proc it calls and not {nick uhost hand chan arg}. However, since you are permitted to call the arguments anything you like as they are received by the proc AND there happens to be five of them, it does work.
This is why you couldn't use $chan to send a channel output message to the IRCD in your original code. A TIME bind is not directly associated with an IRC channel. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
|