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.
JKM
Voice
Posts: 30 Joined: Sat Dec 06, 2008 11:14 pm
Post
by JKM » Sun Oct 18, 2009 3:24 pm
Neither of these scripts are working, and I'm wondering what's wrong.
Code: Select all
set tagChans "#chan"
bind join - {% TAG|*} voice:user
bind nick - {% TAG|*} voice:user
bind nick - * devoice:user
bind join - #chan2 msg:chanjoin
proc voice:user {nick uhost hand chan {nn ""}} {
if {$nn == ""} {set nn $nick}
if {[lsearch -exact [split [string tolower #chan]] [string tolower $chan]] != -1 && ![isvoice $nn $chan]} {
pushmode $chan +v $nn
}
}
proc devoice:user {nick uhost hand chan nn} {
if {[lsearch -exact [split [string tolower #chan]] [string tolower $chan]] != -1 && ![string match -nocase tag|* $nn] &&
[isvoice $nn $chan]} {
pushmode $chan -v $nn
}
}
proc msg:gsjoin {nick host handle chan text} {
putserv "PRIVMSG $chan :Hey, $nick! Welcome."
}
speechles
Revered One
Posts: 1398 Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)
Post
by speechles » Sun Oct 18, 2009 5:31 pm
tagChans = list of channels to care about
tagTag = tag we are checking for
Code: Select all
set tagChans "#chan1 #chan2 #etc"
set tagTag "TAG|"
bind join - "% $tagTag*" voice:user
bind nick - "% $tagTag*" voice:user
bind nick - * devoice:user
bind join - #chan2 msg:chanjoin
proc voice:user {nick uhost hand chan {nn ""}} {
if {$nn == ""} {set nn $nick}
if {[lsearch -exact [split [string tolower $::tagChans]] [string tolower $chan]] != -1 && ![isvoice $nn $chan]} {
pushmode $chan +v $nn
}
}
proc devoice:user {nick uhost hand chan nn} {
if {[lsearch -exact [split [string tolower $::tagChans]] [string tolower $chan]] != -1 && ![string match -nocase $::tagTag* $nn] &&
[isvoice $nn $chan]} {
pushmode $chan -v $nn
}
}
proc msg:gsjoin {nick host handle chan text} {
putserv "PRIVMSG $chan :Hey, $nick! Welcome."
}
JKM
Voice
Posts: 30 Joined: Sat Dec 06, 2008 11:14 pm
Post
by JKM » Sun Oct 18, 2009 6:49 pm
Thanks, but this one doesn't work either:
Code: Select all
bind join - #chan2 msg:chanjoin
proc msg:chanjoin {nick host handle chan text} {
putserv "PRIVMSG $chan :Hey, $nick! Welcome."
}
(Just a welcome message to everyone that joins)
speechles
Revered One
Posts: 1398 Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)
Post
by speechles » Sun Oct 18, 2009 6:52 pm
That is because join has only 4 arguments passed nick, host, handle and channel. Yet you've included text making it 5. Joins do not pass this additional argument for text. Simply change it to look as it does below:
Code: Select all
bind join - #chan2 msg:chanjoin
proc msg:chanjoin {nick host handle chan} {
putserv "PRIVMSG $chan :Hey, $nick! Welcome."
}