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:59] – jh | aircraft:tmd:events [2019/07/20 15:58] – [event_timeout] 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 24: | Line 26: | ||
* Events can trigger other events | * Events can trigger other events | ||
- | ==== DEV0 ==== | + | ===== Event Generation ===== |
- | The do-nothing placeholder is triggered with '' | + | ==== input_event ==== |
- | < | + | The input_event receives messages from the [[aircraft: |
+ | |||
+ | Depending on the qualifier of the message ('' | ||
+ | |||
+ | Adding the line ''< | ||
+ | |||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | <[input_event][Knob_Stepped][] | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
> | > | ||
</ | </ | ||
Line 50: | Line 80: | ||
</ | </ | ||
- | ==== input_event==== | + | ===== Event Value Manipulation ===== |
- | The input_event receives | + | When a button, key command or joystick button are pressed they all generate |
- | Depending on the qualifier of the message | + | When the message |
- | Adding | + | The value is therefor carried from one event object to the next most of the time and we still have access to the original |
+ | > 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 '' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
> | > | ||
- | | + | </code> |
- | <[string8][Input][Controls.Button]> | + | |
- | < | + | |
+ | ===== 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 ==== | ||
+ | |||
+ | The timeout is an object like a countdown, several things can be fired here: .Trigger, .Set, .Reset, .Pause, .Unpause | ||
+ | to start/ | ||
+ | |||
+ | '' | ||
+ | |||
+ | When the timer has reached zero the list of '' | ||
+ | |||
+ | > The event delay could theoretically restart itself causing a periodic check, but this should be avoided if possible as there are better ways to catch changes in a system state, e.g. the '' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== event_repeat ==== | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | > | ||
+ | </ | ||
+ | |||
+ | ==== event_swap ==== | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
> | > | ||
</ | </ |
aircraft/tmd/events.txt · Last modified: 2022/07/19 21:07 by jh