Controls container

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
(event)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
The [[controls_container|controls container]] is a top-level [[config.txt file]] entry used by [[KIND_Controlset|controlset]] assets.
 
The [[controls_container|controls container]] is a top-level [[config.txt file]] entry used by [[KIND_Controlset|controlset]] assets.
  
 
+
==Supported Tags==
 
The controls container is a list of control subcontainers with no standalone tags. Each control subcontainer uses the following format.
 
The controls container is a list of control subcontainers with no standalone tags. Each control subcontainer uses the following format.
  
==Supported Tags==
+
   name-token                 ""
Each control subcontainer supports the following tags. Each tag is shown here with its default value.
+
   desc-token                 ""
 
+
   event                       ""
   name-token         ""
+
   default-keys               ""
   desc-token         ""
+
   context                     ""
   event               ""
+
   reassignable               1
   default-keys       ""
+
   trigger-on-up               0
   context             ""
+
   trigger-on-down             1
   reassignable       1
+
   trigger-on-held             1
   trigger-on-up       0
+
  trigger-mode-analog        0
   trigger-on-down     1
+
   trigger-on-held     1
+
  
 
====name-token====
 
====name-token====
Line 26: Line 24:
  
 
====event====
 
====event====
:Type: text
+
:Type: string
:Desc: The name of the event to trigger when the control is triggered. A script message of the format ("ControlSet", <event>) will be posted to any linked [[KIND Library|library]] or [[KIND Interior|interior]] asset (library/interior assets can specify a control set using the "controlset" tag). If trigger-on-up is specified Message.minor will be set to "<event>-up" when the key is released.
+
:Desc: The name of the event to trigger when the control is triggered. A script message of the format ("ControlSet", <event>) will be posted to any linked [[KIND Library|library]] or [[KIND Interior|interior]] asset (library/interior assets can specify a control set using the "controlset" tag). If the 'trigger-on-up' tag is set to true 'Message.minor' will be set to "<event>-up" when the key is released.
  
 
====default-keys====
 
====default-keys====
:Type: text
+
:Type: string
:Desc: A comma separated list of the default keys to map to this control. Use "null" if no default keys are to be set, if multiple keys are required separate the keys with a space, e.g. "shift n".
+
:Desc: A comma separated list of the default key binds to map to this control. If multiple keys are required for a single bind, separate them with a space, e.g. "shift n".
 +
:Note: Trainz will only automatically map default key bindings for builtin content. Nonetheless, it is recommended that content creators use this field to provide "suggested" default bindings where appropriate.
  
 
====context====
 
====context====
:Type: text
+
:Type: context-list (game-context.txt)
:Desc: A semicolon separated list of contexts under which the control should be active, e.g. "surveyor;driver".
+
:Desc: A semicolon separated list of contexts under which the control should be active, as follows:
:Possible values: menu, surveyor, surveyor-topology, surveyor-paint, surveyor-objects, surveyor-track, surveyor-trains, surveyor-tools, surveyor-layers, driver, driver-cab, driver-cab-steam, driver-dcc, railyard
+
:* menu - Key will activate in any of the in-game menu screens (e.g. the Routes menu)
 +
:* railyard - Key will activate in Railyard
 +
:* surveyor - Key will activate in Surveyor, regardless of active tools
 +
:* surveyor-topology - Key will activate in Surveyor while in topology editing mode
 +
:* surveyor-paint - Key will activate in Surveyor while in terrain painting mode
 +
:* surveyor-objects - Key will activate in Surveyor while in scenery edit modes (object placement, or scenery spline placement)
 +
:* surveyor-track - Key will activate in Surveyor while in track edit modes (track placement, trackside object placement, or trackmark placement)
 +
:* surveyor-tools - Key will activate in Surveyor while in tool edit mode (cameras, rulers, copy, paste, etc)
 +
:* surveyor-layers - Key will activate in Surveyor while in layers edit mode
 +
:* surveyor-trains - Key will activate in Surveyor while in train/consist edit mode
 +
:* driver - Key will activate while in Driver, regardless of control mode
 +
:* driver-dcc - Key will activate while in Driver, while in DCC control mode
 +
