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
Thrillhouse8
Beginner


Joined: 21 Sep 2004
Posts: 18

PostPosted: Sun Aug 24, 2008 8:17 pm   

13 < 7
 
I've run into a snag where 13 < 7 returns true:

Code:
#SHOW %item(@varname,3),%item(@varname,5).
#SHOW %if(%item(@varname,3) < %item(@varname,5), true, false)
#SHOW %if(13 < 7, true, false)


Output:
    13,7.
    true
    false
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sun Aug 24, 2008 8:33 pm   
 
ZMud is pretty picky about stuff like that. I don't have it open atm so I can't test, but...

Code:

#show %if(%eval(%item(@varname,3)) < %eval(%item(@varname,5)), true, false)


Should do the trick.


Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
Thrillhouse8
Beginner


Joined: 21 Sep 2004
Posts: 18

PostPosted: Sun Aug 24, 2008 8:40 pm   
 
That did it. I must have messed up a parenthesis trying that the first time. Thanks
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Mon Aug 25, 2008 3:37 am   
 
The actual problem that causes it is how zMud interprets some values. When using %item the value returned has a hidden set of quotes and is treated as a string. In a string comparison "7 " is less then "70", and equally "6a" is less then "7". The use of %eval that Prognoi suggested removes the string behavior and causes the higher level comparison to operate with a numeric behavior instead of alphabetic. Hopefully the explanation helps you to understand any thing else in your script that behaves similarly.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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