| View previous topic :: View next topic |
| Author |
Message |
pilouuu Halfop
Joined: 26 Dec 2005 Posts: 82
|
Posted: Tue Jan 24, 2006 1:01 pm Post subject: msg |
|
|
| Code: | 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 |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jan 24, 2006 5:46 pm Post subject: |
|
|
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
| Code: | | $m!="08" && $m!="09" && |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
pilouuu Halfop
Joined: 26 Dec 2005 Posts: 82
|
Posted: Tue Jan 24, 2006 6:11 pm Post subject: |
|
|
yes 20 mns say msg 20mns after etc etc. =]
| Quote: | | $m!="08" && $m!="09" && *remove* |
Tcl error [fouu]: can't use invalid octal number as operand of "%"
| Code: | proc fouu {m args} {
if {$m%20==0} {
foreach c $::chans {
puthelp "privmsg $c :[lindex $::msgs [incr ::idx]]" |
Thx sir_Fz |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jan 24, 2006 6:57 pm Post subject: |
|
|
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: | | if {[string trimleft $m 0]%20 == 0} { |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
pilouuu Halfop
Joined: 26 Dec 2005 Posts: 82
|
Posted: Tue Jan 24, 2006 8:04 pm Post subject: |
|
|
[01:00] Tcl error [fouu]: can't use empty string as operand of "%"
always |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jan 24, 2006 8:43 pm Post subject: |
|
|
Not always, but every hour (when $m is 00). Use this:
| Code: | | if {[regexp {00|20|40} $m]} { |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Jan 24, 2006 11:49 pm Post subject: |
|
|
| 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 [code] tag when posting logs, code |
|
| Back to top |
|
 |
pilouuu Halfop
Joined: 26 Dec 2005 Posts: 82
|
Posted: Wed Jan 25, 2006 6:10 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
pilouuu Halfop
Joined: 26 Dec 2005 Posts: 82
|
Posted: Wed Jan 25, 2006 7:02 pm Post subject: |
|
|
No solution?  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Jan 25, 2006 7:24 pm Post subject: |
|
|
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) _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
pilouuu Halfop
Joined: 26 Dec 2005 Posts: 82
|
Posted: Wed Jan 25, 2006 8:04 pm Post subject: |
|
|
| Code: | | if {[regexp {4:20|4:40|5:00} $m]} { |
etc etc? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
pilouuu Halfop
Joined: 26 Dec 2005 Posts: 82
|
Posted: Wed Jan 25, 2006 9:40 pm Post subject: |
|
|
the procedure is not good the bot say only 1. no repat msg  |
|
| Back to top |
|
 |
pilouuu Halfop
Joined: 26 Dec 2005 Posts: 82
|
Posted: Thu Jan 26, 2006 9:49 am Post subject: |
|
|
it east can be possible with a timer?
expl:
| Code: | bind time - "20 * * * *" drtime
proc drtime { min hour day month year } { |
thx |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Jan 26, 2006 9:59 am Post subject: |
|
|
| Code: | 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. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|