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
Virus
Wanderer


Joined: 29 Jun 2002
Posts: 69
Location: USA

PostPosted: Tue Jul 30, 2002 2:02 am   

#IF
 
I am having a problem with the following.
If I do a:
#IF (T=%upper(t)) {#Sh Yes} {#SH No}
I get: Yes
If I do a:
#IF (@CONT) {#SH Yes} {#SH No} - And the variable @CONT exists and is 1, I get: Yes
Now if I do a:
#IF (T=%upper(t) and @CONT) {#SH Yes} {#SH No}
I get a: No.

Can soemoen please help?


Richard Powell
Mux Alias: Virus
2796 Wizard Staff
64.89.10.1 port 2796
Rich@gigdev.com
Reply with quote
Virus
Wanderer


Joined: 29 Jun 2002
Posts: 69
Location: USA

PostPosted: Tue Jul 30, 2002 2:17 am   
 
I just realized what I did. In the examples I added a space. May have something to do with it. Also, I used code similar to:
#IF (%1=%upper(%1)&@{CON%1}) {#SH Yes} {#SH No}
Well the problem with that was that I was typing it in as lowercase the whole time. Now, I have a list set up in CONS. Is there a way to check to see if a string is part of the list? IE If %1 is in list CONS then?

Heres an example. If my list is:
HI|DT|FS|RE|AF|aa|ty|ju|ME|ma
and I do a #IF aa is part of list cons then.?

Richard Powell
Mux Alias: Virus
2796 Wizard Staff
64.89.10.1 port 2796
Rich@gigdev.com
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jul 30, 2002 2:44 am   
 
First thing of note, there have been some reported problems of order of ops not working correctly in some syntaxes. I wouldn't know about these thing because years of programming taught me not trust order of ops with logic tests, it also taught me that I don't always think logically and must be particular to assure the computer is thinking the same way I am. I always explicitly define the order using paranthesis for all logic things and it serves me well.

#IF (("%1"=%upper("%1"))&(@{CON%1})) {#SH Yes} {#SH No}

As to the list question you can use the %ismember function. It is a case sensitive function so if you need it to not be then use %upper on both the search value and the list.
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