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.
lenooxx
Voice
Posts: 27 Joined: Tue Mar 24, 2009 10:56 am
Location: Hungarian
Contact:
Post
by lenooxx » Sat Nov 21, 2009 10:40 am
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]]]"}}
}
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sat Nov 21, 2009 11:26 am
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:
lenooxx
Voice
Posts: 27 Joined: Tue Mar 24, 2009 10:56 am
Location: Hungarian
Contact:
Post
by lenooxx » Sat Nov 21, 2009 12:06 pm
thank you very much ^^
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sat Nov 21, 2009 9:45 pm
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).