:* driver-cab - Key will activate while in Driver, while in Cab control mode with a diesel/electric loco
 +
:* driver-cab-steam - Key will activate while in Driver, while in Cab control mode with a steam loco
  
 
====reassignable====
 
====reassignable====
Line 53: Line 65:
 
:Type: bool
 
:Type: bool
 
:Desc: Whether the control event should repeatedly trigger while a key remains held.
 
:Desc: Whether the control event should repeatedly trigger while a key remains held.
 +
 +
====trigger-mode-analog====
 +
:Type: bool
 +
:Desc: Sets the control as being for 'analog' use. For example, a throttle lever control, which has non-boolean input values. Requires a minimum trainz-build of 4.6.
  
  

Latest revision as of 15:02, 22 November 2017

The controls container is a top-level config.txt file entry used by controlset assets.

Contents

[edit] Supported Tags

The controls container is a list of control subcontainers with no standalone tags. Each control subcontainer uses the following format.

 name-token                  ""
 desc-token                  ""
 event                       ""
 default-keys                ""
 context                     ""
 reassignable                1
 trigger-on-up               0
 trigger-on-down             1
 trigger-on-held             1
 trigger-mode-analog         0

[edit] name-token

Type: text
Desc: The name of a string table entry with the user visible name of the control in it. This string table entry will be used in the Trainz user interface to refer to the control. It should be very short.

[edit] desc-token

Type: text
Desc: The name of a string table entry with the user visible description of the control in it. This string table entry will be used in the Trainz user interface to give detail to the user about the control. It should be fairly short. Optional.

[edit] event

Type: string
Desc: The name of the event to trigger when the control is triggered. A script message of the format ("ControlSet", <event>) will be posted to any linked library or interior asset (library/interior assets can specify a control set using the "controlset" tag). If the 'trigger-on-up' tag is set to true 'Message.minor' will be set to "<event>-up" when the key is released.

[edit] default-keys

Type: string
Desc: A comma separated list of the default key binds to map to this control. If multiple keys are required for a single bind, separate them with a space, e.g. "shift n".
Note: Trainz will only automatically map default key bindings for builtin content. Nonetheless, it is recommended that content creators use this field to provide "suggested" default bindings where appropriate.

[edit] context

Type: context-list (game-context.txt)
Desc: A semicolon separated list of contexts under which the control should be active, as follows:
  • menu - Key will activate in any of the in-game menu screens (e.g. the Routes menu)
  • railyard - Key will activate in Railyard
  • surveyor - Key will activate in Surveyor, regardless of active tools
  • surveyor-topology - Key will activate in Surveyor while in topology editing mode
  • surveyor-paint - Key will activate in Surveyor while in terrain painting mode
  • surveyor-objects - Key will activate in Surveyor while in scenery edit modes (object placement, or scenery spline placement)
  • surveyor-track - Key will activate in Surveyor while in track edit modes (track placement, trackside object placement, or trackmark placement)
  • surveyor-tools - Key will activate in Surveyor while in tool edit mode (cameras, rulers, copy, paste, etc)
  • surveyor-layers - Key will activate in Surveyor while in layers edit mode
  • surveyor-trains - Key will activate in Surveyor while in train/consist edit mode
  • driver - Key will activate while in Driver, regardless of control mode
  • driver-dcc - Key will activate while in Driver, while in DCC control mode
  • driver-cab - Key will activate while in Driver, while in Cab control mode with a diesel/electric loco
  • driver-cab-steam - Key will activate while in Driver, while in Cab control mode with a steam loco

[edit] reassignable

Type: bool
Desc: Whether the control supports player reassignment in the options menus.

[edit] trigger-on-up

Type: bool
Desc: Whether the control event should trigger on key up.

[edit] trigger-on-down

Type: bool
Desc: Whether the control event should trigger on key down.

[edit] trigger-on-held

Type: bool
Desc: Whether the control event should repeatedly trigger while a key remains held.

[edit] trigger-mode-analog

Type: bool
Desc: Sets the control as being for 'analog' use. For example, a throttle lever control, which has non-boolean input values. Requires a minimum trainz-build of 4.6.


[edit] Example controls container

See controlset.

[edit] Categories

Personal tools