PDA

View Full Version : Getting Loopy


HoffmanFarmsTx
06-22-2015, 09: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"

CodeMan
06-23-2015, 07:48 AM
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.

MrMoke
06-23-2015, 09: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 :cool:

shoff
06-23-2015, 09:25 AM
^^ Good advice.

azgrimm
06-23-2015, 08: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