mada7 wrote: ↑Tue Mar 13, 2018 6:06 pm
I saw this mentioned in the previous forum
I think that was me. I remember blarting a thread's worth of going round in circles thinking out loud about logic gates, trying to get a single choice from a possibility of many. When I'm thinking about this stuff it makes more sense to me in electronics terms rather than programming, but the principle is the same.
Thinking about it now, for the OR function, if the context is simple, all you might need is that seperate event that checks it, with two identical event or dialogue triggers inside but with different criteria
1 > Criteria 1 & 2 & 3
2 > Criteria 4 & 5 & 6
Or for the other example
1 > Criteria 1 & 2
2 > Criteria 1 & 3
Either one, or both, will pass if each criteria is met. If you want it more discerning, it starts to get messy.
Logic gates can be done in many combinations to have the same end result, and all gates can be emulated using just NAND gates (Not AND) but that can get complex. This means that since we can use 'does not equal' and similar negative criteria, theoretically problem solved.
The problem with that solution is that you need to have an event or dialogue trigger line for every combination that's possible. Two binary options means four combinations. Four options means 16 combinations.
The simple AND logic is what we have, just having two or more criteria together. To turn this into a NAND gate to do the rest you need separated criteria for 1 yes and 2 no, and 2 yes 1 no (and maybe even 1 no 2 no, and 1 yes 2 yes) feeding into each one.
It takes 3 NAND gates to build an OR choice. It takes 4 NAND gates to build an exclusive OR choice.
If you want to trigger a different dialogue when criteria 1 and 2 are both met, but criteria 3 is not met, or anything similar, it's best laid out a binary truth table. Each line can be whatever event or dialogue trigger you want, the same or different, and each one has three criteria. Binary 0 is negative criteria (does not equal/has not been shown/not in inventory etc.) and binary 1 is naturally positive (has/had/did)
C1 C2 C3
0 0 0 -no criteria are met
0 0 1
0 1 0 - only criteria 2 is met
0 1 1
1 0 0
1 0 1 - criteria 1 and 3 are met, but not 2
1 1 0
1 1 1 - all criteria have been met
You don't need to use every combination, if not triggering any dialogue doesn't make it seem impolite in game context, but otherwise you'd need to do it for each one. Remember, 4 variables is 16 rows. 5 is 32. Nobody wants to go down that path.
However, if you only need a handfull of combinations from 32 (or more!!) and you want a specific dialogue to trigger for the rest of the possibilities, you could have each success option create a value that records a success (equals 1) and then triggers an event that starts the negative/incomplete dialogue with the condition that the success value does not equal 1.
I'm writing all this for my own future reference too, but I hope it helps some others understand things.