Unexpected Behavior with Conditional Logic
-
Conditions don’t always seem to work the way they should, and I’m observing some unexpected behaviour with the conditional logic. I would like help resolving these issues, so here is my list of observations and examples to help understand what the issues are that I’m experiencing:
I’m building a multi-step form that will be used to build table-top role-playing game characters. Step 1 you pick a name, Step 2 you pick a species, Step 3 you pick a trade, and Step 4 you calculate stats. I had to use conditional logic to determine whether or not to show certain species traits depending on which species gets selected, and another simple condition related to the trade selection. So far so good. But it seems that as I’m getting into building up conditional logic for the stats on Step 4, things that worked perfectly fine for the logic of species traits and trade abilities have suddenly stopped working as expected. I’m not sure if the rules are starting to break past a certain number of declared rules, or if something I have done in Step 4 has corrupted the logic system, but my observation here is that the whole system feels broken now that I’ve gotten into Step 4. I even encountered a situation where after adding some logic that wasn’t working for some unknown reason, I removed the faulty logic and then found logic that had been working before to no longer be working at all. I then removed those conditions too and re-implemented them only to encounter totally unexpected and different behaviour.
Different species come with different stat values for 4 different stat categories, so let me provide one example:
All 4 stat categories are initialized at 0, and if the selected species is Robot, you can add 1 to three different stat categories. So (1, 1, 1, 0), (1, 1, 0, 1), (1, 0, 1, 1), or (0, 1, 1, 1). Each stat category is represented in the form by a single checkbox field containing only one option, which is the value ‘1’. So I construct a rule as follows: If “ALL” of [species = Robot, Body = 1, Mind = 1, Social = 1] then “Hide” Agility. The expected behaviour is that if I pick Robot on Step 2, then when I get to Step 4, I should see all four stat categories present each with a single checkbox valued ‘1’, and then if I check three of them (body, mind, and social), the fourth one (agility) should disappear. But what happens instead, is that when I reach Step 4, assuming I’ve selected Robot on Step 2, then I only see Body, Mind, and Social with unchecked boxes and agility already hidden. Why would agility be hidden when not “ALL” of the conditions I set are true? Body, Mind, and Social are all supposed to be equal to 1 before Agility gets hidden, and yet the checkboxes with value ‘1’ for Body, Mind, and Social are unchecked (so they do NOT equal 1) and yet for some stupid reason, the logic system triggers the hiding of Agility anyway. I thought one explanation for this could be that the “ALL” and “ANY” options were being confused with each other and treated as opposite, because if only one of the conditions I declared needs to be true for Agility to get hidden, then it would certainly appear hidden right away when I get to Step 4 if I picked Robot in Step 2, because Species = Robot is one of the conditions. So I experimented with changing the “ALL” to “ANY” to see what would happen then. Strangely, when doing that, upon getting to Step 4 all four stat categories are shown, but then it turns out the only condition that will actually trigger Agility getting hidden is having Social selected, and it doesn’t respond at all to any of the other conditions. It leads me to wonder if there is an issue with the order in which I am declaring the conditions in my rule, because the only condition that is triggering the action is the last condition in the list, if I select “ANY” instead of “ALL”. I switched back to “ALL” and then wondered if maybe somehow the stats were already being recognized as equaling “1” despite not yet being checked, and that’s why Agility was automatically hidden already when I first got to Step 4, so I did another experiment and declared the conditions to be stat != 1. Didn’t change the outcome at all from when I had “ALL” and stat = 1 for conditions. Then I realized that this could be explained if the logic system is just completely ignoring all but one condition, and my action is getting triggered by Species being equal to Robot, and the other conditions about the stats are getting ignored. In the case of “ANY” being used, the last condition in the list is what seemed to control the trigger, but in the case of “ALL” being used, the first condition in the list did it.
The thing about the above example that I just gave, is that that’s the part that broke even though I had already got it working prior. I had the whole Robot stat logic working perfectly, using the same rules I just described. But then I went on to create more rules for a different species category and that was when logic finally broke and unexpected behaviours began to occur (as if a bad artifact or some kind of monkey wrench made it into the code and got stuck there, hence my question about this being an issue of corruption), so I deleted all those rules to try to start fresh, and then found my robot stats to be broken even though they were working and I didn’t do anything to them. So I removed those rules to reapply them as well, and I could never get them to work again. It’s like logic isn’t logic anymore. But I’m wondering if maybe multiple conditions have become broken, and only one condition is getting used.
One more observation, is that one thing I commonly notice when logic just doesn’t seem to be working as I expect it to, is that the last rule I made that isn’t working will have its rule number highlighted in orange, but so will the rule above it. If I move my mouse up to hover over the rule above it, then just the same both rules remain highlighted. When I move my mouse up even further and hover over rules that are working correctly where logic seems to make sense, then only the rule I’m hovered over is highlighted, and none others. It seems to suggest to me that some of the rules I’m trying to make that don’t seem to be working, are being seen as related to the rule above in some way. Not sure if that’s representing some sort of rule-nesting behaviour, or what. But just an observation.
I apologize for writing at length about this, but I wasn’t really sure how to explain these problems in a useful way. I didn’t want to just say “conditional logic is broken, how can I fix it?” But I would like to know if I can resolve these strange issue or get some insight into what might be missing from my understanding of how this logic system works
- The topic ‘Unexpected Behavior with Conditional Logic’ is closed to new replies.