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


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Sun Jan 25, 2004 7:28 am   

Problem with an #IF Statement
 
Ok, I think I got this all mixed up. Basically, what I want it to do is to check my mana level, if it is above X amount to FOCUS and if below it, to eat an herb if I have herbbalance. Here is my script so far:

#if (@focusbalance AND NOT @asleep AND NOT @aeon AND NOT @stunned AND @MANA>175) {
#if (@stupid) {
focusbalance = 0
focus
}
#if (@anorexia) {
focusbalance = 0
focus
}
#if (@epilepsy) {
focusbalance = 0
focus
}
}
#if (@herbbalance AND @mana<175) {
#if (@stupid) {
herbbalance= 0
outr orphine
eat orphine
}
}

should it just be:

#if (@focusbalance AND NOT @asleep AND NOT @aeon AND NOT @stunned AND @MANA>175) {
#if (@stupid) {
focusbalance = 0
focus
}
#if (@anorexia) {
focusbalance = 0
focus
}
#if (@epilepsy) {
focusbalance = 0
focus
}
} {#if {@stupid} {
herbbalance= 0
outr orphine
eat orphine
}
}

Thanks for all help
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Jan 25, 2004 5:08 pm   
 
No, the first version is probably closer to what you want.
#IF uses the entire condition, so the second version could try to eat orphine if (for instance) you were asleep.

If you want mana to be THE deciding factor it needs to be tested separately from the other conditions.
Reply with quote
Dagnimaer
Wanderer


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Sun Jan 25, 2004 6:49 pm   
 
Well, Mana is the deciding factor on which method of curing I will use.
Reply with quote
Dagnimaer
Wanderer


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Mon Jan 26, 2004 4:14 pm   
 
ok, how would I test for the mana to decide whether to focus or to eat an herb and such.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jan 26, 2004 6:50 pm   
 
What you already have does exactly that. Just leave it the way it is.

There are two ways to use mana as the deciding factor. One way is to use two #IF statements with one testing for mana above a desired amount and the other testing for mana below the desired amount. This is what you have.
#IF (@mana > 175) {do first thing}
#IF (@mana <= 175) {do second thing}

The other way is to use one #IF statement to test whether mana is above a desired amount and take one action if it is and another action if it's not.
#IF (@mana > 175) {do first thing} {do second thing}
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