aircraft:tmd:events
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
aircraft:tmd:events [2019/07/12 21:49] – [Events Inside The TMD] jh | aircraft:tmd:events [2019/07/20 15:52] – [Variables] jh | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Events Inside The TMD ====== | ====== Events Inside The TMD ====== | ||
+ | |||
+ | ===== Introduction ===== | ||
A very powerful tool in Aerofly FS 2 aircraft programming in the [[aircraft: | A very powerful tool in Aerofly FS 2 aircraft programming in the [[aircraft: | ||
- | Events are usually only triggered every once in a while and are certainly not intended for constant state logic. Inherently the event logic is state-less. Events cannot replace an underlying [[aircraft: | + | Events are usually only triggered every once in a while and are certainly not intended for constant state logic. Inherently the event logic is state-less. Events cannot replace an underlying [[aircraft: |
- | > None of the event objects have an '' | + | > None of the event objects have an '' |
**So what are events then?** | **So what are events then?** | ||
Line 22: | Line 24: | ||
* input_event - A button press triggers an event. | * input_event - A button press triggers an event. | ||
* event_edge - A system change is detected, e.g. in the q400 the system senses that the power levers are advanced for takeoff and then sets the spoiler switch to flight mode automatically. This is also used for many lever sounds. | * event_edge - A system change is detected, e.g. in the q400 the system senses that the power levers are advanced for takeoff and then sets the spoiler switch to flight mode automatically. This is also used for many lever sounds. | ||
- | * Events trigger other events | + | * Events |
- | ==== DEV0 ==== | + | ===== Event Generation ===== |
- | The do-nothing placeholder is triggered whenever no action is desired. | + | ==== input_event ==== |
- | < | + | The input_event receives messages from the [[aircraft: |
+ | |||
+ | Depending on the qualifier of the message ('' | ||
+ | |||
+ | Adding the line ''< | ||
+ | |||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | <[input_event][Knob_Stepped][] | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
> | > | ||
</ | </ | ||
==== event_edge ==== | ==== event_edge ==== | ||
+ | |||
+ | The event_edge object constantly monitors the input. When the input passes through the '' | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | |||
< | < | ||
Line 41: | Line 77: | ||
< | < | ||
< | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ===== Event Value Manipulation ===== | ||
+ | |||
+ | When a button, key command or joystick button are pressed they all generate messages and these messages carry a certain value. Most of them are 1.0, some are -1.0 (e.g. when rotated in the other direction) but other values can also exist. In the [[aircraft: | ||
+ | |||
+ | When the message is received by an '' | ||
+ | |||
+ | The value is therefor carried from one event object to the next most of the time and we still have access to the original value way down the event chain. | ||
+ | |||
+ | > When a '' | ||
+ | |||
+ | ==== event_linear ==== | ||
+ | |||
+ | The event_linear changes the value carried by the event and then triggers a list of '' | ||
+ | The new value is simply: '' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== event_value ==== | ||
+ | |||
+ | The event_value overwrites the value carried by the event chain and uses the value from the '' | ||
+ | |||
+ | This is used to set a '' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Event Logic ===== | ||
+ | |||
+ | Depending on the value carried by the event or other values read in decisions can be made and whole decision trees can be set-up. | ||
+ | |||
+ | ==== event_sequence ==== | ||
+ | |||
+ | Creates a chain of events that are executed one after another. This allows objects like the autopilot, that only trigger a single '' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== event_demultiplexer ==== | ||
+ | |||
+ | This is like a switch case with discrete input taken from the tmd. | ||
+ | |||
+ | The '' | ||
+ | |||
+ | > If InputSelect == 0.0 -> trigger event at index 0 (first in the list), if InputSelect == 1.0 -> trigger event at index 1 (triggers second in the list), etc. | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== event_select ==== | ||
+ | |||
+ | This is like a switch case with discrete input taken from the value of the event itself. | ||
+ | |||
+ | When triggered the event_select checks the value of the event call and casts it into an integer. Depending on the integer it selects one of the events from the '' | ||
+ | |||
+ | This is useful to have when there is a row of buttons, e.g. like a bezel select on an multifunction display and there is only one message name to be used. With an input_event you can receive that message and then call this event_select to do something specific based on the value of the original button message. | ||
+ | |||
+ | > Similar logic can be achieved with the '' | ||
+ | |||
+ | > When you are not interested in the value carried with the event then use the '' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | DoSomethingIfValueIs1.Trigger | ||
+ | DoSomethingIfValueIs2.Trigger ]> | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== event_range ==== | ||
+ | |||
+ | When the event_range is triggered it checks the value of the event call against the range and triggers either the list of events when inside ('' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Event Functions ===== | ||
+ | |||
+ | The following objects allow for different outcomes of a triggered event. | ||
+ | After the execution of a chain of events usually either nothing happens, one or more value are changed or a pulse or timer is triggerd. | ||
+ | |||
+ | ==== DEV0 ==== | ||
+ | |||
+ | The do-nothing placeholder is triggered with '' | ||
+ | |||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== Variables ==== | ||
+ | |||
+ | The variable class isn't an event class as such, it cannot trigger any further events. But events can manipulate the value of a '' | ||
+ | |||
+ | Available functions are: | ||
+ | * Variable.Set - Changes the value of the variable to the value carried by the event (Value = event_value) | ||
+ | * Variable.Step - The value is increased or decreased by the value carried by the event (Value += event_value) | ||
+ | * Variable.Reset - The value is set to 0.0 (Value = 0.0) | ||
+ | |||
+ | > Events are not limited to the variable class. Many, in fact almost all of the [[aircraft: | ||
+ | |||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | The value of the variable is available to other tmd objects as '' | ||
+ | |||
+ | |||
+ | ==== event_sound ==== | ||
+ | |||
+ | Normally an event_sound object is used to generate a switch or button sound. Using the trigger function (in this case SwitchSound.Trigger) causes the event_sound to briefly output 1.0 to the sound section of the [[aircraft: | ||
+ | |||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== event_pulse ==== | ||
+ | |||
+ | When the pulse is triggered (function '' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== event_timeout ==== | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== event_repeat ==== | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== event_swap ==== | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
> | > | ||
</ | </ |
aircraft/tmd/events.txt · Last modified: 2022/07/19 21:07 by jh