| View previous topic :: View next topic |
| Author |
Message |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Fri Aug 15, 2008 7:26 am Post subject: [HELP] IF ELSE with Vars {{Solved}} |
|
|
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: |
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 |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Fri Aug 15, 2008 8:04 am Post subject: Re: [HELP] IF ELSE with Vars |
|
|
| 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: |
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: | | 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 == "" _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
Branden Halfop
Joined: 04 Aug 2007 Posts: 61
|
Posted: Fri Aug 15, 2008 8:13 am Post subject: |
|
|
| Awesome, thank you very much! |
|
| Back to top |
|
 |
|