egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Branden
Halfop


Joined: 04 Aug 2007
Posts: 61

PostPosted: Fri Aug 15, 2008 7:26 am    Post subject: [HELP] IF ELSE with Vars {{Solved}} Reply with quote

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
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Fri Aug 15, 2008 8:04 am    Post subject: Re: [HELP] IF ELSE with Vars Reply with quote

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
View user's profile Send private message
Branden
Halfop


Joined: 04 Aug 2007
Posts: 61

PostPosted: Fri Aug 15, 2008 8:13 am    Post subject: Reply with quote

Awesome, thank you very much!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber