Loop exits but condition is still true
I have the following ...
Loop while All conditions are valid
then i check attribute checkValues is true
in the loop, i compare a number of attributes to one attribute. If any of them match that one main attribute I set checkValues to true. If no matches are found, then boolean checkValues is set to false.
I have log statements indicating the loop re-entered and ran a 2nd time but then exited out. The log statements also show the checkValues is still set to true (the last line in the log as well) and was never set to false, even though the loop exited.
It almost looks like it just stopped, got interrupted somehow, or just didn't complete until checkValues was set to false indicating the loop exiting properly.
I was wondering if I am missing something specific to GameSalad loops that might cause this or maybe something else I'm overlooking?
Thanks
Comments
Upload a test project so someone can take a look at it for you.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
OK, thanks for your time. I will work on figuring out how to do that ...
In the meantime, I would like to ask again if I may ...
Is there anything odd about loop behavior in GameSalad when comparing it to programming languages.
For instance, does the loop complete before events underneath it fire off?
Does the loop break out as soon as the condition is false or does it finish and try to loop around to evaluate the condition again?
Could a Change Attribute event inside the loop, placed below a different Change Attribute actually fire off before the one above it? Or does it strictly follow top down order?
Please add anything along these lines which might behave differently than C# or Java for example.
Thanks in advance if anyone takes time out, I appreciate it !
@Ellison, I have experienced various strange behaviours with the built-in GameSalad loops.
In my experience, yes. If you need to have a behaviour take place before another one, putting it first is not enough. You need to add a condition for the second behaviour to fire, or wrap it in an after 0 seconds timer (or a longer one if there's a reasonable amount of work to do).
It's extremely frustrating, as in my experience GameSalad will sometimes process things in one order and other times process them in another order. I would love a new group type to be added that says "Process these behaviours in a strictly linear order".
In short, GameSalad does NOT always follow a top-down order.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Wow, thanks for the heads up. I was not aware of this but noticed it was most likely happening this way based off of log statements. Alright then, I think I'm going to try a different approach to avoid a loop while also using your suggestions to insure processing things in order.