![]() |
Error during simulation.
Right now, I am working on a project for my programming class. We have to use events with functions to make somehting happen, if something else is true. Everything was going fine, but then when my dog gets near the bird, the error comes up. Here is the error:
[code]Error during simulation. Alice version: 2.0 04/05/2005 os.name: Windows XP os.version: 5.2 os.arch: x86 java.vm.name: Java HotSpot(TM) Client VM java.vm.version: 1.3.1_10-b03 user.dir: D:\Program Files\Alice\Required Throwable that caused the error: java.lang.ArrayIndexOutOfBoundsException: -1 not in range [0,3) at edu.cmu.cs.stage3.alice.core.Behavior$Fork.getNext(Behavior.java:113) at edu.cmu.cs.stage3.alice.core.Behavior$RuntimeStack.top(Behavior.java:55) at edu.cmu.cs.stage3.alice.core.Behavior$RuntimeStack.push(Behavior.java:43) at edu.cmu.cs.stage3.alice.core.Behavior.pushStack(Behavior.java:352) at edu.cmu.cs.stage3.alice.core.question.userdefined.CallToUserDefinedQuestion.getValue(CallToUserDefinedQuestion.java:53) at edu.cmu.cs.stage3.alice.core.behavior.ConditionalTriggerBehavior.internalSchedule(ConditionalTriggerBehavior.java:38) at edu.cmu.cs.stage3.alice.core.Behavior.schedule(Behavior.java:225) at edu.cmu.cs.stage3.alice.core.Sandbox.scheduleBehaviors(Sandbox.java:70) at edu.cmu.cs.stage3.alice.core.World.scheduleBehaviors(World.java:444) at edu.cmu.cs.stage3.alice.core.World.schedule(World.java:486) at edu.cmu.cs.stage3.alice.core.clock.DefaultClock.schedule(DefaultClock.java:94) at edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool$11.run(AuthoringTool.java:681) at edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler.simulateOnce(DefaultScheduler.java:115) at edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler.run(DefaultScheduler.java:76) at edu.cmu.cs.stage3.scheduler.AbstractScheduler.run(AbstractScheduler.java:45) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.Dialog.show(Unknown Source) at edu.cmu.cs.stage3.swing.DialogManager.showModalDialog(DialogManager.java:58) at edu.cmu.cs.stage3.swing.DialogManager.showDialog(DialogManager.java:123) at edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool.play(AuthoringTool.java:5073) at edu.cmu.cs.stage3.alice.authoringtool.Actions$15.actionPerformed(Actions.java:167) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) [/code] right now, it is programmed to do this: If the dog gets within 1 meter of the bird, the dog will jump up and the bird will move upward, then they each return to their original positions. If I take everythign out of the method that is called, and just leave in "dog say hi," then it works. Hope you understand what I mean. if you need me to post my code or something, I can, just let me know. Thanks! |
It would be great if you could post a copy of your world for us to take a look at. Then we can determine if it's a bug with the software or with your code.
|
Help on Error During Simulation
2 Attachment(s)
Hi,
i just created an simple alice world with controls to move a bikerkid object with the a chase cam feature. However, when i start to run the simulation and hold down "w" for a few seconds to move the the bikerkid forward and release "w" key, an error occurs saying "Error during simulation". (some ArrayIndexOutOfBoundsException) Error message as follow: Error during simulation. Alice version: 2.0 04/05/2005 os.name: Windows XP os.version: 5.1 os.arch: x86 java.vm.name: Java HotSpot(TM) Client VM java.vm.version: 1.3.1_10-b03 user.dir: D:\My NTU\FYP\ALICE\Prog\Alice 2.0\Required Throwable that caused the error: java.lang.ArrayIndexOutOfBoundsException: -1 not in range [0,2) at edu.cmu.cs.stage3.alice.core.Behavior$Fork.getNext(Behavior.java:113) at edu.cmu.cs.stage3.alice.core.Behavior$RuntimeStack.top(Behavior.java:55) at edu.cmu.cs.stage3.alice.core.Behavior$RuntimeStack.pop(Behavior.java:48) at edu.cmu.cs.stage3.alice.core.Behavior.closeFork(Behavior.java:176) at edu.cmu.cs.stage3.alice.core.response.DoTogether$RuntimeDoTogether.epilogue(DoTogether.java:85) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.childrenEpiloguesIfNecessary(CompositeResponse.java:67) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.epilogue(CompositeResponse.java:73) at edu.cmu.cs.stage3.alice.core.response.CallToUserDefinedResponse$RuntimeCallToUserDefinedResponse.epilogue(CallToUserDefinedResponse.java:94) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.childrenEpiloguesIfNecessary(CompositeResponse.java:67) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.epilogue(CompositeResponse.java:73) at edu.cmu.cs.stage3.alice.core.response.DoTogether$RuntimeDoTogether.epilogue(DoTogether.java:81) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.childrenEpiloguesIfNecessary(CompositeResponse.java:67) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.epilogue(CompositeResponse.java:73) at edu.cmu.cs.stage3.alice.core.response.CallToUserDefinedResponse$RuntimeCallToUserDefinedResponse.epilogue(CallToUserDefinedResponse.java:94) at edu.cmu.cs.stage3.alice.core.behavior.AbstractConditionalBehavior.internalSchedule(AbstractConditionalBehavior.java:112) at edu.cmu.cs.stage3.alice.core.Behavior.schedule(Behavior.java:225) at edu.cmu.cs.stage3.alice.core.Sandbox.scheduleBehaviors(Sandbox.java:70) at edu.cmu.cs.stage3.alice.core.World.scheduleBehaviors(World.java:444) at edu.cmu.cs.stage3.alice.core.World.schedule(World.java:486) at edu.cmu.cs.stage3.alice.core.clock.DefaultClock.schedule(DefaultClock.java:94) at edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool$11.run(AuthoringTool.java:681) at edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler.simulateOnce(DefaultScheduler.java:115) at edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler.run(DefaultScheduler.java:76) at edu.cmu.cs.stage3.scheduler.AbstractScheduler.run(AbstractScheduler.java:45) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.Dialog.show(Unknown Source) at edu.cmu.cs.stage3.swing.DialogManager.showModalDialog(DialogManager.java:58) at edu.cmu.cs.stage3.swing.DialogManager.showDialog(DialogManager.java:123) at edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool.play(AuthoringTool.java:5073) at edu.cmu.cs.stage3.alice.authoringtool.Actions$15.actionPerformed(Actions.java:167) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Attached: Test.a2w and capture00.jpg Need help badly pls ... any help will be much appreciated Thanx in advance |
1 Attachment(s)
Btw the above error doesn't occur when i remove Biker Movement Method.
Biker Movement Method basically makes the biker legs paddle the bike when he moves (using a do together tag) attached is the code |
event error when using a method call inside a method
1 Attachment(s)
[B]Yeah, I have been having the same issues and seems like there isn't a workaround, I have have spent [U]alot[/U] of time and tried everything, starting to believe it's a BUG! I am not creating hardly any code in the attatched program, using objects with already created methods.[/B]:mad:
Error during simulation. Alice version: 2.2 8/1/2009 Throwable that caused the error: java.lang.NullPointerException at edu.cmu.cs.stage3.alice.core.Behavior$RuntimeStack.pop(Behavior.java:49) at edu.cmu.cs.stage3.alice.core.Behavior.popStack(Behavior.java:360) at edu.cmu.cs.stage3.alice.core.response.CallToUserDefinedResponse$RuntimeCallToUserDefinedResponse.epilogue(CallToUserDefinedResponse.java:95) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.childrenEpiloguesIfNecessary(CompositeResponse.java:67) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.epilogue(CompositeResponse.java:73) at edu.cmu.cs.stage3.alice.core.response.DoTogether$RuntimeDoTogether.epilogue(DoTogether.java:81) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.childrenEpiloguesIfNecessary(CompositeResponse.java:67) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.epilogue(CompositeResponse.java:73) at edu.cmu.cs.stage3.alice.core.response.LoopNInOrder$RuntimeLoopNInOrder.epilogue(LoopNInOrder.java:99) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.childrenEpiloguesIfNecessary(CompositeResponse.java:67) at edu.cmu.cs.stage3.alice.core.response.CompositeResponse$RuntimeCompositeResponse.epilogue(CompositeResponse.java:73) at edu.cmu.cs.stage3.alice.core.response.CallToUserDefinedResponse$RuntimeCallToUserDefinedResponse.epilogue(CallToUserDefinedResponse.java:94) at edu.cmu.cs.stage3.alice.core.behavior.AbstractConditionalBehavior.internalSchedule(AbstractConditionalBehavior.java:112) at edu.cmu.cs.stage3.alice.core.behavior.ConditionalBehavior.internalSchedule(ConditionalBehavior.java:39) at edu.cmu.cs.stage3.alice.core.Behavior.schedule(Behavior.java:226) at edu.cmu.cs.stage3.alice.core.Sandbox.scheduleBehaviors(Sandbox.java:70) at edu.cmu.cs.stage3.alice.core.World.scheduleBehaviors(World.java:444) at edu.cmu.cs.stage3.alice.core.World.schedule(World.java:486) at edu.cmu.cs.stage3.alice.core.clock.DefaultClock.schedule(DefaultClock.java:99) at edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool$7.run(AuthoringTool.java:704) at edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler.simulateOnce(DefaultScheduler.java:115) at edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler.run(DefaultScheduler.java:76) at edu.cmu.cs.stage3.scheduler.AbstractScheduler.run(AbstractScheduler.java:45) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.Dialog$1.run(Unknown Source) at java.awt.Dialog$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Dialog.show(Unknown Source) at java.awt.Component.show(Unknown Source) at java.awt.Component.setVisible(Unknown Source) at edu.cmu.cs.stage3.swing.DialogManager.showModalDialog(DialogManager.java:58) at edu.cmu.cs.stage3.swing.DialogManager.showDialog(DialogManager.java:126) at edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool.play(AuthoringTool.java:5091) at edu.cmu.cs.stage3.alice.authoringtool.Actions$16.actionPerformed(Actions.java:175) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) |
1 Attachment(s)
It is a bug, but there's also a workaround.
I went ahead and fixed it for you. |
event error when using a method call inside a method
1 Attachment(s)
I'm also getting this error when I make a cowboy walk as I press the direction keys. If I take the walk method out the error goes away but the cowboy looks lame moving around all stiff. What is the work around you used? I'll attach the file for my world. Don't mind the horse that gallops for infinity and gets nowhere, that's just an animation/method test.
|
It has to do with events being terminated as they're happening. Instead of putting the movement right in the while key is pressed event, make a Boolean variables become true when you press, and false when you depress. Now, make a method on world start. Inside and infinite loop, put while the variable is true, and then put your method in there. This is a workaround for many event/while related errors. This especially helps when using poses. Note that for the indirect example, if the first event is simply reading a variable, you can eliminate it and use the while/loop function directly.
Using one event: [IMG]http://alice.org/community/picture.php?albumid=61&pictureid=323[/IMG] Using two events: [IMG]http://alice.org/community/picture.php?albumid=61&pictureid=325[/IMG] |
Thanks
Thanks a lot that helped me fix two worlds.
|
Two fewer wrlds for the community to fix. ;)
We fix a ton of worlds all the time. |
All times are GMT -5. The time now is 03:55 AM. |
Copyright ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.