|
Thistony Newbie
Joined: 23 Feb 2002 Posts: 2
|
Posted: Sat Feb 23, 2002 10:20 pm
If statements |
i'm having a bit of trouble with if statements.
To test it out,i used the following
#IF (1000<@MaxMana) {#ECHO 1st} {#ECHO 2nd}
now maxmana was 800, but it said the if statement was true, when it clearly isnt.
is this a bug,or am i missing something? |
|
|
|
Charbal GURU
Joined: 15 Jun 2001 Posts: 654 Location: USA
|
Posted: Sun Feb 24, 2002 12:03 am |
Hmm...
#var MaxMana 800
#IF (1000<@MaxMana) {#ECHO 1st} {#ECHO 2nd}
is echoing 2nd for me like it should. Are there specific instances where it is misfiring?
- Charbal |
|
|
|
Thistony Newbie
Joined: 23 Feb 2002 Posts: 2
|
Posted: Sun Feb 24, 2002 2:22 pm |
The following one does work OK with different values of Doublemana.
#if (@DoubleMana<1000)
But if i swap 1000 for a variable,it falls over again. Doesn't seem to be a pattern.
I'm using 6.24 beta though, so thats probably not helping. |
|
|
|
gyropump Newbie
Joined: 07 Feb 2002 Posts: 6 Location: USA
|
Posted: Sun Feb 24, 2002 3:44 pm |
the "<" i think is throwing it off cause it's trying to assign it literal it's probably seeing it in the same way as if it were a literal string:
%literal(1000<@Mana)
flip the inequality to (@mana>1000)
cause "<" is a special character too might be messing it up
another possibility is the timely programming question of when is 2 not equal to 2 , that would be when first 2 is a numeric value and second 2 is string, perhaps your variable has a space sneaked into it somewhere
wish i could help more looks fine to me otherwise
.*^*. If at first you dont succeed, your sky diving days are over .*^*. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Feb 24, 2002 4:21 pm |
I tested number vs. variable on both sides of the < sign, using all four possibilities. They all work. I'm using v6.16.
There are several possibilities.
1) You have a bug in the beta version -- Report it in the Beta forum
2) You have a string in your variable instead of a number
3) Your variable has a different value from what you think it does
4) You're making this up and laughing at us for wasting time on it
In any case, there's no chance we can provide any help except that if it's the first possibility and if someone reports it on the proper forum (the beta one) Zugg will fix it.
LightBulb
All scripts untested unless otherwise noted |
|
|
|
|
|