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.

Join/changenick script

Help for those learning Tcl or writing their own scripts.
Post Reply
J
JKM
Voice
Posts: 30
Joined: Sat Dec 06, 2008 11:14 pm

Join/changenick script

Post by JKM »

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."
}
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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."
}
J
JKM
Voice
Posts: 30
Joined: Sat Dec 06, 2008 11:14 pm

Post by JKM »

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)
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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."
}
Post Reply