Skip to content

Triggered Events

MOARdV edited this page Sep 5, 2015 · 1 revision

Triggered Events

A Triggered event is an event that is automatically activated when a specified variable is within a particular range. Any Defined Variables may be used, although custom variables are better suited. The triggered event may be any of the stock events used in JSIActionGroupSwitch except intlights, dummy, and plugin. Alternatively, the triggered event may be any of the defined Action handlers using the syntax module:action (eg, JSIGimbal:GimbalLock).

Triggered events are defined in any config file at the root level as follows:

RPM_TRIGGERED_EVENT
{
   eventName = unlockGimbal
   variableName = ALTITUDE
   range = 50,150
   triggerEvent = JSIGimbal:GimbalLock
   triggerState = false
   //eventState = not needed for triggerState = false
   oneShot = true
}
  • eventName -- Required string. The name of the event. Place this name in the triggeredEvents list in a RasterPropMonitorComputer module definition.
  • variableName -- Required string. The name of one of the Defined variables that is used to trigger the event.
  • range -- Required. A comma-separated pair of numbers or defined variables. The event is triggered when the variable above is within the specified range.
  • triggerEvent -- Required string. The event that is triggered. This can be one of the stock events or a plugin event.
  • triggerState -- Required string. This value can be true, false, or toggle. This is the state that the triggered event is set to. Due to the nature of the stock events, I recommend the use of toggle.
  • eventState -- Required for plugin-triggered toggle events, otherwise ignored. When a plugin event is triggered, the plugin state query used for eventState controls what parameter is passed to the plugin event (for example, use JSIGimbal:GimbalLockState for the eventState when using JSIGimbal:GimbalLock as the triggerEvent and toggle for the triggerState).
  • oneShot -- Optional, defaults to false. A Boolean that indicates whether the event can be triggered more than once.

A triggered event works under the following circumstances:

  1. The trigger must be armed. In order to arm the trigger, the variable specified for the trigger must fall outside of its range. For instance, is an event is triggered by the landing gear being extended, then the landing gear must be retracted to arm the event.
  2. When the variable is in range, the event is triggered. It will trigger exactly once, and it must be reset (by being armed, as in step 1) before it will fire again. If oneShot is true, the event will not arm again (NOTE: there is a known issue that oneShot is not preserved, so switching to another vessel or exiting the game will reset the oneShot flag, allowing the event to fire again).