| ● | Load |
| ● | SetVehicleSpecs |
| ● | Initialize |
| ● | SetPower |
| ● | SetBrake |
| ● | SetReverser |
| ● | SetSignal |
| ● | SetPower |
| ● | SetBrake |
| ● | SetReverser |
| ● | KeyDown |
| ● | KeyUp |
| ● | HornBlow |
| ● | DoorChange |
| ● | SetSignal |
| ● | SetBeacon |
| ● | PerformAI |
| ● | Unload |
| LoadProperties | properties | The properties supplied to the plugin on loading. |
| string | PluginFolder | Gets the absolute path to the plugin folder. |
| string | TrainFolder | Gets the absolute path to the train folder. |
| int[] | Panel | Gets or sets the array of panel variables. |
| PlaySoundDelegate | PlaySound | Gets the callback function for playing sounds. |
| AISupport | AISupport | The extent to which the plugin supports the AI. |
| string | FailureReason | Gets or sets the reason why the plugin failed loading. |
| AISupport.None | 0 | The plugin does not support the AI. Calls to PerformAI will not be made. Non-player trains will not use the plugin. |
| AISupport.Basic | 1 | The plugin complements the built-in AI by performing only functions specific to the plugin. |
| bool | Whether the plugin was loaded successfully. |
| VehicleSpecs | specs | The specifications of the train. |
| int | PowerNotches | Gets the number of power notches the train has. |
| BrakeTypes | BrakeType | Gets the type of brake the train uses. |
| int | BrakeNotches | Gets the number of brake notches the train has, including the hold brake, but excluding the emergency brake. |
| bool | HasHoldBrake | Gets whether the train has a hold brake. |
| int | AtsNotch | Gets the index of the brake notch that corresponds to B1 or LAP. |
| int | B67Notch | Gets the index of the brake notch that corresponds to 70% of the available brake notches. |
| int | Cars | Gets the number of cars the train has. |
| BrakeTypes.ElectromagneticStraightAirBrake | 0 | The train uses the electromagnetic straight air brake. |
| BrakeTypes.ElectricCommandBrake | 1 | The train uses the analog/digital electro-pneumatic air brake without a brake pipe (electric command brake). |
| BrakeTypes.AutomaticAirBrake | 2 | The train uses the automatic air brake with partial release. |
| InitializationModes | mode | The mode of initialization. |
| InitializationModes.OnService | -1 | The safety system should be enabled. The train has its service brakes applied. |
| InitializationModes.OnEmergency | 0 | The safety system should be enabled. The train has its emergency brakes applied. |
| InitializationModes.OffEmergency | 1 | The safety system should be disabled. The train has its emergency brakes applied. |
| ElapseData | data | The data passed to the plugin. |
| VehicleState | Vehicle | Gets the state of the train. |
| PrecedingVehicleState | PrecedingVehicle | Gets the state of the preceding train, or a null reference if there is no preceding train. |
| Handles | Handles | Gets or sets the virtual handles. |
| Time | TotalTime | Gets the absolute in-game time. |
| Time | ElapsedTime | Gets the time that elapsed since the last call to Elapse. |
| string | DebugMessage | Gets or sets the debug message the plugin wants the host application to display. |
| double | Location | Gets the location of the front of the train, in meters. |
| Speed | Speed | Gets the speed of the train. |
| double | BcPressure | Gets the pressure in the brake cylinder, in pascal. |
| double | MrPressure | Gets the pressure in the main reservoir, in pascal. |
| double | ErPressure | Gets the pressure in the equilizing reservoir, in pascal. |
| double | BpPressure | Gets the pressure in the brake pipe, in pascal. |
| double | SapPressure | Gets the pressure in the straight air pipe, in pascal. |
| double | Location | Gets the location of the back of the preceding train, in meters. |
| double | Distance | Gets the distance from the front of the current train to the back of the preceding train, in meters. |
| Speed | Speed | Gets the speed of the preceding train. |
| double | MetersPerSecond | Gets the speed in meters per second. |
| double | KilometersPerHour | Gets the speed in kilometers per hour. |
| double | MilesPerHour | Gets the speed in miles per hour. |
| double | Seconds | Gets the time in seconds. |
| double | Milliseconds | Gets the time in milliseconds. |
| int | Reverser | Gets or sets the reverser position. |
| int | PowerNotch | Gets or sets the power notch. |
| int | BrakeNotch | Gets or sets the brake notch. |
| bool | ConstSpeed | Gets or sets whether the const speed system is enabled. |
| int | reverser | The new reverser position. |
| int | powerNotch | The new power notch. |
| int | brakeNotch | The new brake notch. |
| VirtualKeys | key | The virtual key that was pressed. |
| VirtualKeys.S | 0 | The virtual S key. The default assignment is Space. |
| VirtualKeys.A1 | 1 | The virtual A1 key. The default assignment is Insert. |
| VirtualKeys.A2 | 2 | The virtual A2 key. The default assignment is Delete. |
| VirtualKeys.B1 | 3 | The virtual B1 key. The default assignment is Home. |
| VirtualKeys.B2 | 4 | The virtual B2 key. The default assignment is End. |
| VirtualKeys.C1 | 5 | The virtual C1 key. The default assignment is Page Up. |
| VirtualKeys.C2 | 6 | The virtual C2 key. The default assignment is Page Down. |
| VirtualKeys.D | 7 | The virtual D key. The default assignment is 2. |
| VirtualKeys.E | 8 | The virtual E key. The default assignment is 3. |
| VirtualKeys.F | 9 | The virtual F key. The default assignment is 4. |
| VirtualKeys.G | 10 | The virtual G key. The default assignment is 5. |
| VirtualKeys.H | 11 | The virtual H key. The default assignment is 6. |
| VirtualKeys.I | 12 | The virtual I key. The default assignment is 7. |
| VirtualKeys.J | 13 | The virtual J key. The default assignment is 8. |
| VirtualKeys.K | 14 | The virtual K key. The default assignment is 9. |
| VirtualKeys.L | 15 | The virtual L key. The default assignment is 0. |
| VirtualKeys | key | The virtual key that was released. |
| VirtualKeys.S | 0 | The virtual S key. The default assignment is Space. |
| VirtualKeys.A1 | 1 | The virtual A1 key. The default assignment is Insert. |
| VirtualKeys.A2 | 2 | The virtual A2 key. The default assignment is Delete. |
| VirtualKeys.B1 | 3 | The virtual B1 key. The default assignment is Home. |
| VirtualKeys.B2 | 4 | The virtual B2 key. The default assignment is End. |
| VirtualKeys.C1 | 5 | The virtual C1 key. The default assignment is Page Up. |
| VirtualKeys.C2 | 6 | The virtual C2 key. The default assignment is Page Down. |
| VirtualKeys.D | 7 | The virtual D key. The default assignment is 2. |
| VirtualKeys.E | 8 | The virtual E key. The default assignment is 3. |
| VirtualKeys.F | 9 | The virtual F key. The default assignment is 4. |
| VirtualKeys.G | 10 | The virtual G key. The default assignment is 5. |
| VirtualKeys.H | 11 | The virtual H key. The default assignment is 6. |
| VirtualKeys.I | 12 | The virtual I key. The default assignment is 7. |
| VirtualKeys.J | 13 | The virtual J key. The default assignment is 8. |
| VirtualKeys.K | 14 | The virtual K key. The default assignment is 9. |
| VirtualKeys.L | 15 | The virtual L key. The default assignment is 0. |
| HornTypes | type | The type of horn. |
| HornTypes.Primary | 0 | The primary horn. |
| HornTypes.Secondary | 1 | The secondary horn. |
| HornTypes.Music | 2 | The musical horn. |
| DoorStates | oldState | The old state of the doors. |
| DoorStates | newState | The new state of the doors. |
| DoorStates.None | 0 | No door is open. |
| DoorStates.Left | 1 | The left doors are open. |
| DoorStates.Right | 2 | The right doors are open. |
| DoorStates.Both | 3 | All doors are open. |
| SignalData[] | data | The signal data per section. |
| int | Aspect | Gets the aspect of the section. |
| double | Distance | Gets the distance to the section. |
| BeaconData | data | The beacon data. |
| int | Type | Gets the type of beacon. |
| int | Optional | Gets optional data the beacon transmits. |
| SignalData | Signal | Gets the section the beacon is attached to. |
| int | Aspect | Gets the aspect of the section. |
| double | Distance | Gets the distance to the section. |
| AIData | data | The AI data. |
| Handles | Handles | Gets or sets the driver handles. |
| AIResponse | Response | Gets or sets the AI response. |
| int | index | The index to the sound to be played. |
| double | volume | The initial volume of the sound. A value of 1.0 represents nominal volume. |
| double | pitch | The initial pitch of the sound. A value of 1.0 represents nominal pitch. |
| bool | looped | Whether the sound should be played in an indefinate loop. |
| SoundHandle | The handle to the sound, or a null reference if the sound could not be played. |
| bool | Playing | Gets whether the sound is still playing. Once this returns false, the sound handle is invalid. |
| bool | Stopped | Gets whether the sound has stopped. Once this returns true, the sound handle is invalid. |
| double | Volume | Gets or sets the volume. A value of 1.0 represents nominal volume. |
| double | Pitch | Gets or sets the pitch. A value of 1.0 represents nominal pitch. |
| void | Stop() | Stops the sound and invalidates the handle. |
| AIData | data | The AI data. |
| Handles | Handles | Gets or sets the driver handles. |
| AIResponse | Response | Gets or sets the AI response. |
| int | Reverser | Gets or sets the reverser position. |
| int | PowerNotch | Gets or sets the power notch. |
| int | BrakeNotch | Gets or sets the brake notch. |
| bool | ConstSpeed | Gets or sets whether the const speed system is enabled. |
| AIResponse.None | No action was performed by the plugin. |
| AIResponse.Short | The action performed took a short time. |
| AIResponse.Medium | The action performed took an average amount of time. |
| AIResponse.Long | The action performed took a long time. |
| ▶ |
if (AtsAlarm) { /* The driver needs to cut power and apply the brakes, * then press the virtual S key.*/ if (data.Handles.PowerNotch > 0) { /* We change only by one notch at a time. */ data.Handles.PowerNotch -= 1; data.Response = AIResponse.Short; } else if (data.Handles.BrakeNotch < 2) { /* We change only by one notch at a time. */ data.Handles.BrakeNotch += 1; data.Response = AIResponse.Short; } else { /* We simulate a key press here. */ KeyDown(VirtualKeys.S); data.Response = AIResponse.Medium; } } else if (AtoActive) { /* Our ATO does not require driver interaction, so * let's prevent the built-in AI from doing anything. */ data.Response = AIResponse.Long; } else { /* Let the host application perform a default action * such as braking for signals or stations. */ data.Response = AIResponse.None; } |