Loop not looping

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited July 2015

    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

  • tintrantintran Member Posts: 453

    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.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @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

  • tintrantintran Member Posts: 453
    edited July 2015

    @tatiang said:
    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:

    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.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    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

  • egorgesegorges Member Posts: 21

    @tatiang said:
    I believe the problem with yours is that you are changing the scene before the loop completes.

    As the change scene is after the loop, I understood it should work.

  • egorgesegorges Member Posts: 21

    @tintran said:
    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.

    There are 2 attributes very similar: glb_idAssunto (text) and gob_NumAssunto (integer).

  • egorgesegorges Member Posts: 21

    @tatiang said:
    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.

    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.

    tried to delete game.glb_idAssunto and it said that attribute exists in the Do_it actor but I can't find it anywhere

    Also used on Log Debug

Sign In or Register to comment.