Alice Community  

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

Reply
 
Thread Tools Display Modes
Independent Object Control
Old
Kennebel
Guest
 
Status:
Posts: n/a
Default Independent Object Control - 07-29-2008, 01:54 PM

I am trying to control a helicopter blade through a custom property.

The entirety of my test: (also attached in a2w format)


When i run this (on windows, i'm at work on my lunch break), it crashes with a java error, complaining that -1 is not in the range of 0 to 2. (which of course it isn't, but i don't control that call)

If i _only_ change the while loop to true, or false (to make it not run) instead of looking at the boolean property RunMyProp, everything is fine. I was trying to learn how to control an independent action, and this was my first try.

Anyone that might be able to help?
Attached Files
File Type: a2w helo_test.a2w (427.3 KB, 57 views)
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 07-29-2008, 08:40 PM

Welcome to the (in)famous Alice "event while."

The basic problem with the event while is that - at least for practical purposes - the time at which it is actually evaluated is non-deterministic, but it does immediately end the execution of any methods it was calling.

In this case, helicopter.heli blade contains two infinite loops - and when the execution ends, the loop indicies are "out of range", stopping the program and giving an error.

The basic work-around is to move the while statements to specific methods where you can control when they are evaluated - as shown in the modified program attached.

Several other examples of the problem, work-arounds and more details are available on other postings in the forum.
Attached Files
File Type: a2w mod_helo_test.a2w (423.6 KB, 63 views)
   
Reply With Quote
Old
Kennebel
Guest
 
Status:
Posts: n/a
Default 07-30-2008, 07:31 AM

Excellent! Thank you very much. That seems like a reasonable work around, and certainly easy to implement.

Again, thank you.
   
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 ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.