Alice Community  

Go Back   Alice Community > Alice 2 > Bugs and Troubleshooting

Reply
 
Thread Tools Display Modes
I think I found a bug!
Old
Ronie5ive
Guest
 
Status:
Posts: n/a
Default I think I found a bug! - 09-28-2010, 10: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??
   
Reply With Quote
Old
icemacsea
Guest
 
Status:
Posts: n/a
Default 09-28-2010, 11:11 AM

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.
   
Reply With Quote
Ok I got it now
Old
Ronie5ive
Guest
 
Status:
Posts: n/a
Default Ok I got it now - 09-28-2010, 11:53 AM

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.
   
Reply With Quote
Old
debussybunny563
Senior Member
 
debussybunny563's Avatar
 
Status: Offline
Posts: 852
Join Date: May 2010
Arrow 09-28-2010, 02: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.


Last edited by debussybunny563; 12-21-2012 at 12:00 AM.

|--------------------------------------------------------------------------------------------------|
|Link to weapons collection: http://www.alice.org/community/showthread.php?t=7368 |
|--------------------------------------------------------------------------------------------------|

I have been dead for quite some time now; not much hope for resurrection.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 09-28-2010, 04: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.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
Ronie5ive
Guest
 
Status:
Posts: n/a
Default 09-30-2010, 10: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.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 09-30-2010, 02: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*


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
That works for some but.....
Old
walls04
Guest
 
Status:
Posts: n/a
Default That works for some but..... - 10-25-2010, 08: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!
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.