Condition Logic

Post » Mon Jun 18, 2012 6:00 am

Im having trouble getting an enchantment to work.

The first 2 conditions are working.

If Hour is >= 19
or
If Hour is <= 5

(To target the hours of night)

However, I need to add in some logic for Indoors and Sneaking

So my condition table ends up looking like this

Hour >= 19 or
Hour <= 05 or
IsSneaking == 1 and
IsInInterior == 1 and

However, this logic ends up breaking the time logic for some reason.

I am aiming for

1. Constant effect during those hours
2. While interior, and Sneaking, get the effect anyway, even during daylight hours.

Can someone give me a hand with this logic?
User avatar
Dalia
 
Posts: 3488
Joined: Mon Oct 23, 2006 12:29 pm

Post » Sun Jun 17, 2012 8:17 pm

What I need is

( A AND B OR C AND D )

But according to the wiki, I cant do that

It would give me
( A AND ( B OR C ) AND D )

The wiki doesnt explain how to get
( A AND B OR C AND D )
User avatar
sally coker
 
Posts: 3349
Joined: Wed Jul 26, 2006 7:51 pm

Post » Mon Jun 18, 2012 12:15 am

(( A AND B ) OR ( C AND D )) is what you want then?
User avatar
mimi_lys
 
Posts: 3514
Joined: Mon Apr 09, 2007 11:17 am

Post » Mon Jun 18, 2012 3:12 am

That kinda looks like it would complicate the time logic?

You cant have an hour that is above 19 and less than 5 - which is why I was using OR
eg- >= 19 or <= 5 or IsInterior and IsSneaking

The problem is, that the OR/AND flag gets attached to each condition, and affects how it relates to everything that comes after.
Consecutive OR's get evaluated as a block, and take precedence over AND or something like that

Which means that your statement would be put into the table as

A AND
B OR
C AND
D --

The wiki page isnt exactly clear..
http://www.creationkit.com/Condition
User avatar
Danger Mouse
 
Posts: 3393
Joined: Sat Oct 07, 2006 9:55 am

Post » Sun Jun 17, 2012 3:25 pm

Note, I cant even move the sneak and indoors logic to the top either.

eg

IsSneaking == 1 and
IsInInterior == 1 <---- because we have the and/or here means the IsInterior would get linked to the Hour >= 19 logic.
Hour >= 19 or
Hour <= 5 or
User avatar
Greg Swan
 
Posts: 3413
Joined: Tue Jun 05, 2007 12:49 am

Post » Sun Jun 17, 2012 6:11 pm

if Hour <= 5 || Hour >= 19 || (IsSneaking == 1 && IsInInterior == 1)

Isn't that what you want or am I completely missing something here?



EDIT: Or maybe you're not talking about scripting at all. Whoops.
User avatar
Alex Blacke
 
Posts: 3460
Joined: Sun Feb 18, 2007 10:46 pm

Post » Mon Jun 18, 2012 6:10 am

Let the following letters stand for the following sentences:
A: The hour >= 19
B: The hour <= 5
C: The character is sneaking
D: The character is indoors
E: The effect is applied

The following is in standard logical syntax,
where "v" is a symbol for "OR"
and "^" is a symbol for "AND"
and "-->" signifies an "IF/THEN" statement, with everything to the left of the symbol being the antecedent, and everything to the right, the consequent
and the parentheses indicate grouped symbols/sentence letters:

(A v B ) v (C ^ D) --> E

Written in sentence form, that symbolic sentence would read, "if it is the case that either it is after 19 or before 5, or the character is both sneaking and indoors, then the effect is applied." That's what you want, right?

However, based upon the language in the quoted wiki page and your post, above, it seems that the CK might be evaluating the conditions instead as: "(A v B v C) ^ D --> E"

Or, in English, "if it is the case that, either the hour is after 19, or the hour is before 5, or the the character is sneaking, and it is also the case that the character is indoors, then the effect is applied." Obviously, that is not what you want.

This seems to be the answer to why the logic is "breaking."

C ^ D ^ A v B doesn't help you, since that would be "character is sneaking and indoors AND the hour is either after 19 or before 5"

C ^ D v A v B also doesn't help, as you noted above already, since that gets evaluated as "character is indoors AND either character is sneaking, it is after 19, or it is before 5"

I really wanted to go through this process and arrive at a solution, but I ran through another couple permutations and possibilities, and nothing panned out. Hope the explanation and work shown, above, at least, is of some use.
User avatar
Chris Guerin
 
Posts: 3395
Joined: Thu May 10, 2007 2:44 pm

Post » Sun Jun 17, 2012 11:28 pm

Thats what I want, but you cant simply put () around things the way it is setup.

Its using the Enchantment Condition table, its not Papyrus script

It can be put down as

Hour <= 5 or
Hour <= 19 or
ISSneaking == 1 and/or
IsInterior == 1 and/or

When I do
Hour <= 5 or
Hour <= 19 or
ISSneaking == 1 and
IsInterior == 1 and

I get the ability to turn the effect on While sneaking, however it fires indoors or outdoors, and it breaks the normal non-sneaking mode

I think the only fix for this, is to make a separate effect, and have it added under different conditions.
I tried adding the same effect to the enchantment, but with new conditions, but it seemed that the same effect being applied and removed in conflicting conditions stopped it from working
User avatar
Manuel rivera
 
Posts: 3395
Joined: Mon Sep 10, 2007 4:12 pm

Post » Sun Jun 17, 2012 7:44 pm

Managed to get this working via a separate magic effect entry, and putting the conditions to be opposite times, but with sneak and interior on.
User avatar
Hussnein Amin
 
Posts: 3557
Joined: Sun Aug 05, 2007 2:15 am

Post » Mon Jun 18, 2012 3:53 am

For those interested in logic: what we're looking for here is a conjunctive normal form.

For those interested in the answer, the following formula works (I'm borrowing Tamrielian's variables):
A: The hour >= 19
B: The hour <= 5
C: The character is sneaking
D: The character is indoors
E: The effect is applied

A v B v C ^ D v B v A -> E

it evaluates like this: ((A v B) v C) ^ (D v (A v B)) -> E
User avatar
Rachel Hall
 
Posts: 3396
Joined: Thu Jun 22, 2006 3:41 pm

Post » Mon Jun 18, 2012 2:47 am

Excellent, Qazaaq. I suspected that something like that would work, combining three sentence letters in two conjuncts, just couldn't work out how to do it and didn't have time to keep on it. Well done.

If you test that with truth values, does it pan out? It does.

Using ((A v B ) v C) ^ (D v (A V B )) :

If it's between 5 and 19 ("daytime") and sneaking but not indoors. Should resolve to false (that is, no effect applied):
A = False
B = False
C = True
D = False

(F v F v T) ^ (F v F v F)

T ^ F

F

That checks out. What if it's after 19, not sneaking, and indoors. Should resolve to true.
A = T
B = F
C = F
D = T

(T v F v F) ^ (T v F v T)

T ^ T
T

What if daytime, sneaking, and indoors? Should resolve to true:
A = F
B = F
C = T
D = T

(F v F v T) ^ (T v F v F)

T ^ T

T

OK, I'm satisfied. Again, good job, but I guess OP figured out a different way to do it anyway. :D
User avatar
Karine laverre
 
Posts: 3439
Joined: Tue Mar 20, 2007 7:50 am


Return to V - Skyrim