| View previous topic :: View next topic |
| Author |
Message |
hlds12 Voice
Joined: 29 Dec 2009 Posts: 3
|
Posted: Tue Dec 29, 2009 8:22 pm Post subject: bind time dosn't work with PRIVMSG |
|
|
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 |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Dec 29, 2009 8:42 pm Post subject: |
|
|
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 |
|
 |
hlds12 Voice
Joined: 29 Dec 2009 Posts: 3
|
Posted: Tue Dec 29, 2009 9:28 pm Post subject: |
|
|
| 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 |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Dec 29, 2009 9:40 pm Post subject: |
|
|
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 |
|
 |
hlds12 Voice
Joined: 29 Dec 2009 Posts: 3
|
Posted: Tue Dec 29, 2009 9:44 pm Post subject: |
|
|
| Thank you very much, at last that occurred to me... |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Dec 29, 2009 9:55 pm Post subject: |
|
|
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 |
|
 |
|