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
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Thu Jul 27, 2006 1:33 pm   

#IF question right quick
 
Would this be possible?

Code:
#alias {test} {#if (%1 <> "one"|"two"|"three") {#showme Please enter either -one, two, or three-.  Thank you.};#if (%1 = "one"|"two"|"three") {#showme Ding!!}}
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Thu Jul 27, 2006 2:29 pm   
 
I've been trying different variations on this and couldn't get them to work, so I'm missing something. The main thing is that you don't need two if statements since they are a true-false of each other as it is and it is shorter and easier to do #IF (condition) {actions if condition true} {actions if condition false}. The issue seems to be either in the condition operator, the use of quotation marks, or the OR operator.

Yup...it was the use of the OR operator. The way you have is it not programatically the same as saying "If the number is this or this or that". Computer need it more like "If the number is this, or the number is that, or the number is that."

Also, don't know why you are using #SHOWME. You just trying to use #SHOW there?

anyhow #if ( %1 = "one" | %1 = "two" | %1 = "three") {#show Ding!!} {#show Please enter either -one, two, or three-. Thank you.} should work
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Jul 27, 2006 2:39 pm   
 
#ALIAS test {#if (%ismember( %1, {one|two|three}) = 0) {#say Please enter either -one, two, or three-. Thank you.} {#say Ding!!}}

You don't need to do the #if twice, since a normal if statement is
#if (test) {then} {else}

Edit: Darn, was beaten to it ;)
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Thu Jul 27, 2006 2:46 pm   
 
Yeah, the SHOWME was meant as SHOW, just using it as an example. How about this?

Code:
#var numbers {one|two|three|four|five|six|seven|eight|nine|ten}

#alias test {#if (%ismember( %1, @numbers) = 0) {#say Please enter a number 1 thru 10} {#say Ding!!}}
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Thu Jul 27, 2006 5:21 pm   
 
I completely forgot about %ismember.

That should work shaun.murray
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Thu Jul 27, 2006 6:38 pm   
 
Hhmmmmmm.... Well, cool! I think that configuring a variable and letting the alias to the check on the variable might be the best way to go! Thanks for everyone's help!!!!! *cheers*
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