Deleted56253002User Posted August 24, 2021 Share Posted August 24, 2021 I am familiar with logic when it comes to scripting, especially since it comes with parenthesis. However, I am at a point where I must use CK conditions for certain things to function and I am a bit puzzled with how AND/OR works with complex conditions in CK. Here is what I have in mind script wise for easier understanding: For a magic effect to take place I want the following conditions to be met first: a || b || c || d || e || (f && (g || h || (i && j))) After running the function through a boolean algebra calculator I found online, here is the result: a OR b OR c OR d OR e OR (f AND g) OR (f AND h) OR (f AND i AND j) Based on this, I am assuming that this should be the order in which the conditions are placed? (see below) a ORb ORc ORf ANDg ORf ANDh ORf ANDi ANDj AND Is this correct? I am guessing that the first 3 conditions (a-c) are correct but where there were parenthesis in the original statements are what's confusing me as well as the fact that OR takes precedence over AND. Any help would be greatly appreciated! Link to comment Share on other sites More sharing options...
NexusComa2 Posted August 24, 2021 Share Posted August 24, 2021 (edited) The ()'s logic looks wrong ???? ...A few clips covering the harder part of that. SourceTo properly check whether ((A AND B) OR (C AND D)) is true, one would use:(A OR C AND B OR C AND A OR D AND B OR D) To properly check whether ((A AND B) OR (C AND D) OR (E AND F)) is true, one would use:(A OR C OR E AND A OR C OR F AND A OR D OR E AND A OR D OR F AND B OR C OR E AND B OR C OR F AND B OR D OR E AND B OR D OR F) Edited August 25, 2021 by NexusComa2 Link to comment Share on other sites More sharing options...
WhiteWolf424242 Posted August 24, 2021 Share Posted August 24, 2021 Not exactly. CK conditions group all adjacent OR's into one set of "parentheses".So for example in the conditions window,a ANDb ORc ORd AND Is equivalent to:a && (b || c) && d That's the only way how it works with CK conditions, it's hardwired.What you wrote:a ORb ORc ORf ANDg ORf ANDh ORf ANDi ANDj AND will be parsed by the CK as(a || b || c) && f && (g || h) && f && i && jThat's not what you want if I understand correctly. I'm not sure ifa || b || c || d || e || (f && (g || h || (i && j)))can be converted into the CK conditions syntax, it's a bit too complex. You can use the de-Morgan identities and other boolean tricks, I'm not clever enough to figure it out. If you have some boolean calculator, it might help getting it into the desired format. Link to comment Share on other sites More sharing options...
Dromundas Posted August 25, 2021 Share Posted August 25, 2021 (edited) WhiteWolf is right. Here are examples: https://www.creationkit.com/index.php?title=Category:Conditions A or B or C or D or E or (F and G) or (F and H) or (F and I and J) I think it should look like this in CK conditions:A or B or C or D or E or F andA or B or C or D or E or G or H or I andA or B or C or D or E or G or H or J and22 conditions, you can probably shorten this with different logic. Edited August 25, 2021 by Dromundas Link to comment Share on other sites More sharing options...
Recommended Posts