Alice Community

Alice Community (
-   How do I...? (
-   -   How do i stop a method? (

rohan123444 12-14-2009 07:04 PM

How do i stop a method?
How do I stop a method which uses an infinite loop. Basically what im doing is if the switch is up this method runs which uses an infinite loop to move two cars but what i need help on is stopping the method when the switch is turned to the off position. The problem is since the method uses an infinite loop the method never ends, therefore i cant stop it.


rockstar442 12-14-2009 07:11 PM

ok dude im confused with what you want post up your thing and ill help you out

rohan123444 12-14-2009 07:16 PM

Here is my program
1 Attachment(s)
I have a method that has an infinite loop. I want it it so when i flip a switch the method stops, but it doesn't seem to be working since there is in an infinite loop. You will see in my program.

rockstar442 12-14-2009 07:20 PM

ok give me a moment

rohan123444 12-14-2009 07:44 PM

Any luck with it?
Any luck with solving the problem so far?

rockstar442 12-14-2009 07:47 PM

sorry man no i havnt gotten it so far i dont get exactly what you did but im working on it till then keep trying

Dameria 12-14-2009 08:16 PM

I'll check into it, give me a moment to try it.

rockstar442 12-14-2009 08:26 PM

dude do you get confused too????

Dameria 12-14-2009 08:29 PM

1 Attachment(s)
Well I had to rush this because I have to go, but this is what I came up with so far, hope it helped. I made it while switch is not up (by the way you have the switch upside down) then it starts it, and when the switch is switched off, it stops the actions. It does not stop the actions mid move however, it has to wait until the method runs through, then it stops. So it stops the infinite loop, but only when the method finishes.

Tell me if this is what you were looking for please.

x2495iiii 12-14-2009 09:18 PM

If it isn't, you could add checks into the movement method to make it stop more quickly when the switch is flipped to off. I could show you how to do that.

All times are GMT -5. The time now is 07:05 PM.

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