Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
How do i stop a method?
Old
rohan123444
Guest
 
Status:
Posts: n/a
Default How do i stop a method? - 12-14-2009, 07:04 PM

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.

HELP WOULD BE APPRECIATED.
   
Reply With Quote
Old
rockstar442
Guest
 
Status:
Posts: n/a
Default 12-14-2009, 07:11 PM

ok dude im confused with what you want post up your thing and ill help you out
   
Reply With Quote
Here is my program
Old
rohan123444
Guest
 
Status:
Posts: n/a
Default Here is my program - 12-14-2009, 07:16 PM

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.
Attached Files
File Type: a2w My program.a2w (469.4 KB, 23 views)
   
Reply With Quote
Old
rockstar442
Guest
 
Status:
Posts: n/a
Default 12-14-2009, 07:20 PM

ok give me a moment
   
Reply With Quote
Any luck with it?
Old
rohan123444
Guest
 
Status:
Posts: n/a
Default Any luck with it? - 12-14-2009, 07:44 PM

Any luck with solving the problem so far?
   
Reply With Quote
Old
rockstar442
Guest
 
Status:
Posts: n/a
Default 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
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 12-14-2009, 08:16 PM

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


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
rockstar442
Guest
 
Status:
Posts: n/a
Default 12-14-2009, 08:26 PM

dude do you get confused too????
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 12-14-2009, 08:29 PM

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.
Attached Files
File Type: a2w help.a2w (475.6 KB, 97 views)


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
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 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.


(')>
   
Reply With Quote
Reply

Tags
loop, stopping


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.