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 Help with Userlist

Help for those learning Tcl or writing their own scripts.
t
theice
Voice
Posts: 36
Joined: Thu Mar 13, 2008 4:20 pm

Post by theice »

last question... just making this work a litte better

Code: Select all

set usern [lindex [split $t] 0] 
	set userh [nick2hand $usern]
	if {([matchattr $userh |f $channel]) || ([matchattr $usern |f $channel])} {
the user jaedaen is showing up in the users list [eval userlist] but saying not a real user when I use the above if statement

is that || not used correctly?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

set userh [nick2hand [lindex [split $t] 0]]
if {([matchattr $userh |f $channel]) {
    # user is in the userlist as friend
} else {
    # ain't
}
if {([matchattr $userh |f $channel]) || ([matchattr $usern |f $channel])} {
The bold part is your problem, you can't use matchattr with nicks, it wants handles.
t
theice
Voice
Posts: 36
Joined: Thu Mar 13, 2008 4:20 pm

Post by theice »

Code: Select all

bind pub - ${pubtrig}whois whois:pub
proc whois:pub {n u h c t} {
	global channel
	set userh [nick2hand [lindex [split $t] 0]] 
	if {[matchattr $userh |f $channel]} {
		puthelp "PRIVMSG $c :\002$userh is\002 \037\002Console\037\002: [getuser $userh XTRA console] \002\037Username\037\002: [getuser $userh XTRA username] \002\037Instruments:\037\002 Guitar-[getuser $userh XTRA Guitar] , Bass-[getuser $userh XTRA Bass] , VoX-[getuser $userh XTRA VoX] , Drums-[getuser $userh XTRA Drums]"
	
	}			
}
works if they are just typing .whois NICK
but if they are taking the list of users handles that the bot shows sometimes, and type .whois HANDLE,

it won't work unless their handle == their nick.
Image
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

bind pub - ${pubtrig}whois whois:pub
proc whois:pub {n u h c t} {
    global channel
    if {![validuser [lindex [split $t] 0]]} {
        set userh [nick2hand [lindex [split $t] 0]]
    } else {
        set userh [lindex [split $t] 0]
    }
    if {[matchattr $userh |f $channel]} {
        puthelp "PRIVMSG $c :\002$userh is\002 \037\002Console\037\002: [getuser $userh XTRA console] \002\037Username\037\002: [getuser $userh XTRA username] \002\037Instruments:\037\002 Guitar-[getuser $userh XTRA Guitar] , Bass-[getuser $userh XTRA Bass] , VoX-[getuser $userh XTRA VoX] , Drums-[getuser $userh XTRA Drums]"
   
    } else {
        puthelp "PRIVMSG $c :Who? ... Never heard of 'em."
    }
}
Use nick or handle, script will decide. Priority is given to handle. If valid handle isn't used, nickname is assumed. If nickname is also invalid (doesn't have +f) should see the Who? message...
t
theice
Voice
Posts: 36
Joined: Thu Mar 13, 2008 4:20 pm

Post by theice »

Genius!

thank you so much for the idea of a if statement if its a valid user,

didn't even think of it=]

ty
Image
Post Reply