Alice Community  

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

Reply
 
Thread Tools Display Modes
How Do I DISABLE AN Event?
Old
lanceA
Guest
 
Status:
Posts: n/a
Default How Do I DISABLE AN Event? - 05-11-2008, 09:19 PM

Given this scenerio:
Person walks forward while up-arrow is pressed.

Now:
The person disappears and I no longer wish the up-arrow to trigger an event for the 'person'

How do I stop the event-listener from monitoring the up-arrow key-press?

I think I just solved it:
The up-arrow event calls a method such as MoveObj(Object obj). Then the code within the method does something like:

while Obj.isShowing == true
move the object.

Now, might I include within that method an if/else statement so that I can transfer the event handler to move a second or third object??? In otherwords, based upon some condition, I can force the event handler to control multiple objects?
if obj1 isShowing
...do this
else if obj2 isShowing
...do this
etc., etc.

A 2nd question, does Alice recognize the instanceOf command? And if so how do I invoke it?

Any speculation on why any of the above would not work?

Thanks.

Last edited by lanceA; 05-11-2008 at 09:43 PM. Reason: added question about instanceOf
   
Reply With Quote
Old
Lprsti99
Guest
 
Status:
Posts: n/a
Default 05-12-2008, 12:48 PM

Well, that would work, but a better method might be to use a parameter for the object, and make a world level object variable to determine which object to move, and change the variable when you want a different object to move.
   
Reply With Quote
Selectively controling event detection
Old
DrJim
Guest
 
Status:
Posts: n/a
Default Selectively controling event detection - 05-12-2008, 07:22 PM

Either method suggested should probably solve the problem as given in the scenario. Making a decision directly based on an object property does seem a bit more in keeping with an OOP philosophy.

However, in neither case is the actual functionality indicated in the title of the posting actually implemented. The event detector still remains enabled and performs it’s defined function when a key is pressed.

It would be nice to be able to actually offload the event manager by disabling it when a detection of an event just gives a null result. However, as far as I know, this is not possible in Alice. Can anyone else verify this or, preferably, suggest a method to actually selectively enable or disable event detection for specific events from within an executing program?
   
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 ©2022, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.