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
Thistony
Newbie


Joined: 23 Feb 2002
Posts: 2

PostPosted: 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?
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: 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
Reply with quote
Thistony
Newbie


Joined: 23 Feb 2002
Posts: 2

PostPosted: 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.
Reply with quote
gyropump
Newbie


Joined: 07 Feb 2002
Posts: 6
Location: USA

PostPosted: 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 .*^*.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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
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