Alice Community  

Go Back   Alice Community > General Discussion > Questions and Comments

Reply
 
Thread Tools Display Modes
Getting Loopy
Old
HoffmanFarmsTx
Junior Member
 
Status: Offline
Posts: 8
Join Date: Jun 2015
Default Getting Loopy - 06-22-2015, 08:38 PM

No lie! I got REAL loopy, in fact the first time I couldn't get out of the loop. I still can't figure out how to make the response not true and have something different happen and end the method with a definitive response like "Goodbye" or "Thanks for playing"
   
Reply With Quote
Old
CodeMan
Member
 
CodeMan's Avatar
 
Status: Offline
Posts: 36
Join Date: Aug 2013
Location: Northern Virginia
Default 06-23-2015, 06:48 AM

Quote:
Originally Posted by HoffmanFarmsTx View Post
No lie! I got REAL loopy, in fact the first time I couldn't get out of the loop. I still can't figure out how to make the response not true and have something different happen and end the method with a definitive response like "Goodbye" or "Thanks for playing"
If you need help just post the world and I take a look at it.


Im really RavenOfCode... shhhh....

Currently work on my first app :)
   
Reply With Quote
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default 06-23-2015, 08:16 AM

Often it simply requires the use of a single test.

Say, for instance, that you have a method with a single "while loop" that continues based on the value of a Boolean value. Then simply add an "If" that does whatever needs to be done until another condition is satisfied, and uses the "else" to set the Boolean variable to false.

While loop terminated
   
Reply With Quote
Old
shoff
Member
 
Status: Offline
Posts: 15
Join Date: Jun 2015
Default 06-23-2015, 08:25 AM

^^ Good advice.
   
Reply With Quote
Old
azgrimm
Junior Member
 
Status: Offline
Posts: 5
Join Date: Jun 2015
Default 06-23-2015, 07:35 PM

Using the Event System

While [variable] is true

Begin [method]
During [do nothing]
End [method2]

Begin will run your method 1 time when your condition becomes true
End will run a different method 1 time when the condition becomes false.

e.g.

While [objA] is within 5 meters of [objB] is true
Begin [objA] say hello
During: do nothing
End [objA] say Goodbye

in this simple loop when object is within 5 meters of each other the first will say hello, then if you move the objects apart the first will say goodbye.

alternatively if you want to run a method on loop while the condition is met, place it in the During slot
   
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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.