Loop not looping
egorges
Member Posts: 21
Hello developers,
I am having an unexpected problem with Loop to copy part of a table to another one.
The code looks like:
Num = 0
Loop while Num < 3
..Num = Num + 1
..other rules
But everything runs only once, not 3 times.
I created the attached demo to show the problem.
Thanks in advance for any clues.
Comments
I have a demo that does this: https://forums.gamesalad.com/discussion/comment/518535/#Comment_518535. You might compare my rules to yours and see what's different.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I believe the problem with yours is that you are changing the scene before the loop completes.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
your logic seems wrong, the loop is inside an if glb_idAssunto > 0
but glb_idAssunto is of type text.
I am not sure if your loop is executing at all.
@tintran where are you seeing that? The only loop I found was this one in the Do_it actor which uses integers for both attributes in the loop condition:
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
All that loop is inside a big outer if. if you shrink down the rule, the loop is shrunk down along with that too.
The loop is like the 4th element inside a do part of the big outer if.
But the screenshot you posted doesn't contain game.glb_idAssunto except in a Log Debugging Statement. It contains game.glb_NumAssunto, which is an integer. Then again, maybe I'm missing something because I deleted everything except the rule condition and loop behavior and tried to delete game.glb_idAssunto and it said that attribute exists in the Do_it actor but I can't find it anywhere... strange.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
As the change scene is after the loop, I understood it should work.
There are 2 attributes very similar: glb_idAssunto (text) and gob_NumAssunto (integer).
I took a look on it and will modify my program properly.
Thank you, guys!
But still don't know why the loop runs only once.
Also used on Log Debug