Jump to content

Conditions logic


Recommended Posts

C'est moi encore!

 

The and/or logic of conditions makes my head hurt, I have three conditions, A B and C. I want A or (B and C), B and C are the conditions GetCurrentWeatherPercent < 1 or > 0 to make a condition that GetCurrentWeatherPercent is between 0 and 1.

So I set the conditions in the creation kit to be:

A or

B and

A or

C and

 

is this correct?

 

 

diziet

Link to comment
Share on other sites

If I'm reading this right, then no, it's not correct.

 

You need

 

B and

 

C or

 

A

 

Put them together horizontally. It makes more sense that way.

 

Your condition reads "A or (B and A) or C". If A is true it fires. If not it checks if B and A are both true. If they are it fires. If not it checks to see if C is true. If it is it fires, if not it does nothing.

 

Mine reads "(B and C) or A"... so if B and C are both true, it fires. It doesn't even need to check the last one. If not, it checks to see if C is true. If it is, it fires, if not it does nothing.

Ah but the page here:

https://www.creationkit.com/index.php?title=Category:Conditions

 

seems to me to imply otherwise, apparently the 'or' takes precedence, so B and C or A becomes B and (C or A).

Hence the head hurting bit:)

 

diziet

Link to comment
Share on other sites

I'd already realised that and edited it! Doh! Tricky things conditions.

 

I see what you're getting at., now Mine says A or B and C?

 

Looks like I'm clueless at conditions. I'll read that article. I've never used anything other tham straightforward conditions. Sometimes I've used a simple A or B.

Link to comment
Share on other sites

answer: (B or A) and (C or A)

 

B or

A and

C or

A and ; the last one can be and or or, so it may as well be left as the default. Besides, it makes a pretty pattern that way.

 

So your first solution would also be right, after all that!

 

It took me ages, but didn't get it until this morning! that'll teach me to try to do maths at 2 am!

 

The possible pairs of Solutions are B,C : B,A : A,C and A,A. Both conditions in any one of those pairs must be true for the spell or whatever to work.

 

If only C is true, none of those pairs work. Same goes for if only B is true. If B and C are both true, the first pair matches. If A is true, the last pair matches and one or both of the middle pairs, so it does what you want.

 

The trick is understanding how it's generated. I don't know if I can explain it any better than they did. I'll try in a spoiler, using their example.

 

 

(A and B) or (C and D ) ; so we want A and B to be true for it to fire, or we need C and D to be true for it to fire. Anything else can't work.

 

Both things in the first 'and' bracket are 'ored' with both things in the second bracket, because it's the or statement in between the brackets that takes precedence, as you rightly pointed out.

 

We can just forget about B for now and do that one later. We can 'forget about' B because it makes no difference to how A works out. So we are left with this:

 

(A) or (C and D) ; this is just like your example, except for the letters, so it's the same working.

 

We need A to be 'ored' with both C and D. So we Get (A or C) and (A or D)

 

Doing it the other way round, (C and D) or (A) gives: (C or A) and (D or A), which amounts to the same thing, so it doesn't matter what order you do this step in.

 

Now we do the same thing for B.

 

(B) or (C and D)

 

We need B to be 'ored' with C and D, too. So we get: (B or C) and (B or D)

 

Putting all these together gets: (A or C) and (A or D) and (B or C) and (B or D), which is the same combo they have. It doesn't matter about the order of the brackets.

 

Then we write it out vertically:

 

A or

C and

A or

D and

B or

C and

B or

D and

 

There are 16 possible combinations of 4 letters each, with this one. I won't write them all out here, but I checked through them and it works. So does my solution that I gave above and the one you originally proposed for your own problem. Hope this helps.

 

 

I can't explain it any clearer. It is a bit mind-boggling at first. I'm delighted you posted this and pointed me to that guide, because if not and I'd tried more complex conditions, they could have failed and I'd not have had a clue as to why...

 

... so thanks for the maths puzzle et bonne chance, mon ami!

Link to comment
Share on other sites

No probs.

 

Did you find my explanation any better than the one on the CK page?

 

Tbh, I found that baffling because, like a bad teacher, they leapt from step 1 to step 10, just because it was obvious to them. :armscrossed:

 

Apart from that it was very useful for me because I had a number of ConstructibleObject recipes that had either one or two redundant conditions in them. They got there because I altered how it worked and thought to myself 'No harm in leaving them in, belts and braces and all that'. I spent an hour going through all my recipes and removing every last one, once I knew what a drain it could be on the system. I've also looked to see if my conditions could be refined to reduce them... a lot of work, but worth it, I think.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...