| View previous topic :: View next topic |
| Author |
Message |
swasteris Voice
Joined: 24 Aug 2006 Posts: 5
|
Posted: Thu Aug 24, 2006 1:01 pm Post subject: need tcl script |
|
|
bind time - * time:test; proc time:test {1} {if {[expr $m % 2]} {putserv "privmsg #eGc :test1"} {putserv "privmsg #eGc :test2"}}
how make that script work with eggdrop! that script me don't working whit eggdrop.. help plz (sry ban English ) |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Aug 24, 2006 1:44 pm Post subject: |
|
|
You hav'nt specified the value of $m...
Also, your proc does not take proper number of variables to be used with a time-binding
Finally, please put code inside code-blocks..
| Code: | bind time - * time:test
proc time:test {minute hour day month year} {
#setting m to 1 for demonstration
set m 1
if {[expr $m % 2]} {
puthelp "PRIVMSG #eGc :test1"
} {
puthelp "PRIVMSG #eGc :test2"
}
} |
Of course, you'll have to set m to something useful, unless you're using it as a global variable (then you'll have to "global m" it first however) _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
swasteris Voice
Joined: 24 Aug 2006 Posts: 5
|
Posted: Thu Aug 24, 2006 4:08 pm Post subject: |
|
|
very tnx  |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Aug 24, 2006 10:39 pm Post subject: |
|
|
there's a little catch here: this won't work and will bail out with Tcl error on minute values of 08 and 09 as these aren't valid octal numbers
you can use [scan] to extract proper numerical values from [bind time] proc arguments _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
swasteris Voice
Joined: 24 Aug 2006 Posts: 5
|
Posted: Fri Aug 25, 2006 3:55 am Post subject: |
|
|
| something is ban working because in channel eggdrop bot write test1. so what wrong with that script? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri Aug 25, 2006 6:10 am Post subject: |
|
|
Yes... and as I stated, you'll have to do something useful with $m in the first place... I only set it to 1 for demonstation purposes...
This example assumes you wish to test wether the minute is even or not (as suggested by demond, and with his scan-fix)
| Code: | bind time - * time:test
proc time:test {minute hour day month year} {
if {[expr [scan $minute "%d"] % 2]} {
puthelp "PRIVMSG #eGc :test1"
} {
puthelp "PRIVMSG #eGc :test2"
}
} |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
swasteris Voice
Joined: 24 Aug 2006 Posts: 5
|
Posted: Fri Aug 25, 2006 7:09 am Post subject: |
|
|
okey now it's work perfect  |
|
| Back to top |
|
 |
|