Difference between revisions of "Programming Guide/Action List"
(→Camera) |
m (→Terminal Action and Property List) |
||
(22 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{tocright}} | {{tocright}} | ||
− | == Action List == | + | {{Under Construction}} |
+ | |||
+ | In addition to interface methods and properties given in the interface API, the in-game programming also provides '''terminal actions''' and '''terminal properties'''. Those terminal actions and properties behave like the options in the terminal system ingame that players can interact with. | ||
+ | |||
+ | Notice that terminal actions and properties should be obsolete, because the most block interfaces now provide API methods and properties that users can invoke. | ||
+ | |||
+ | == Invoking Terminal Actions and Properties == | ||
+ | |||
+ | The In-game Programming system provides methods for users to invoke the terminal properties, with a string parameter determining the name of the terminal action or property needed. Those methods belong to the IMyTerminalBlock interface. While all terminal blocks (Reactor, for example) are the sub-types of IMyTerminalBlock, they all have the methods. However, if the string parameter asks for the terminal action or property which does not exist in the given block, a '''NullReferenceException''' will be thrown<ref>https://github.com/malware-dev/MDK-SE/wiki/Terminal-Properties-and-Actions</ref>. | ||
+ | |||
+ | In the programming namespace, the terminal actions are accessed as '''ITerminalAction''' interface and the terminal properties are '''ITerminalProperty'''. | ||
+ | |||
+ | === Terminal Actions === | ||
+ | |||
+ | To make the block apply action, call | ||
+ | |||
+ | block.ApplyAction(string actionName) | ||
+ | |||
+ | For example: | ||
+ | |||
+ | // Turn off a light | ||
+ | IMyInterior light; | ||
+ | // codes that you assign the actual light you want to turn off. | ||
+ | light.ApplyAction("OnOff_Off"); // turn off the light | ||
+ | |||
+ | === Terminal Properties === | ||
+ | |||
+ | To access the terminal properties, two methods are provided. Unlike the action method above, those property methods are generic, which means a extra type parameter is needed when calling the methods. | ||
+ | |||
+ | To get a property of a block, call | ||
+ | |||
+ | block.GetValue<T>(string propertyName) | ||
+ | |||
+ | For example: | ||
+ | |||
+ | // Get the color of a light | ||
+ | IMyInteriorLight light; | ||
+ | // codes that you assign the actual light you want to get color from. | ||
+ | Color color = light.GetValue<Color>("Color"); // get color | ||
+ | |||
+ | To set a property of a block, call | ||
+ | |||
+ | block.SetValue<T>(string propertyName, T property) | ||
+ | |||
+ | For example: | ||
+ | |||
+ | // Set the color of a light | ||
+ | Color color = new Color(50, 100, 200); // create a new color | ||
+ | IMyInteriorLight light; | ||
+ | // codes that you assign the actual light you want to set color | ||
+ | light.SetValue<Color>("Color", color); // set color | ||
+ | |||
+ | == Terminal Action List (Old) == | ||
All terminal blocks have the following properties: | All terminal blocks have the following properties: | ||
− | Interface name: this name is the name of the block in code, it can differ from the name as displayed in the building screen. E.g. Antenna interface name is IMyRadioAntenna - you need to use this interface if you want to get all antennas. | + | |
+ | '''Interface name:''' this name is the name of the block in code, it can differ from the name as displayed in the building screen. E.g. Antenna interface name is IMyRadioAntenna - you need to use this interface if you want to get all antennas. | ||
'''Parent:''' this is parent of the block (all blocks have IMyTerminalBlock as parent), this can be used for getting type of blocks instead of concrete block type. E.g. if you want to get all lights in grid you will use IMyLightingBlock, if you want only interior light you can use IMyInteriorLight. | '''Parent:''' this is parent of the block (all blocks have IMyTerminalBlock as parent), this can be used for getting type of blocks instead of concrete block type. E.g. if you want to get all lights in grid you will use IMyLightingBlock, if you want only interior light you can use IMyInteriorLight. | ||
Line 9: | Line 62: | ||
'''Field:''' this is read only field available for block e.g. for IMyBeacon you can get Radius property. Based on this property you can increase/decrease radius of beacon. | '''Field:''' this is read only field available for block e.g. for IMyBeacon you can get Radius property. Based on this property you can increase/decrease radius of beacon. | ||
− | '''Actions:''' these are all available actions for block with their names in game, so if you want to increase broadcast radius for antenna, you need to execute | + | '''Actions:''' these are all available actions for block with their names in game, so if you want to increase broadcast radius for antenna, you need to execute IncreaseRadius action for block. |
{| class="wikitable" style="text-align: center;" | {| class="wikitable" style="text-align: center;" | ||
Line 21: | Line 74: | ||
bool CanPressurize { get; }<br /> | bool CanPressurize { get; }<br /> | ||
bool Depressurize { get; set; }<br /> | bool Depressurize { get; set; }<br /> | ||
− | bool IsDepressurizing { get; }<br /> | + | bool IsDepressurizing { get; } <b>Depreciated</b> <br /> |
bool PressurizationEnabled { get; }<br /> | bool PressurizationEnabled { get; }<br /> | ||
− | VentStatus Status { get; }<br /> | + | enum VentStatus Status { get; }<br /> |
'''Actions:'''<br /> | '''Actions:'''<br /> | ||
Line 91: | Line 144: | ||
IncreaseRadius -> Increase Broadcast radius<br /> | IncreaseRadius -> Increase Broadcast radius<br /> | ||
DecreaseRadius -> Decrease Broadcast radius<br /> | DecreaseRadius -> Decrease Broadcast radius<br /> | ||
+ | EnableBroadCast -> Toggle Broadcast On/Off<br /> | ||
+ | ShowShipName -> Toggle Showing Ship Name <br /> | ||
+ | |||
|- style="vertical-align:top;" | |- style="vertical-align:top;" | ||
Line 177: | Line 233: | ||
'''Actions:'''<br /> | '''Actions:'''<br /> | ||
− | + | OnOff -> Toggle block On/Off<br /> | |
− | + | OnOff_On -> Toggle block On<br /> | |
− | + | OnOff_Off -> Toggle block Off<br /> | |
− | |||
− | |||
| | | | ||
Line 476: | Line 530: | ||
'''Parent:''' IMyFunctionalBlock<br /> | '''Parent:''' IMyFunctionalBlock<br /> | ||
'''Fields:''' <br /> | '''Fields:''' <br /> | ||
− | float | + | float BlinkIntervalSeconds { get; set; }<br /> |
− | float | + | float BlinkLength { get; set; }<br /> |
− | float | + | float BlinkOffset { get; set; }<br /> |
− | float | + | Color Color { get; set; }<br /> |
− | float | + | float Falloff { get; set; }<br /> |
+ | float Intensity { get; set; }<br /> | ||
+ | float Radius { get; set; }<br /> | ||
'''Actions:'''<br /> | '''Actions:'''<br /> | ||
Line 816: | Line 872: | ||
IncreaseWeld speed -> Increase Safety lock speed<br /> | IncreaseWeld speed -> Increase Safety lock speed<br /> | ||
DecreaseWeld speed -> Decrease Safety lock speed<br /> | DecreaseWeld speed -> Decrease Safety lock speed<br /> | ||
+ | IncreaseMaxImpulseAxis<br /> | ||
+ | DecreaseMaxImpulseAxis<br /> | ||
+ | IncreaseMaxImpulseNonAxis<br /> | ||
+ | DecreaseMaxImpulseNonAxis<br /> | ||
Force weld -> Safety override lock On/Off<br /> | Force weld -> Safety override lock On/Off<br /> | ||
− | + | Force weld<br /> | |
+ | IncreaseSafetyDetach<br /> | ||
+ | DecreaseSafetyDetach<br /> | ||
+ | ShareInertiaTensor<br /> | ||
+ | Add Top Part<br /> | ||
|- style="vertical-align:top;" | |- style="vertical-align:top;" | ||
| | | | ||
Line 874: | Line 938: | ||
IncreaseRotZ -> Increase Roll<br /> | IncreaseRotZ -> Increase Roll<br /> | ||
DecreaseRotZ -> Decrease Roll<br /> | DecreaseRotZ -> Decrease Roll<br /> | ||
+ | IncreaseScale<br /> | ||
+ | DecreaseScale<br /> | ||
SpawnProjection -> Spawn projection<br /> | SpawnProjection -> Spawn projection<br /> | ||
+ | IncreaseFontSize<br /> | ||
+ | DecreaseFontSize<br /> | ||
+ | IncreaseTextPaddingSlider<br /> | ||
+ | DecreaseTextPaddingSlider<br /> | ||
+ | IncreaseChangeIntervalSlider<br /> | ||
+ | DecreaseChangeIntervalSlider<br /> | ||
+ | PreserveAspectRatio<br /> | ||
| | | | ||
Line 1,277: | Line 1,350: | ||
| | | | ||
|} | |} | ||
− | < | + | |
+ | == Terminal Action and Property List == | ||
+ | |||
+ | All terminal blocks have terminal actions and properties. Sub-interfaces share their parent interface's terminal actions and properties. Therefore, as IMyTerminalBlock has OnOff action, all blocks also have it. To save space, any content a parent interface has will NOT be listed in the sub-interfaces. | ||
+ | |||
+ | The tables in this wiki page had been redone (06/28/2020) to better display the information needed. The tables will show the fields and methods that have the same purposes as the terminal properties and actions. notice that not all fields or methods will be shown, only those which have terminal functions will be. | ||
+ | |||
+ | In the tables listed below, some properties will be displayed (not to confuse with terminal properties): | ||
+ | |||
+ | '''Interface Name:''' the name of the interface in the ingame scripting API. | ||
+ | |||
+ | '''Terminal Action:''' the names of terminal actions and their descrptions. | ||
+ | |||
+ | '''Method:''' the methods in the interface API that do the same thing as terminal actions. It is recommanded to use interface methods. | ||
+ | |||
+ | '''Terminal Property:''' the names of terminal properties. | ||
+ | |||
+ | '''Field:''' the fields in the interface API that do the same thing as terminal properties. It is recommanded to use interface fields. | ||
+ | |||
+ | === IMyTerminalBlock === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Actions | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |Toggle Show on HUD On/Off | ||
+ | |<pre>"ShowOnHUD"</pre> | ||
+ | |rowspan="3"|<pre></pre> | ||
+ | |rowspan="3"|<pre>bool "ShowOnHUD"</pre> | ||
+ | |rowspan="3"|<pre>bool ShowOnHUD {get; set;}</pre> | ||
+ | |- | ||
+ | |Show on HUD On | ||
+ | |<pre>"ShowOnHUD_On"</pre> | ||
+ | |- | ||
+ | |Show on HUD On | ||
+ | |<pre>"ShowOnHUD_Off"</pre> | ||
+ | |- | ||
+ | |Name | ||
+ | |<pre></pre> | ||
+ | |<pre></pre> | ||
+ | |<pre>StringBuilder "Name"</pre> | ||
+ | |<pre>string Name {get;}</pre> | ||
+ | |- | ||
+ | |Show in Inventory | ||
+ | |<pre></pre> | ||
+ | |<pre></pre> | ||
+ | |<pre>bool "ShowInInventory"</pre> | ||
+ | |<pre>bool ShowInInventory {get; set;}</pre> | ||
+ | |- | ||
+ | |Show in Terminal | ||
+ | |<pre></pre> | ||
+ | |<pre></pre> | ||
+ | |<pre>bool "ShowInTerminal"</pre> | ||
+ | |<pre>bool ShowInTerminal {get; set;}</pre> | ||
+ | |- | ||
+ | |Show in Toolbar Config | ||
+ | |<pre></pre> | ||
+ | |<pre></pre> | ||
+ | |<pre>bool "ShowInToolbarConfig"</pre> | ||
+ | |<pre>bool ShowInToolbarConfig {get; set;}</pre> | ||
+ | |} | ||
+ | |||
+ | ==== IMyCargoContainer ==== | ||
+ | |||
+ | Cargo Container does not have it's own members except those inherited from IMyTerminalBlock. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |} | ||
+ | |||
+ | ==== IMyFunctionalBlock ==== | ||
+ | |||
+ | IMyFunctionalBlock is the parent of most terminal blocks. It can be turned on and off. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |Toggle Block On/Off | ||
+ | |<pre>"OnOff"</pre> | ||
+ | |rowspan="3"|<pre>void RequestEnable(bool enable) Obsolete: Use the setter of Enabled</pre> | ||
+ | |rowspan="3"|<pre>bool "OnOff"</pre> | ||
+ | |rowspan="3"|<pre>bool Enabled {get; set;}</pre> | ||
+ | |- | ||
+ | |Toggle Block On | ||
+ | |<pre>"OnOff_ON"</pre> | ||
+ | |- | ||
+ | |Toggle Block Off | ||
+ | |<pre>"OnOff_Off"</pre> | ||
+ | |} | ||
+ | |||
+ | ===== IMyAirVent ===== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |Toggle Depressurize On/Off | ||
+ | |<pre>"Depressurize"</pre> | ||
+ | |rowspan="3"|<pre></pre> | ||
+ | |rowspan="3"|<pre>bool "Depressurize"</pre> | ||
+ | |rowspan="3"|<pre>bool Depressurize {get; set;}</pre> | ||
+ | |- | ||
+ | |Depressurize On | ||
+ | |<pre>"Depressurize_On"</pre> | ||
+ | |- | ||
+ | |Depressurize Off | ||
+ | |<pre>"Depressurize_Off"</pre> | ||
+ | |} | ||
+ | |||
+ | ===== IMyAritificialMassBlock ===== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | ===== IMyBatteryBlock ===== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |Enable Auto | ||
+ | |<pre>"Auto"</pre> | ||
+ | |rowspan="3"|<pre></pre> | ||
+ | |rowspan="3"|<pre>long "ChargeMode"</pre> | ||
+ | |<pre>ChargeMode ChargeMode {get; set;}</pre> | ||
+ | |- | ||
+ | |Toggle Recharge On/Off | ||
+ | |<pre>"Recharge"</pre> | ||
+ | |<pre>bool OnlyRecharge {get; set;} Obsolete: Use ChargeMode instead</pre> | ||
+ | |- | ||
+ | |Toggle Discharge On/Off | ||
+ | |<pre>"Discharge"</pre> | ||
+ | |<pre>bool OnlyDischarge {get; set;} Obsolete: Use ChargeMode instead</pre> | ||
+ | |} | ||
+ | |||
+ | ===== IMyBeacon ===== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |Increase Broadcast Radius | ||
+ | |<pre>"IncreaseRadius"</pre> | ||
+ | |rowspan="2"|<pre></pre> | ||
+ | |rowspan="2"|<pre>float "Radius"</pre> | ||
+ | |rowspan="2"|<pre>float Radius {get; set;}</pre> | ||
+ | |- | ||
+ | |Decrease Broadcast Radius | ||
+ | |<pre>"DecreaseRadius"</pre> | ||
+ | |- | ||
+ | |Text Show On HUD | ||
+ | |<pre></pre> | ||
+ | |<pre></pre> | ||
+ | |<pre>StringBuilder "HudText"</pre> | ||
+ | |<pre>string HudText {get; set;}</pre> | ||
+ | |} | ||
+ | |||
+ | ===== IMyDoor ===== | ||
+ | |||
+ | There are different types of doors. They have similar behaviors. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |Toggle Anyone Can Use On/Off | ||
+ | |<pre>"AnyoneCanUse"</pre> | ||
+ | |<pre></pre> | ||
+ | |<pre>bool "AnyoneCanUse"</pre> | ||
+ | |<pre></pre> | ||
+ | |- | ||
+ | |Toggle Door Open/Closed | ||
+ | |<pre>"Open"</pre> | ||
+ | |<pre>void ToggleDoor()</pre> | ||
+ | |rowspan="3"|<pre>bool "Open"</pre> | ||
+ | |rowspan="3"| | ||
+ | bool Open {get;} Obsolete: Use the Status instead | ||
+ | DoorStatus Status {get;} | ||
+ | |- | ||
+ | |Open Door | ||
+ | |<pre>"Open_On"</pre> | ||
+ | |<pre>void OpenDoor()</pre> | ||
+ | |- | ||
+ | |Close Door | ||
+ | |<pre>"Open_Off"</pre> | ||
+ | |<pre>void CloseDoor()</pre> | ||
+ | |} | ||
+ | |||
+ | ====== IMyAdvancedDoor ====== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | ====== IMyAirtightHangarDoor ====== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | ====== IMyAirtightSlideDoor ====== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | ===== IMyProductionBlock ===== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |Toggle Use Conveyor System On/Off | ||
+ | |<pre>"UseConveyor"</pre> | ||
+ | |<pre></pre> | ||
+ | |<pre>bool "UseConveyor"</pre> | ||
+ | |<pre>bool UseConveyorSystem {get; set;}</pre> | ||
+ | |} | ||
+ | |||
+ | ====== IMyAssembler ====== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |Cooperative Mode On/Off | ||
+ | |<pre>"slaveMode"</pre> | ||
+ | |<pre></pre> | ||
+ | |<pre>bool "slaveMode"</pre> | ||
+ | |<pre>bool CooperativeMode {get; set;}</pre> | ||
+ | |} | ||
+ | |||
+ | ====== IMyRefinery ====== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | ==== IMyWarhead ==== | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |Description | ||
+ | |Terminal Action | ||
+ | |Method | ||
+ | |Terminal Property | ||
+ | |Field | ||
+ | |- | ||
+ | |Increase Detonation Time | ||
+ | |<pre>"IncreaseDetonationTime"</pre> | ||
+ | |rowspan="2"|<pre></pre> | ||
+ | |rowspan="2"|<pre>float "DetonationTime"</pre> | ||
+ | |rowspan="2"|<pre>float DetonationTime {get; set;}</pre> | ||
+ | |- | ||
+ | |Decrease Detonation Time | ||
+ | |<pre>"DecreaseDetonationTime"</pre> | ||
+ | |- | ||
+ | |Detonate | ||
+ | |<pre>"Detonate"</pre> | ||
+ | |<pre>void Detonate()</pre> | ||
+ | |<pre></pre> | ||
+ | |<pre></pre> | ||
+ | |- | ||
+ | |Toggle Arm Warhead On/Off | ||
+ | |<pre>"Safety"</pre> | ||
+ | |<pre></pre> | ||
+ | |<pre>bool "Safety"</pre> | ||
+ | |<pre>bool IsArmed {get; set;}</pre> | ||
+ | |- | ||
+ | |Start Countdown | ||
+ | |<pre>"StartCountdown"</pre> | ||
+ | |<pre>bool StartCountdown()</pre> | ||
+ | |rowspan="2"|<pre></pre> | ||
+ | |rowspan="2"|<pre>bool IsCountingDown {get;}</pre> | ||
+ | |- | ||
+ | |Stop Countdown | ||
+ | |<pre>"StopCountdown</pre> | ||
+ | |<pre>bool StopCountdown()</pre> | ||
+ | |} |
Latest revision as of 20:29, 22 February 2021
Contents
- 1 Invoking Terminal Actions and Properties
- 2 Terminal Action List (Old)
- 2.1 Air Vent
- 2.2 Advanced Rotor
- 2.3 Antenna
- 2.4 Artificial Mass
- 2.5 Assembler
- 2.6 Battery
- 2.7 Beacon
- 2.8 Button Panel
- 2.9 Camera
- 2.10 Cargo Containers
- 2.11 Cockpit, Control Station, Flight Seat
- 2.12 Collector
- 2.13 Connector
- 2.14 Control Panel
- 2.15 Conveyor Sorter
- 2.16 Door
- 2.17 Drill
- 2.18 Gatling Gun
- 2.19 Gatling Turret
- 2.20 Gravity Generator
- 2.21 Grinder
- 2.22 Gyroscope
- 2.23 Interior Light
- 2.24 Interior Turret
- 2.25 Jump Drive
- 2.26 Landing Gear
- 2.27 Laser Antenna
- 2.28 Medical Room
- 2.29 Merge Block
- 2.30 Missile Turret
- 2.31 Ore Detector
- 2.32 Oxygen Farm
- 2.33 Oxygen Generator
- 2.34 Oxygen/Hydrogen Tank
- 2.35 Passenger Seat
- 2.36 Piston
- 2.37 Programmable block
- 2.38 Projector
- 2.39 Reactor (Small, Large)
- 2.40 Refinery and Arc Furnace
- 2.41 Reloadable Rocket Launcher
- 2.42 Remote Control
- 2.43 Rocket Launcher
- 2.44 Rotor
- 2.45 Sensor
- 2.46 Solar Panel
- 2.47 Sound Block
- 2.48 Space Balls
- 2.49 Spherical Gravity Generator
- 2.50 Spotlight
- 2.51 Text Panel, LCD, Wide LCD
- 2.52 Thruster (Ion, Hydrogen, Atmospheric)
- 2.53 Timer Block
- 2.54 Warhead
- 2.55 Welder
- 2.56 Wheel Suspension (1x1, 3x3, 5x5)
- 3 Terminal Action and Property List
🚧🚧🚧 Under Construction 🚧🚧🚧 |
---|
Attention - This page is currently being actively worked on, and may contain incomplete information
|
In addition to interface methods and properties given in the interface API, the in-game programming also provides terminal actions and terminal properties. Those terminal actions and properties behave like the options in the terminal system ingame that players can interact with.
Notice that terminal actions and properties should be obsolete, because the most block interfaces now provide API methods and properties that users can invoke.
Invoking Terminal Actions and Properties
The In-game Programming system provides methods for users to invoke the terminal properties, with a string parameter determining the name of the terminal action or property needed. Those methods belong to the IMyTerminalBlock interface. While all terminal blocks (Reactor, for example) are the sub-types of IMyTerminalBlock, they all have the methods. However, if the string parameter asks for the terminal action or property which does not exist in the given block, a NullReferenceException will be thrown[1].
In the programming namespace, the terminal actions are accessed as ITerminalAction interface and the terminal properties are ITerminalProperty.
Terminal Actions
To make the block apply action, call
block.ApplyAction(string actionName)
For example:
// Turn off a light IMyInterior light; // codes that you assign the actual light you want to turn off. light.ApplyAction("OnOff_Off"); // turn off the light
Terminal Properties
To access the terminal properties, two methods are provided. Unlike the action method above, those property methods are generic, which means a extra type parameter is needed when calling the methods.
To get a property of a block, call
block.GetValue<T>(string propertyName)
For example:
// Get the color of a light IMyInteriorLight light; // codes that you assign the actual light you want to get color from. Color color = light.GetValue<Color>("Color"); // get color
To set a property of a block, call
block.SetValue<T>(string propertyName, T property)
For example:
// Set the color of a light Color color = new Color(50, 100, 200); // create a new color IMyInteriorLight light; // codes that you assign the actual light you want to set color light.SetValue<Color>("Color", color); // set color
Terminal Action List (Old)
All terminal blocks have the following properties:
Interface name: this name is the name of the block in code, it can differ from the name as displayed in the building screen. E.g. Antenna interface name is IMyRadioAntenna - you need to use this interface if you want to get all antennas.
Parent: this is parent of the block (all blocks have IMyTerminalBlock as parent), this can be used for getting type of blocks instead of concrete block type. E.g. if you want to get all lights in grid you will use IMyLightingBlock, if you want only interior light you can use IMyInteriorLight.
Field: this is read only field available for block e.g. for IMyBeacon you can get Radius property. Based on this property you can increase/decrease radius of beacon.
Actions: these are all available actions for block with their names in game, so if you want to increase broadcast radius for antenna, you need to execute IncreaseRadius action for block.
Air VentInterface name: IMyAirVent Actions: |
Advanced RotorInterface name: IMyMotorAdvancedStator Actions: |
AntennaInterface name: IMyRadioAntenna Actions:
|
Artificial MassInterface name: IMyVirtualMass Actions: |
AssemblerInterface name: IMyAssembler Actions: |
BatteryInterface name: IMyBatteryBlock Actions: |
BeaconInterface name: IMyBeacon Actions: |
Button PanelInterface name: IMyButtonPanel Actions: |
CameraInterface name: IMyCameraBlock Actions: |
Cargo ContainersInterface name: IMyCargoContainer Actions: none |
Cockpit, Control Station, Flight SeatInterface name: IMyCockpit Actions: |
CollectorInterface name: IMyCollector Actions: |
ConnectorInterface name: IMyShipConnector Actions: |
Control PanelInterface name: IMyControlPanel |
Conveyor SorterInterface name: IMyConveyorSorter Actions: |
DoorInterface name: IMyDoor Actions: |
DrillInterface name: IMyShipDrill Actions: |
Gatling GunInterface name: IMySmallGatlingGun Actions: |
Gatling TurretInterface name: IMyLargeGatlingTurret Actions: |
Gravity GeneratorInterface name: IMyGravityGenerator Actions: |
GrinderInterface name: IMyShipGrinder Actions: |
GyroscopeInterface name: IMyGyro Actions: |
Interior LightInterface name: IMyInteriorLight Actions: |
Interior TurretInterface name: IMyLargeInteriorTurret Actions: |
Jump DriveInterface name: IMyJumpDrive Actions: |
Landing GearInterface name: IMyLandingGear Actions: |
Laser AntennaInterface name: IMyLaserAntenna Actions: |
Medical RoomInterface name: IMyMedicalRoom |
Merge BlockInterface name: IMyShipMergeBlock Actions: |
Missile TurretInterface name: IMyMissileTurret Actions: |
Ore DetectorInterface name: IMyOreDetector Actions: |
Oxygen FarmInterface name: IMyOxygenFarm Actions: |
Oxygen GeneratorInterface name: IMyOxygenGenerator Actions: |
Oxygen/Hydrogen TankInterface name: IMyOxygenTank Actions: |
Passenger SeatInterface name: IMyCockpit Actions: |
PistonInterface name: IMyPistonBase Actions: |
Programmable blockInterface name: IMyProgrammableBlock Actions: |
ProjectorInterface name: IMyProjector Actions: |
Reactor (Small, Large)Interface name: IMyReactor Actions: |
Refinery and Arc FurnaceInterface name: IMyRefinery Actions: |
Reloadable Rocket LauncherInterface name: IMySmallMissileLauncherReload Actions: |
Remote ControlInterface name: IMyRemoteControl Actions: |
Rocket LauncherInterface name: IMySmallMissileLauncher Actions: |
RotorInterface name: IMyMotorStator Actions: |
SensorInterface name: IMySensorBlock Actions: |
Solar PanelInterface name: IMySolarPanel |
Sound BlockInterface name: IMySoundBlock Actions: |
Space BallsInterface name: IMySpaceball Actions: |
Spherical Gravity GeneratorInterface name: IMyGravityGeneratorSphere Actions: |
SpotlightInterface name: IMyReflectorLight Actions: |
Text Panel, LCD, Wide LCDInterface name: IMyTextPanel Actions: |
Thruster (Ion, Hydrogen, Atmospheric)Interface name: IMyThrust Actions: |
Timer BlockInterface name: IMyTimerBlock Actions: |
WarheadInterface name: IMyWarhead Actions: |
WelderInterface name: IMyShipWelder Actions: |
Wheel Suspension (1x1, 3x3, 5x5)Interface name: IMyMotorSuspension Actions: |
Terminal Action and Property List
All terminal blocks have terminal actions and properties. Sub-interfaces share their parent interface's terminal actions and properties. Therefore, as IMyTerminalBlock has OnOff action, all blocks also have it. To save space, any content a parent interface has will NOT be listed in the sub-interfaces.
The tables in this wiki page had been redone (06/28/2020) to better display the information needed. The tables will show the fields and methods that have the same purposes as the terminal properties and actions. notice that not all fields or methods will be shown, only those which have terminal functions will be.
In the tables listed below, some properties will be displayed (not to confuse with terminal properties):
Interface Name: the name of the interface in the ingame scripting API.
Terminal Action: the names of terminal actions and their descrptions.
Method: the methods in the interface API that do the same thing as terminal actions. It is recommanded to use interface methods.
Terminal Property: the names of terminal properties.
Field: the fields in the interface API that do the same thing as terminal properties. It is recommanded to use interface fields.
IMyTerminalBlock
Description | Terminal Actions | Method | Terminal Property | Field |
Toggle Show on HUD On/Off | "ShowOnHUD" |
bool "ShowOnHUD" |
bool ShowOnHUD {get; set;} | |
Show on HUD On | "ShowOnHUD_On" | |||
Show on HUD On | "ShowOnHUD_Off" | |||
Name | StringBuilder "Name" |
string Name {get;} | ||
Show in Inventory | bool "ShowInInventory" |
bool ShowInInventory {get; set;} | ||
Show in Terminal | bool "ShowInTerminal" |
bool ShowInTerminal {get; set;} | ||
Show in Toolbar Config | bool "ShowInToolbarConfig" |
bool ShowInToolbarConfig {get; set;} |
IMyCargoContainer
Cargo Container does not have it's own members except those inherited from IMyTerminalBlock.
Description | Terminal Action | Method | Terminal Property | Field |
IMyFunctionalBlock
IMyFunctionalBlock is the parent of most terminal blocks. It can be turned on and off.
Description | Terminal Action | Method | Terminal Property | Field |
Toggle Block On/Off | "OnOff" |
void RequestEnable(bool enable) Obsolete: Use the setter of Enabled |
bool "OnOff" |
bool Enabled {get; set;} |
Toggle Block On | "OnOff_ON" | |||
Toggle Block Off | "OnOff_Off" |
IMyAirVent
Description | Terminal Action | Method | Terminal Property | Field |
Toggle Depressurize On/Off | "Depressurize" |
bool "Depressurize" |
bool Depressurize {get; set;} | |
Depressurize On | "Depressurize_On" | |||
Depressurize Off | "Depressurize_Off" |
IMyAritificialMassBlock
Description | Terminal Action | Method | Terminal Property | Field |
IMyBatteryBlock
Description | Terminal Action | Method | Terminal Property | Field |
Enable Auto | "Auto" |
long "ChargeMode" |
ChargeMode ChargeMode {get; set;} | |
Toggle Recharge On/Off | "Recharge" |
bool OnlyRecharge {get; set;} Obsolete: Use ChargeMode instead | ||
Toggle Discharge On/Off | "Discharge" |
bool OnlyDischarge {get; set;} Obsolete: Use ChargeMode instead |
IMyBeacon
Description | Terminal Action | Method | Terminal Property | Field |
Increase Broadcast Radius | "IncreaseRadius" |
float "Radius" |
float Radius {get; set;} | |
Decrease Broadcast Radius | "DecreaseRadius" | |||
Text Show On HUD | StringBuilder "HudText" |
string HudText {get; set;} |
IMyDoor
There are different types of doors. They have similar behaviors.
Description | Terminal Action | Method | Terminal Property | Field |
Toggle Anyone Can Use On/Off | "AnyoneCanUse" |
bool "AnyoneCanUse" |
||
Toggle Door Open/Closed | "Open" |
void ToggleDoor() |
bool "Open" |
bool Open {get;} Obsolete: Use the Status instead DoorStatus Status {get;} |
Open Door | "Open_On" |
void OpenDoor() | ||
Close Door | "Open_Off" |
void CloseDoor() |
IMyAdvancedDoor
Description | Terminal Action | Method | Terminal Property | Field |
IMyAirtightHangarDoor
Description | Terminal Action | Method | Terminal Property | Field |
IMyAirtightSlideDoor
Description | Terminal Action | Method | Terminal Property | Field |
IMyProductionBlock
Description | Terminal Action | Method | Terminal Property | Field |
Toggle Use Conveyor System On/Off | "UseConveyor" |
bool "UseConveyor" |
bool UseConveyorSystem {get; set;} |
IMyAssembler
Description | Terminal Action | Method | Terminal Property | Field |
Cooperative Mode On/Off | "slaveMode" |
bool "slaveMode" |
bool CooperativeMode {get; set;} |
IMyRefinery
Description | Terminal Action | Method | Terminal Property | Field |
IMyWarhead
Description | Terminal Action | Method | Terminal Property | Field |
Increase Detonation Time | "IncreaseDetonationTime" |
float "DetonationTime" |
float DetonationTime {get; set;} | |
Decrease Detonation Time | "DecreaseDetonationTime" | |||
Detonate | "Detonate" |
void Detonate() |
||
Toggle Arm Warhead On/Off | "Safety" |
bool "Safety" |
bool IsArmed {get; set;} | |
Start Countdown | "StartCountdown" |
bool StartCountdown() |
bool IsCountingDown {get;} | |
Stop Countdown | "StopCountdown |
bool StopCountdown() |