MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Mar 18, 2005 4:29 am |
When using logical operators, surround the logical equation with parentheses. If I had to guess what's happening, it's that "@incombat = 0 AND @startcombat = 1" is evaluating true in this manner (or in right to left fashion, it also works that way):
@incombat = 0 AND @startcombat = 1 -- original equation
0 = 0 AND @startcombat = 1 -- evaluate @incombat (0 = 0 returns true)
1 AND 1 = 1 -- evaluate @startcombat (1 = 1 also returns true)
1 = 1 -- evaluate 1 AND 1, returns true
1 -- evaluate 1 = 1, returns true
This is what you want, it ensures that @incombat is evaluated, then @startcombat, and finally the results from both.
(@incombat = 0) AND (@startcombat = 1) |
|