View Full Version : I think I found a bug!

09-28-2010, 11:54 AM
I've been at Alice for hours trying to figure out why It will not execute any commands following the loop command. Is there any to get it to execute a loop command while executing the commands that follow the loop??

09-28-2010, 12:11 PM
Nope, sorry. Loops just keep going and going, so if you want to be able to stop one, you have to have a condition for stopping it (as in a While loop) or just do the loop for a finite number of repetitions.

This doesn't mean you can't have an infinite loop or one that runs a long time. You just have to design correctly for it. Don't call a method with a loop like that from the world's first method or you'll be stuck there. Drag some appropriate object over to the events area and create a "when the world starts" event, then you call your looping method from there.

09-28-2010, 12:53 PM
I didn't understand at first but what I did was insert a "While" statement in the world events on the top right side. I put the loop in the while statement like this:

While "true" is true
Begin: world.birdfly
During: Nothing
End: Nothing

The "While true is true" line doesn't make any sense to me but it works.

09-28-2010, 03:08 PM
Well, true is always going to be true, so it loops forever.

The intention was to have a variable in the <true> part of "While <true> is true," so that it will eventually terminate.

09-28-2010, 05:51 PM
Its not a bug so much as it is a human error. If you are talking about infinite loops, then you will never be able to have any code following an infinite loop. Just think about it, the codes go in order, so that when one code finishes, the next code starts. If you have an infinite loop, the loop will never end, therefore the next code will never start.

The way to go around this is to put the infinite loop and the next method you want in a "Do Together" box. This way, the infinite loop will run, and at the same time it will do the next thing you want it to do. Just remember though, you can never have a line of code following a loop unless it is within the loop or happening at the same time as the loop.

The reason the While statement worked is because you put it into the world Events bar on the top. All of the events run at the same time as the other events, so for example you can have the infinite loop running at the same time as the "When world starts, do (my first method)" event and all of your other events. The World Events is basically just another "Do Together" that has precedence before all of the other methods and that is constantly running in the program.

09-30-2010, 11:22 AM
Aaahaa!! Ok that's why it worked. I'll use the world events bar for now on. Usually in most programming languages, there is always a condition that follows the "While". That's what threw me off a little.

09-30-2010, 03:33 PM
Alright, just try to refrain from using the events panel to write your entire methods like some people have done in the past *cough* jediaction *cough*

10-25-2010, 09:08 AM
I'm trying to make fan blades switch speeds. Off, low, med, high. I've tried all the combinations that you mentioned here and a thousand others. Any more ideas? Once a button is clicked by the mouse it's stuck on forever!