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 needed

Help for those learning Tcl or writing their own scripts.
Post Reply
l
lenooxx
Voice
Posts: 27
Joined: Tue Mar 24, 2009 10:56 am
Location: Hungarian
Contact:

help needed

Post by lenooxx »

heya , i need help , i have tried creating a script , but it dosent work for me , someone know whats wrong? Thank you

Code: Select all

set urls {
"http://whaterver.com"
}

set posting_chans "*"

bind time  10  posting

proc posting {nick uhost hand chan arg} {
	global urls posting_chans
	foreach chan [channels] {if {(([lsearch -exact [string tolower $posting_chans] [string tolower $chan]] != -1) || ($posting_chans == "*"))} {putserv "PRIVMSG $chan :[lindex $urls [rand [llength $urls]]]"}}
}
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I'm in a hurry, so I'm just going to comment on the binding (without checking the code inside the procedure). If you want it to execute every 10 minutes, then this is the proper binding:

Code: Select all

bind time - {?0 *} posting
l
lenooxx
Voice
Posts: 27
Joined: Tue Mar 24, 2009 10:56 am
Location: Hungarian
Contact:

:)

Post by lenooxx »

thank you very much ^^
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Also, you're using [lsearch] to search in a string (which is never recommended), $posting_chans should be a list. Wildcards in [lsearch] can only be used with -glob switch and the wildcards are specified in the third argument (the search string).
Post Reply