WHAT IS
3D RAD?
CLICK HERE
TO FIND OUT!


EventOnInput


This object starts/stops (or shows/hides) objects linked to it when a keypress, key-release or another specific input is detected. It can also perform the same actions when the mouse enters or leaves a specified screen area.

For example, you can use this object to interactively control pre-defined events like the animation of an opening door, and so on.

This object can itself be started and stopped by other event objects, allowing you to create chains and achieve articulated event management.

For more about event objects in general, please see this tutorial.


USAGE

Add the EventOnInput object to your project, link it to all objects you want to start/stop when an input is detected.

You link objects together in the Object List (left side of 3D Rad main screen), by selecting an object and then checking the other objects you want to link to it.

To configure the EventOnInput object, double-click it in the Object List to open the following property dialog:



Input Control

Use this combo box to specify what input control to use to trigger the action specified in the Relationships list (below).

Note that to change the available default controls and/or let users of your projects to assign any input device to the trigger, you must add the ConfingureControls object to the project.

Continuous

By default, the action is triggered only once, when the control is activated (eg key is pressed). It is triggered again only after the control is released and activated again.

If the Continuous option is checked instead, the actions are triggered repeatedly, until the control is released.

The Auto-repeat rate parameter specifies the number of times per second the action is triggered.

If the Toggle mode option is checked, the auto-repeat is activated when you press the key and de-activated when you press it again.

Mouse detection area

Coordinates of the upper-left and bottom-right corners of a rectangular screen area. The screen center is at 0,0. Left/right margins are at -16 and 16. Top/bottom margins are at 12 and -12.

The area can also be edited visually in the Virtual Editor by clicking and dragging the mouse (use right button to scale and right button with left Ctrl key to stretch).

The screen area is used for 'ON MOUSOVER' and 'ON MOUSEOFF' relationship types only. See Relationships section, below.

Relationships

This list defines how the EventOnInput object relates to the objects that are linked to it. The following relationship types are supported:

  • IGNORE. Do nothing. Typically used for linked objects that are starters for this EventOnInput object itself (in a chain of event objects for example).


  • START ON INPUT. Start the object when the input is detected (for example the specified key is pressed). Note that the target object must provide some 'startable' action.


  • STOP ON INPUT. Stop the object when the input is detected.


  • SWITCH ON INPUT. Switch the object (start if stopped and vice-versa) when the input is detected.


  • SHOW ON INPUT. Show the object when the input is detected.


  • HIDE ON INPUT. Hide the object when the input is detected.


  • S/H SWITCH ON INPUT. Switch the object (show if hidden and vice-versa) when the input is detected.


  • RESET ON INPUT. Re-initialize the object completely, to its default state, as defined in the project.


  • START ON RELEASE (and all other variants). Same as above, but triggering the actions when the input control is released.


  • START ON MOUSEOVER (and all other variants). Same as above, but triggering the actions when the mouse enters the specified mouse-detection area (see above).


  • START ON MOUSEOFF (and all other variants). Same as above, but triggering the actions when the mouse exits the specified mouse-detection area (see above).


  • START ON LMBUTTON (and all other variants). Same as above, but triggering the actions when the mouse is inside the specified mouse-detection area AND the left mouse button is clicked.


  • START ON LMBRELEASE (and all other variants). Same as above, but triggering the actions when the mouse is inside the specified mouse-detection area AND the left mouse button is released.


  • START ON RMBUTTON (and all other variants). Same as above, but triggering the actions when the mouse is inside the specified mouse-detection area AND the right mouse button is clicked.


  • START ON RMBRELEASE (and all other variants). Same as above, but triggering the actions when the mouse is inside the specified mouse-detection area AND the right mouse button is released.


  • Execute opposite action on release

    If this option is checked, the specified action is applied to the target on pressing the specified key (or activating the specified control), and the opposite action is applied to the target when the key (or control) is released.

    This feature can be used, for example, to start a looping sound when a key is pressed and stop the sound when the key is released.

    Note that this feature only works for objects that are marked, in the Relationships window, as ... ON INPUT (see above).

    Randomize target object

    If this option is checked, the specified action is applied to one target object only, picked randomly. If the option is not checked, the action is applied to all target objects instead.

    NOTE: this option is supported for 'ON INPUT' actions only (see Relationships section, above).

    Working at start

    If this option is not checked, the EventOnInput object will not work (no input detected) until it is started by using another event object.

    NETWORK

    In a multiplayer game, when the project is running on the server, EventOnInput objects that have the same Network ID as EventOnInput objects in a project which is running on a connected client PC, will trigger actions on the server, based on the remote user input.

    So, for example, if you have a tank battle game running on the server, and the EventOnInput objects that control movements for a tank are synchronized with EventOnInput objects in a project running on a client, the client PC user will be able to control the tank on the server.

    This feature, coupled with the ability to synchronize SkinMesh objects between server and client projects, allows you to create multiplayer games enjoying a productivity which isn't possible with classic game creation systems.

    Network ID. The Network ID can be any value between 1 and 65535. Setting the ID to zero will disable synchronization.

    Player number. This value specifies what connected PC will control the input for the EventOnInput object. The player number can be any value between 0 and 255, where 0 is always the server, 1 is the first client PC joining the game, 2 the second and so on.

    Note that when a PC is disconnected (when a player leaves), its slot becomes available again and it will be assigned to the next PC that may connect.

    It is up to the project developer to put mechanisms in place to only start a game when a certain number of players has been reached, or to disable (stop) EventOnInput objects when a player leaves. All the tools required to handle these situations are provided as iNet...() script functions.

    For more information about creating multiplayer projects with 3D Rad, please click here.



    For information about the remaining controls, please click here.



    INTERNAL PARAMETERS


    The current input value can be read and processed run-time by using value objects like EventOnValue or by using a Script

    For non-proportional input controls, like a keyboard or a joystick button, the input value is zero when the key or button is released and 1 when it is pressed.

    For proportional input controls, like a joystick, the input value is zero when the device is released and 1 when it is fully set (for example, when a stick is fully pushed or a steering wheel fully turned). Intermediate proportional device states (like a partially turned wheel) produce intermediate input values.