Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
chadeo
Newbie


Joined: 08 Jan 2002
Posts: 1

PostPosted: Tue Jan 08, 2002 11:35 pm   

#if return values
 
#ALIAS test {%if(@var == 1,command)}

If I execute the above alias, and @var does not equal 1, the if statement will still return a value to the mud. This causes the mud to send me back its prompt, which gets very anoying. Is there a way to not return anything to the mud when the if statement is false? Sorry if this is a common question, I tried finding an answer in the old messages, but I could not find anything that addressed this question.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Jan 08, 2002 11:51 pm   
 
quote:

#ALIAS test {%if(@var == 1,command)}

If I execute the above alias, and @var does not equal 1, the if statement will still return a value to the mud. This causes the mud to send me back its prompt, which gets very anoying. Is there a way to not return anything to the mud when the if statement is false? Sorry if this is a common question, I tried finding an answer in the old messages, but I could not find anything that addressed this question.



You are using the wrong command (in this case, it's technically a function).

What you need to use is #IF, not %if(). Thus your alias would look like this:

#alias test {#if (@var == 1) {command} {#noop this command will prevent anything you put on this line from happening}}

li'l shmoe of Dragon's Gate MUD
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Jan 09, 2002 1:46 pm   
 
Also, do notice that unlike C and some other programming languages, you use = and not ==. You cannot do variable assignment in the conditional of an if statement in zMUD.

Kjata
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net