|
sepe Novice
Joined: 09 Feb 2002 Posts: 39 Location: USA
|
Posted: Mon May 27, 2002 4:24 am
Stupif IF question |
OK trying to set up a macro that will only fire if two conditions are true. First I got teh conditions working fine.
The two variable we'll call
XXX and YYY
this is the IF statement I'm trying
#IF (@XXX AND @YYY) {strike @target}{#sh OFF BALANCE}
#va XXX 1
#va YYY 1
thus if I have balance and equilbrium, i will strike, if NOT I will see on my screen, but NOT sent to the mud, OFF BALANCE
Note that I aslo include a #VA statement to put both variables to a true statement, when I get the message from the MUD that I have balance or EQ it sets it back to 0 or false
what am I doing wrong?
Dazed glazed and having fun |
|
|
|
Castaway GURU
Joined: 10 Oct 2000 Posts: 793 Location: Swindon, England
|
Posted: Mon May 27, 2002 11:14 am |
Which bit doesn't work?
*confused*
Lady C. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Mon May 27, 2002 12:08 pm |
You need to have a space between the true statements, and the false statements. Also, there seems to be a problem with the logic here. If you put the #VAR statements outside the #IF, then they will always be set to true regardless of what part of the #IF executed. What you need, is to set the to false, when the true part of the #IF executes, and then have your triggers set the to 1 or true, when you regain balance and equilibrium. Your script, then, should be something like:
#IF (@XXX AND @YYY) {strike @target;#VAR XXX 0;#VAR YYY 0} {#SH OFF BALANCE}
Kjata |
|
|
|
sepe Novice
Joined: 09 Feb 2002 Posts: 39 Location: USA
|
Posted: Mon May 27, 2002 10:30 pm |
By using that method, no matter what happens the second portion (the #SH OFF BALANCE part) ALWAYS fires, regardless if XXX and YYY equal 0 or 1
???
Dazed glazed and having fun |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue May 28, 2002 5:26 am |
XXX must equal 1 AND YYY must equal 1 AT THE SAME TIME.
LightBulb
Vague questions get vague answers |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue May 28, 2002 11:37 am |
Yeah, you said that you want the true part to be executed only if both variables are 1. That is precisely what the and operator does, it returns true only if both operands are true, false otherwise. Also, the only other difference is moving the variables into the true part, which should not affect the testing of the condition in any way, and the adding of the space between the true part and the false part which is required because of the syntax.
Kjata |
|
|
|
sepe Novice
Joined: 09 Feb 2002 Posts: 39 Location: USA
|
Posted: Tue May 28, 2002 11:26 pm |
Your right, it works, now that I have the variables spelled the same in EVERY location. Thanks.
Dazed glazed and having fun |
|
|
|
|
|