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 

msg once a day by bind time

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


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Sun Jul 26, 2009 3:53 pm    Post subject: msg once a day by bind time Reply with quote

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


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Jul 26, 2009 4:12 pm    Post subject: Reply with quote

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


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun Jul 26, 2009 4:14 pm    Post subject: Re: msg once a day by bind time Reply with quote

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 Wink
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
cache
Master


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Sun Jul 26, 2009 4:31 pm    Post subject: Reply with quote

so the $chan part has to be static? No way to make this work in all rooms it is in?
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun Jul 26, 2009 4:39 pm    Post subject: Reply with quote

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


Joined: 10 Jan 2006
Posts: 306
Location: Mass

PostPosted: Sun Jul 26, 2009 6:49 pm    Post subject: Reply with quote

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


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Mon Jul 27, 2009 11:48 am    Post subject: Reply with quote

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
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