 |
Thrillhouse8 Beginner
Joined: 21 Sep 2004 Posts: 18
|
Posted: 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:
|
|
|
 |
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: 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
-------------------------------- |
|
|
 |
Thrillhouse8 Beginner
Joined: 21 Sep 2004 Posts: 18
|
Posted: Sun Aug 24, 2008 8:40 pm |
That did it. I must have messed up a parenthesis trying that the first time. Thanks
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: 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 |
|
|
 |
|
|