Problems with LOOP
ookami007
Member Posts: 581
I'm trying to cycle from 1 to 30 and reset level lock.
I set game.tempInt to 2
Then I loop while (all) attribute game.tempInt <= 30
I have my commands in the loop, including a change attribute game.tempInt = game.tempInt+1
Among the commands is a log statement (the first statement in the loop). It never gets executed.
Am I setting up the loop behavior correctly?
I've also tried loop until tempInt > 30 and that doesn't work either.
Using Mac 13.8.0
Comments
Can you post a screenshot of your Loop behavior?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Let's see if this works...
How are you keeping track of your WhichOne attribute?
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
That's set at the top and doesn't change. When I run the change table value outside of the loop, it works.
So you can click manually and have it do what you want, but it just won't work when you try to do the loop?
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
That is correct.
Have you tried clicking more than once, to see if it will do what you want all the way to the end?
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
The loop doesn't seem to be kicking off at all. Even with a log statement as the firs thing in the loop I don't see it kicking off.
At the end of the click event, it changes scenes.
Are there any other behaviors in your actor besides the ones shown in the screenshot?
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
Tons... and they are all working. Basically, I resetting all the player stats (there's a lot). All are working except the loop.
Ok, try making a new actor and tell it, when touch is pressed do loop.
This may help you isolate the problem and rule out any other conflicting behaviors.
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
You'd think it would run at least once.
So you put the loop in its own actor and it doesn't run at all?
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
A couple things about your rules:
Here's a demo where I tried to match your rules. It logs each iteration of the loop. Maybe you can determine what's different when compared to your file.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
So what if I spawn another actor with the loop behavior in it. Will it run all the way through at that point?
I'll play around with the Loop Over Table, but I'm not up on how it works.
Yes, assuming the Loop behavior is not inside of a rule (or is inside of a rule that doesn't get interrupted).
@Braydon_SFX has some great table tutorial videos in this thread: http://forums.gamesalad.com/discussion/comment/442821//p1. You might check out this video: http://forums.gamesalad.com/discussion/comment/442821/#Comment_442821. I'm not sure if he used Loop Over Table, though.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User