Event Handling

Keyboard:

Keyboard events are handled at the user level. The default action of the arrow keys (and joystick) is to move the user in the desired direction. The default action of the Enter key is to perform the current default command. If chat is enabled, users may type in messages to each other.

 

Mouse:

Mouse events are handled at the vector level. Those child objects of the vector with (mouse = yes) transmit mouse messages to their parent vector. Mouse events include Click, Dbl-click, Mouse-down, Mouse-up, and Mouse-move. Each mouse event is an interior event, or optionally a border event, of the low-level component.

 

Collision Detection:

A Collision Detection event is triggered when 2 low-level components collide, and both components are (collision = yes) and (visible = yes). Each collision event is an interior event, or optionally a border event, of each of the 2 low-level components.

 

Timer:

Timer events are triggered after every N frame changes, where N is a number greater than or equal to one. Treescript attempts to display 30 frames per second. If the user’s computer is too slow, then it skips frames.

 

Vector Events:

·      OnCreate

·      OnDestroy

·      OnShow – visible changes to yes

·      OnHide – visible changes to no

·      OnEnter – enters user’s field of view

·      OnExit – exits user’s field of view

·      OnStart – begins new trajectory, or velocity becomes non-zero

·      OnStop – ends old trajectory, or velocity becomes zero

·      OnReparent – new parent vector

·      OnAcquire – acquires new child vector/atom

·      OnLose – loses old child vector/atom

·      OnCollide – collision detected

·      OnClick

·      OnDblClick

·      OnMouseUp

·      OnMouseDown

·      OnMouseMove

·      OnKeyUp – user event

·      OnKeyDown – user event

·      OnKeyPress – user event