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] IF ELSE with Vars {{Solved}}

Help for those learning Tcl or writing their own scripts.
Post Reply
B
Branden
Halfop
Posts: 61
Joined: Sat Aug 04, 2007 8:36 pm

[HELP] IF ELSE with Vars {{Solved}}

Post by Branden »

The script will only set +v on me no matter what.
I want:
if there is no nick provided, set +v on $nick, but if there is a nick provides, set +v on said nick.

Code: Select all

proc Voice { nick host hand chan text } { 
set User [lindex [split $text] 1]
if {$User == ""} {
pushmode $chan +v $nick
} else {
pushmode $chan +v $User
}
}
Last edited by Branden on Fri Aug 15, 2008 8:13 am, edited 1 time in total.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Re: [HELP] IF ELSE with Vars

Post by speechles »

Branden wrote:The script will only set +v on me no matter what.
I want:
if there is no nick provided, set +v on $nick, but if there is a nick provides, set +v on said nick.

Code: Select all

proc Voice { nick host hand chan text } { 
set User [lindex [split $text] 1]
if {$User == ""} {
pushmode $chan +v $nick
} else {
pushmode $chan +v $User
}
}
Your problem is quite simple.

Code: Select all

set User [lindex [split $text] 1]
This is your problem. Change the 1 to a 0 and you will be fine. 0 is the first index position of $text. 1 would be the 2nd, which of course is always == ""
B
Branden
Halfop
Posts: 61
Joined: Sat Aug 04, 2007 8:36 pm

Post by Branden »

Awesome, thank you very much!
Post Reply