|
chadeo Newbie
Joined: 08 Jan 2002 Posts: 1
|
Posted: 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. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: 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 |
|
|
|
|
|
|
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
|
|