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.

need tcl script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
swasteris
Voice
Posts: 5
Joined: Thu Aug 24, 2006 12:51 pm

need tcl script

Post by swasteris »

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 :? )
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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: Select all

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
s
swasteris
Voice
Posts: 5
Joined: Thu Aug 24, 2006 12:51 pm

Post by swasteris »

very tnx ;)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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: Select all

 tag when posting logs, code
s
swasteris
Voice
Posts: 5
Joined: Thu Aug 24, 2006 12:51 pm

Post by swasteris »

something is ban working because in channel eggdrop bot write test1. so what wrong with that script?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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: Select all

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
s
swasteris
Voice
Posts: 5
Joined: Thu Aug 24, 2006 12:51 pm

Post by swasteris »

okey now it's work perfect :wink:
Post Reply