order of operations for mixed ANDOR conditionals?

Post » Tue Jun 19, 2012 5:19 am

does anyone know exactly how the engine handles operation priority for when you start mixing AND/OR in the conditionals?


for example, lets say i have these conditions for a dialog to trigger:

Ref(player) getitemcount gold >= 500 AND
Subject getisID == BlacksmithDude OR
Subject getisID == ApothecaryDude OR


now what i'm wondering, is:

1. will the AND condition only apply to the Blacksmith (subject is blacksmith npc AND player has More than or equal to 500 in gold)
2. will the AND condition apply universally to both OR targets (whether the npc target is the blacksmith or the apothecary, it will always check if the player even has enough gold to begin with)


preferably 2, but i don't know for sure
User avatar
Fluffer
 
Posts: 3489
Joined: Thu Jul 05, 2007 6:29 am

Post » Tue Jun 19, 2012 10:51 am

I dunno but you can always try it out yourself!
User avatar
Jack
 
Posts: 3483
Joined: Sat Oct 20, 2007 8:08 am

Post » Tue Jun 19, 2012 1:10 pm

Ref(player) getitemcount gold >= 500 AND
Subject getisID == BlacksmithDude OR
Subject getisID == ApothecaryDude OR
I think it would play out like (psuedo-code)
Player.GetItemCount(gold) >= 500 && (subj.getisid == BlackSmithDude || (subj.getisid == Apothecary || (subj.getisid == Farmer || (etc...))))
I believe OR has a lower priority than AND, there is some documentation on UESP about it
User avatar
Lauren Denman
 
Posts: 3382
Joined: Fri Jun 16, 2006 10:29 am

Post » Tue Jun 19, 2012 4:42 pm

I think if I remember correctly, each operator applies to the subject below it. So if it's an AND it must be met, but if it's an OR it can be that or the lower ones of the list. So that would pass if the top one AND either of (Or both of) the bottom two were met.
User avatar
Marine Arrègle
 
Posts: 3423
Joined: Sat Mar 24, 2007 5:19 am

Post » Tue Jun 19, 2012 9:10 am

http://www.creationkit.com/Conditions#Comparison #Comparison
The OR checkbox is used to determine how a Condition Item is evaluated with the ones that follow it.
Consecutive ORs are treated like a single block when evaluating and have order preference over AND.
For example, the condition items ( A AND B OR C AND D ) are evaluated as ( A AND ( B OR C ) AND D ) and not ( ( A AND B ) OR ( C AND D ) ).
User avatar
vanuza
 
Posts: 3522
Joined: Fri Sep 22, 2006 11:14 pm

Post » Tue Jun 19, 2012 1:12 pm

Use Parenthesis to make it behave the way you want it to.

So true if player has +500 gold and either dude.
Ref(player) getitemcount gold >= 500 AND
( Subject getisID == BlacksmithDude OR
Subject getisID == ApothecaryDude )

So true if player has +500 gold and its the blacksmith. Or its true if its the apothecary dude, no matter how much gold.
( Ref(player) getitemcount gold >= 500 AND
Subject getisID == BlacksmithDude ) OR
Subject getisID == ApothecaryDude
User avatar
teeny
 
Posts: 3423
Joined: Sun Feb 25, 2007 1:51 am

Post » Tue Jun 19, 2012 3:11 pm

i think the poster is talking about the built in conditions for the CK
User avatar
Louise Dennis
 
Posts: 3489
Joined: Fri Mar 02, 2007 9:23 pm

Post » Tue Jun 19, 2012 4:47 am

Could be, but it does not matter if you use parenthesis.
I thought it was at least worth mentioning.
User avatar
chirsty aggas
 
Posts: 3396
Joined: Wed Oct 04, 2006 9:23 am

Post » Tue Jun 19, 2012 8:05 pm

I mean you cant put parenthesis in the built in CK conditionals
User avatar
lexy
 
Posts: 3439
Joined: Tue Jul 11, 2006 6:37 pm

Post » Tue Jun 19, 2012 9:01 am

yes, i'm talking about the conditionals in dialogue boxes, not papyrus.

thanks for the wiki link i think that clears it up for me
User avatar
Britta Gronkowski
 
Posts: 3475
Joined: Mon Apr 09, 2007 3:14 pm


Return to V - Skyrim