This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
pilouuu
Halfop
Posts: 82 Joined: Mon Dec 26, 2005 8:03 pm
Post
by pilouuu » Tue Jan 24, 2006 1:01 pm
Code: Select all
set idx -1
set chans {#chan #chan2}
set msgs {"msg chan 1" msg chan 2"}
bind time - * fouu
proc fouu {m args} {
if {$m!="08" && $m!="09" && $m%20==0} {
foreach c $::chans {
puthelp "privmsg $c :[lindex $::msgs [incr ::idx]]"
}
}
}
code by daemon
my question is the tcl say msg chan1 and chan 2 after reboot. it oK. Is possible to say msg all them 20 mns?
thx
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Jan 24, 2006 5:46 pm
I'm not sure if I understood you correctly, but do you mean you want it to work every 20 minutes? if so then just remove
pilouuu
Halfop
Posts: 82 Joined: Mon Dec 26, 2005 8:03 pm
Post
by pilouuu » Tue Jan 24, 2006 6:11 pm
yes 20 mns say msg 20mns after etc etc. =]
$m!="08" && $m!="09" && *remove*
Tcl error [fouu]: can't use invalid octal number as operand of "%"
Code: Select all
proc fouu {m args} {
if {$m%20==0} {
foreach c $::chans {
puthelp "privmsg $c :[lindex $::msgs [incr ::idx]]"
Thx sir_Fz
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Jan 24, 2006 6:57 pm
I've seen this error before but didn't figure out why exactly it occurs (maybe a bug in Tcl), I think it occurs (sometimes) only when m is "0?" so try:
Code: Select all
if {[string trimleft $m 0]%20 == 0} {
pilouuu
Halfop
Posts: 82 Joined: Mon Dec 26, 2005 8:03 pm
Post
by pilouuu » Tue Jan 24, 2006 8:04 pm
[01:00] Tcl error [fouu]: can't use empty string as operand of "%"
always
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Tue Jan 24, 2006 8:43 pm
Not always, but every hour (when $m is 00). Use this:
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Tue Jan 24, 2006 11:49 pm
Sir_Fz wrote: I've seen this error before but didn't figure out why exactly it occurs (maybe a bug in Tcl)
no, it's not a bug
a number starting with 0 is considered octal (base eight) in Tcl, as in many other languages (most important being of course C/C++); so you don't have 8 in the octal system, eight becomes 10
so 08 or 09, passed as argument to [bind time] handler isn't valid number and can't be part of numerical expression, hence that error
connection, sharing, dcc problems? click
<here>
before asking for scripting help, read
<this>
use
pilouuu
Halfop
Posts: 82 Joined: Mon Dec 26, 2005 8:03 pm
Post
by pilouuu » Wed Jan 25, 2006 6:10 am
hi
not error detected but that does not go.
the bot one said the sentence right once but it repeat not
thank you very much of your assistance
pilouuu
Halfop
Posts: 82 Joined: Mon Dec 26, 2005 8:03 pm
Post
by pilouuu » Wed Jan 25, 2006 7:02 pm
No solution?
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Wed Jan 25, 2006 7:24 pm
The solution I gave you works just fine. It will msg every 20 minutes (for example at 4:00 4:20 4:40 5:00 5:20...etc)
pilouuu
Halfop
Posts: 82 Joined: Mon Dec 26, 2005 8:03 pm
Post
by pilouuu » Wed Jan 25, 2006 8:04 pm
Code: Select all
if {[regexp {4:20|4:40|5:00} $m]} {
etc etc?
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Wed Jan 25, 2006 8:10 pm
pilouuu
Halfop
Posts: 82 Joined: Mon Dec 26, 2005 8:03 pm
Post
by pilouuu » Wed Jan 25, 2006 9:40 pm
the procedure is not good the bot say only 1. no repat msg
pilouuu
Halfop
Posts: 82 Joined: Mon Dec 26, 2005 8:03 pm
Post
by pilouuu » Thu Jan 26, 2006 9:49 am
it east can be possible with a timer?
expl:
Code: Select all
bind time - "20 * * * *" drtime
proc drtime { min hour day month year } {
thx
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Thu Jan 26, 2006 9:59 am
Code: Select all
set idx -1
set chans {#chan #chan2}
set msgs {"msg chan 1" msg chan 2"}
bind time - * fouu
proc fouu {m args} {
if {[regexp {00|20|40} $m]} {
foreach c $::chans {
puthelp "privmsg $c :[lindex $::msgs [incr ::idx]]"
}
}
}
works perfectly.