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 

bind time dosn't work with PRIVMSG

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


Joined: 29 Dec 2009
Posts: 3

PostPosted: Tue Dec 29, 2009 8:22 pm    Post subject: bind time dosn't work with PRIVMSG Reply with quote

I tried this:

Code:
bind pub - !force myproc
bind time - "?0 * * * *" myproc

proc myproc {nick uhost hand chan text} {

   set Something "text here"

   set writeFile [open file.txt w]
   puts $writeFile $Something
   close $writeFile


   putserv "PRIVMSG $chan : TEST TEXT"
}


When I write !force in my irc channel the proc "myproc" is performed. Good.
The funny part: With bind time it doesn't work! When I wait 10 minutes nothing is printed out by PRIVMSG but the text "text here" is written to the file file.txt.

Actually this means, the proc is performed with both "bind pub" and "bind time", but PRIVMSG doesn't work for bind time...

Can somebody please tell me how to use PRIVMSG within bind time...
Thanks!
Back to top
View user's profile Send private message
arfer
Master


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

PostPosted: Tue Dec 29, 2009 8:42 pm    Post subject: Reply with quote

A time bind does not pass a channel to the proc it triggers.

Code:

bind TIME - "?0 * * * *" myproc

proc myproc {minute hour day month year} {
  # code here
}


Each bind passes different arguments to the procs they call. Look them up in tcl-commands.html before using them.
_________________
I must have had nothing to do
Back to top
View user's profile Send private message
hlds12
Voice


Joined: 29 Dec 2009
Posts: 3

PostPosted: Tue Dec 29, 2009 9:28 pm    Post subject: Reply with quote

arfer wrote:
Each bind passes different arguments to the procs they call.
Thanks!
Does this mean that I can't use PRIVMSG at all? I could just do this
Code:
proc myproc {minute hour day month year} {
  # code here
}
and this
Code:
putserv "PRIVMSG $minute : TEST TEXT"
but that won't work.
Back to top
View user's profile Send private message
arfer
Master


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

PostPosted: Tue Dec 29, 2009 9:40 pm    Post subject: Reply with quote

The following code will output a message in the channel named #whatever every 10 minutes (whenever minutes ends with a 0 ie. 00, 10, 20 etc) :-

Code:

# set here the time bind's output channel
set mychan "#whatever"

bind TIME - "?0 * * * *" myproc

proc myproc {minute hour day month year} {
  global mychan
  putserv "PRIVMSG $mychan :time bind triggered"
  return 0
}

_________________
I must have had nothing to do


Last edited by arfer on Tue Dec 29, 2009 9:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
hlds12
Voice


Joined: 29 Dec 2009
Posts: 3

PostPosted: Tue Dec 29, 2009 9:44 pm    Post subject: Reply with quote

Thank you very much, at last that occurred to me...
Back to top
View user's profile Send private message
arfer
Master


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

PostPosted: Tue Dec 29, 2009 9:55 pm    Post subject: Reply with quote

The following code will output a message in all the bot's channels with a specific channel flag every ten minutes :-

Code:

setudef flag mytime

bind TIME - "?0 * * * *" myproc

proc myproc {minute hour day month year} {
  foreach chan [channels] {
    if {[channel get $chan mytime]} {
      if {[botonchan $chan]} {
        putserv "PRIVMSG $chan :time bind triggered"
      }
    }
  }
  return 0
}


In order to activate the flag for each channel, use (in the partyline) .chanset #channelname +mytime
_________________
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