• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Using "And" Conditions

Status
Not open for further replies.
Level 8
Joined
Sep 23, 2007
Messages
357
This is probably the most noobish-question I've ever asked, but if you put a bunch of conditions on the conditions part of a trigger, without putting them in an "And - Multiple Functions" function, do all conditions still need to be true in order for the trigger to continue?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,233
Convert an example trigger to JASS and perform a manual follow through of the script it produces. All will be revealed then.

If I recall placing multiple conditions in a condition block defaults to the same behaviour as logical and. The reason for the and block is for nested logic such as and components making up an or block.

Ultimatly it is far easier to use JASS for such logic as there you can just declare a comparator between 2 booleans.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
These two work the same way, all conditions need to be true. Don't use the first method, it add an unneeded AND.

  • Untitled Trigger 018
    • Events
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • 1 Equal to 2
          • ((Triggering unit) is A structure) Equal to True
          • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
  • Untitled Trigger 018
    • Events
    • Conditions
      • 1 Equal to 2
      • ((Triggering unit) is A structure) Equal to True
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
 
and is same like * in math, while or act like +

Let's think like this:
TRUE = 1 (or any other number that isn't 0)
FALSE = 0

example 1:
true and true and true and false = false
1*1*1*0 = 0

example 2:
false or true or false = true
0 + 1 + 0 = 1

Any result that will give you 0 will be false (everything else from 0 = true).

http://en.wikipedia.org/wiki/Boolean_algebra_(logic)
Don't use wiki for study just for exploring.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
And is only used when you are restricted to give a single condition like in group matching condition picks or when you have an Or structure and want to unite two or more conditions to be an operand of the Or.

  • Or - Any (Conditions) are true
    • Conditions
      • 1 Equal to 0
      • And - All (Conditions) are true
        • Conditions
          • 0 Equal to 0
          • 2 Equal to 0
This will return false because the And-block evaluates false (0 is equal to 0 but 2 is not) and 1 is not equal to 0, either. If it was, true would result.
 
Status
Not open for further replies.
Top