HowTo/WagonX - Technical Reference

From TrainzOnline
< HowTo
Revision as of 15:01, 21 February 2024 by Pcas1986 (Talk | contribs)

Jump to: navigation, search

Document Structure

The WagonX Tutorial set is written over several pages. This page is a base reference for using WagonX config containers, their properties and the values for those properties. Other pages in the series are listed below:
  1. HowTo/Use the WagonX Library
  2. HowTo/WagonX - Browser Properties Examples and Basic Tutorials
  3. HowTo/WagonX - Traincar Tutorial
  4. HowTo/WagonX - Locomotive Tutorial


Contents


The WagonX Reference

This page contains details of the WagonX extension container and sub-containers. Practical examples of usage can be found in the tutorials listed above.


Restricted Characters

The characters in the list below cannot be used for some property tag values as they are used by the script to parse or identify values such as list items and other information. They can be used in name and description tags. Use of these characters in tag values is identified in the properties descriptions that follow. Tutorial sections give examples of use. See also display-values.
  • Comma ( , )
  • Semicolon ( ; )
  • Backtick ( ` )
  • Colon ( : )


General Layout

WagonX config tags are defined in the extensions container along with other extensions such as ACS Lib. The general layout of the extensions container that also includes ACS Lib might look like this:
extensions
{
  max_permitted_speed-60850     "50mph"
  active-coupling-standard-60850
  {
    ...
  }
  wagon-x
  {
    ...
  }
}


WagonX Properties

There are currently three standard or "top level" WagonX containers that define properties for Marker Lights, a variation of ACSLib and Misc (miscellaneous). In addition to the standard containers, you can define zero or more additonal property containers that are identified by integer value names starting from 0. Each of these containers are defined below.

ACS

For help on creating the acs extensions and setting up the acs mesh-table objects, see Naming ACS mesh-table attachments.
Each tag is shown here with sample values. There are no default values.
acs
{
  animated                            1
  use-jbv-animation                   1
  duration                            1.0
}
  • animated (1 = true, 0=false)
This determines whether to use animations to move between the coupled and uncoupled state, or use individual static assets for each state.
  • use-jbv-animation (1 = true, 0=false)
An animation system the author (DunDun92) made for compressing buffers and dynamic couplings and hoses, which is now being phased out due to performance problems. leave it at 0, unless you are using the JBV BR Mesh Library or BR class 101 mesh library, or any of his other libraries.
  • duration (a floating point value)
The time, in seconds, that the mesh animation will take to move between the two states. If animated is set to 0, this will determine the fade duration when switching between meshes (fade duration on mesh objects in trainzbuild 5.0 + can get buggy)


Misc

The misc container currently contains times, in seconds, for industry loading and unloading. Usually, these times are used to enable animations to run before or after loading/unloading. Each available tag is shown here with sample values. There are no defaults.
misc
{
  begin-load-time                   5.0
  begin-unload-time                 5.0
  end-load-time                     1.0
  end-unload-time                   1.0
}
  • begin-load-time (a floating point value)
The time it takes for the wagon to load at an industry
  • begin-unload-time (a floating point value)
The time it takes for the wagon to unloading at an industry
  • end-load-time (a floating point value)
The time it takes for the wagon end loading at an industry
  • end-unload-time (a floating point value)
The time it takes for the wagon to end unloading at an industry

Marker-Lights

The Marker-Lights container is used to show or hide light meshes that are identied by entries in the config mesh-table. Each tag is shown here with sample values. There are no defaults.
marker-lights
{
  enabled                             1
  car-minimum-count                   1
  require-locomotive                  1
  night-only                          0
  front
  {
    head
    {
      mesh                            "null"
    }
    tail
    {
      mesh                            "lamp-front-red"
    }
  }
  back
  {
    head
    {
      mesh                            "lamp-back-white"
    }
    tail
    {
      mesh                            "lamp-back-red"
    }
  }
}


  • enabled (1 = true, 0=false)
Whether or not the marker lights are active on this asset.
  • car-minimum-count (an integer number)
The minimum number of cars that must be present in the consist for the marker-lights to activate.
  • require-locomotive (1 = true, 0=false)
If set to 1, a traincar of Class locomotive will need to be present in the consist for the marker-lights to activate.
  • night-only (1 = true, 0=false)
If set to 1, the lamps will only be visible at night, otherwise they will be displayed 24/7.
  • Front/back head/tail containers
These containers identify the mesh to use for the front, back, head, and tail lamps. These meshes must be in the config mesh-table.

Browser-Properties

  • The browser-properties container is a set of zero or more property containers that hold settings for a property such as a smoke effect, an attachment or even texture replacement. They are quite flexible and suitable most any traincar/loco property.
  • A property can have sub properties that are activated with their parent.
  • A property container has a number of tags with values. Many are common to different property types but some are unique to a property.
  • A container need not contain all available tags.
  • We start with a sample of two properties: one for a texture replacement (skin) and the second for a handbrake activation. These are representative only and may not be suitable for your asset,
browser-properties
{
  0
  {
    enabled                    1
    property-visibility        1
    name                       "Skin: "
    property-id                "p_skin"
    consist-property-sync      1
    description                "Sets the weathering type"
    kind                       "fx-replacement"
    fx-replacement-type        "texture-replacement"
    meshes                     "null"
    effects                    "texture-albedo,texture-parameter"
    asset                      "texturelib"
    files-path                 "null"
    values                     "0;3,1;4,2;5"
    default-index              -1
    trigger                    "user"
    display-type               "link"
    display-values             "Clean,Weathered,Dirty"
  }
  1
  {
    enabled                    1
    property-visibility        0
    name                       "Handbrake State: "
    property-id                "p_handbrake"
    description                "Toggle the handbrake"
    kind                       "mesh-attachment"
    mesh-attachment-type       "mesh-animation-frame"
    meshes                     "handbrake-lever,braking-system"
    values                     "0;0,30;30"
    events                     "handbrake-release,handbrake-apply"
    duration                   3.2
    default-index              0
    trigger                    "both"
    display-type               "link"
    display-values             "release,apply"
  }
}

Supported Tags

Tag explanations. Some examples are included in the definition and, for others, see above for sample of usage.

enabled

Type: Boolean (1 = true, 0=false)
Compulsory: No
Default: No default.
Desc: Whether or not this property is active. This is useful for debugging, or if you want to disable it without removing everything.

property-visibility

Type: Integer - (0 = Hidden, 1 = Visible, 2 = Surveyor Only, 3 = Driver Only)
Compulsory: No
Default: 0 (hidden)
Desc: Indicates whether the property will be visible in the Properties Browser and in what mode.

name

Type: String
Compulsory: Yes
Default: None
Desc: The display name of this property, as will appear on the properties page.

child-properties

Type: A string of numbers separated by commas.
Compulsory: No
Default: None
Desc: The list of properties that will activate when this property is activated. They will activate at the same index as the parent, similar to consist-property-sync. The property-visibility tag for the child properties should be set to 0. The child properties cannot have their own child-properties tag, and the property-visibility of the child-property must be 0, else it will not activate. You cannot set the child-property to yourself either.
Example: child-properties "2,4,5"

property-id

Type: String
Compulsory: Yes
Default: None
Desc: The formal name (ID) of this property, used to identify and change this property. For example, If the name is Workflow, it might be a good idea to call this p_workflow.
This must be unique for each browser-property
.

consist-property-sync

Type: Integer - (0 off, 1 on (button), 2 on (automatic)
Compulsory: No
Default: None
Desc: Whether or not to sync the property within the consist, if a tag with the same HowTo/WagonX - Technical Reference#property-sync-id exists in the other assets. Omitting or setting the tag to 0 disables this. Setting it to 1 will create a button to the right of the property that can be clicked on to sync the property. Setting it to 2 will automatically sync the property across the consist whenever a change in the property is detected.

property-sync-id

Type: String
Compulsory: No
Default: None
Desc: The ID that determines which assets will be affected when consist-property-sync is activated. Only assets that share this ID will be synced in the consist, so be sure to make it particular and unique.
Example: property-sync-id "soundBell"

description

Type: String
Compulsory: No
Default: None
Desc: The description of this attachment as it will appear in the Properties Browser.

kind

Type: String
Compulsory: No
Default: None
Desc: The type of property this will be. Can be one of the options below. Most of these are derived from Class_MeshObject. For more info on implementing these, see HowTo/WagonX - Technical Reference#values.
  • mesh-attachment
Manipulate the mesh’s animation, position, visibility, etc. See mesh-attachment-type.
  • fx-replacement
Change an effect in the mesh. See HowTo/WagonX - Technical Reference#fx-replacement-type.
  • particle-effect
Activate/Deactivate/Edit a particle effect (smoke0, smoke1, etc). See HowTo/WagonX - Technical Reference#particle-effects and HowTo/WagonX - Technical Reference#particle-effect-type.
  • sound-script
Used to play a sound-script sound within this asset. See HowTo/WagonX - Technical Reference#sound-triggers.
  • config-edit
Used to edit a tag in the wagon-x config soup. See paths.

particle-effect-type

Type: String (kind mesh-attachment only)
Compulsory: No
Default: None
Desc: The type of PFX function this property will be if the HowTo/WagonX - Technical Reference#kind tag is set to particle-effect. Each one is hyperlinked to the corresponding trainzscript function, though it is not necessary to know them. See HowTo/WagonX - Technical Reference#values for instructions on how to implement these properties. Currently, only pfx-message is supported.
Example: kind "particle-effect"
particle-effect-type "pfx-message"
Send a message to enable/disable a particle effect.

mesh-attachment-type

Type: String - (kind mesh-attachment only)
Example: kind "mesh-attachment"
mesh-attachment-type "mesh-animation-frame"
Compulsory: No
Default: None
Desc: The type of mesh property this property will be if the kind tag is set to mesh-attachment. Each one is hyperlinked to the corresponding trainzscript function, though it is not necessary to know them. See values for instructions on how to implement these properties.
Toggle between the mesh(s) being visible or hidden.
Sets the translation and orientation of the mesh(es)
Sets the frame(s) the meshes animation will move between. Useful for door opening and closing animations, or animations that require more than 2 states.
Start or stop an animation-loop on the mesh.
Sets the state of the mesh(s) animation.
Changes the speed of the meshes animation.

fx-replacement-type

Type: String)(kind fx-replacement only)
Example: kind "fx-replacement"
fx-replacement-type "texture-replacement"
Compulsory: No
Default: None
Desc: The type of fx replacement effect this property will be if the HowTo/WagonX - Technical Reference#kind tag is set to fx-replacement. Each one is hyperlinked to the corresponding trainzscript function, though it is not necessary to know them. See HowTo/WagonX - Technical Reference#values for instructions on how to implement these properties.
Replaces a texture effect in this asset to one within a texture-group asset.
Replaces a texture effect in this asset to one located within this asset.
Replaces a corona effect in the asset.
Replaces a name effect in the asset.
Replaces an attachment effect in the asset.
Plays/Stops an animation effect in the asset.

duration

Type: Float
Compulsory: No
Default: None
Desc: For kind mesh-animation and mesh-toggle. This tag determines the time to transition to the next state for the value. If it is 0, the transition will occur instantaneously. (There may be issues with using this tag with mesh-toggle.)
Example: duration 3.2

meshes

Type: String - (a list of mesh names from the mesh-table separated by commas)
Example: meshes "handbrake-lever,braking-system"
Compulsory: No
Default: None
Desc: The comma-separated mesh-table asset(s) to be modified by the property. Use this for HowTo/WagonX - Technical Reference#kind mesh-toggle or kind mesh-animation. Use this tag, the effect tag, or the asset tag, but not more than one.

effects

Type: String - (a list of texture names (i.e. texture.txt names without the .txt) each separated by a comma)
Example: effects "texture-albedo,texture-parameter"
Compulsory: No
Default: None
Desc: The comma-separated effect(s) to be modified by the property. Only use this tag if you are using HowTo/WagonX - Technical Reference#kind fx-replacement. Use this tag, the mesh tag, or the asset tag, but not more than one.

particle-effects

Type: String - (a list of integer numbers as a string)
Example: particle-effects "0,1"
Compulsory: No
Default: None
Desc: For kind particle-effect. The comma-separated list of PFX effects to be modified by the property. See kind for help on implementation. There is currently no use for this tag as of yet. pfx-message doesn't need this because everything is already specified in the values tag.

target-asset

Type: String
Example: target-asset "bogey-0"
Compulsory: No
Default: None
Desc: This determines which assets config this property will manipulate. This tag is currently only used for manipulating a vehicles bogey (e.g. texture replacement). The name must be “bogey-” + the index of the bogey to edit. This gives you full access to the bogeys mesh-table, allowing you to set texture replacements, mesh toggles, and other properties within the bogey. This tag can be omitted if you are not doing bogey texture replacements. Only properties of kind “mesh-attachment” or “fx-replacement” can be used for properties that use this tag.

asset

Type: String
Example: asset "texturelib"
Compulsory: No
Default: None
Desc: The kuid-table asset to be used by the property. Use this for cases where you need to reference another asset outside of this, such as a texture-replacement library. Use this tag, the HowTo/WagonX - Technical Reference#effects tag, the HowTo/WagonX - Technical Reference#meshes tag, or the HowTo/WagonX - Technical Reference#particle-effects tag, but not more than one.

files-path

Type: String - (a list of two strings)
Example: files-path "images/,.texture"
Compulsory: No
Default: None
Desc: An optional tag that shortens the number of characters that need to be written to the “values“ tag, assuming they all share the same path or asset library and extension. The path and extension can be specified here (e.g. files-path “images/left/.texture”), where images/left is the path, and .texture is the extension for all the files.

paths

Type: String - (a list of two strings)
Example: paths "marker-lights/night-only""
Compulsory: Yes
Default: None
Desc: For kind config-edit. A comma-separated list of paths that point to the tag in the wagon-x config to edit.

values

Type: String - (a string list separated by special characters)
Example1 values "0,15,30"
Compulsory: No
Default: None
Desc: A comma-separated (and optionally semicolon-separated) list of all the files/values to be switched between. If the files-path tag is used, only include each file’s name (exclude the path and extension). This tag is required for all properties. If it is not wanted, leave the value at “1”, but keep the tag still. For booleans, use 1 for true, and 0 for false. For animations, specify the animation frames you want to toggle through. For details on using the semicolon separator to shorten properties, see HowTo/WagonX - Browser Properties Examples and Basic Tutorials#Using Semicolons to set multiple values in one property.
Each kind has its own rules for what to put here, explained below. See the HowTo/WagonX - Technical Reference#kind property for more info on these.
  • For kind mesh-attachment:
  • For mesh-attachment-type mesh-toggle, the value must be either 0 or 1 (visible/hidden) ???
  • For mesh-attachment-type mesh-translation-orientation, the value must be a 3-dimensional vector with values separated by backticks, enclosed with round brackets for the translation, followed by a colon, then another round bracket-enclosed 3d vector for the orientation, as shown below. 0`2`4 is the translation, and 1.2`2`2 is the orientation (we have to use backticks because the comma is already used here for separating each index value).
Example: values "(0`2`4):(1.2`2`2),(0`0`0):(0`0`0)"
  • For mesh-attachment-type mesh-animation-speed, the value is the speed of the animation for that index
  • For mesh-attachment-type mesh-animation-loop, the value will be an integer bool (0 or 1) to indicate whether to start the loop, or stop it. You can create a separate property that controls the mesh-animation-speed, and link it via a HowTo/WagonX - Technical Reference#child-properties property to control the speed of the loop.
  • For mesh-attachment type mesh-animation-frame, the value is the frame of the animation to jump to. Setting it to -1 will put that index at the last animation frame in the mesh (see GetMeshAnimationFrameCount).
Example: values "0,30"
  • For mesh-attachment-type mesh-animation-loop, the value can be 0 or 1, to start/stop the loop
  • For kind sound-script, the value can be 0 or 1, to start/stop the soundscript event
  • For kind config-edit, the value is a string indicating the string value to assign to the config tag.
  • For kind particle-effect:
  • For particle-effect-type pfx-message, the value follows the same rules for pfx messages.
  • particle-effect-type "pfx-message"
Example: values "+0+1,-1-0"
  • For kind fx-replacement:
  • For fx-replacement-type texture-replacement, the comma and/or. semicolon-separated values represent the index in the texture-group asset to find the texture. Setting the first value to 1 will reference the texture index 1, shown in the partial config for a textures asset below:
Values “0,2,1” will reference the textures in the texture container at indexes 0, 2, and 1, in that order when cycled through.
Example: values “0,2,1”
kuid          <kuid:1234:123456>
username      "test texture group asset"
trainz-build  4.6
description   "test texture group"
textures
{
  0           "textures\0albedo.texture"
  1           "textures\1albedo.texture"
  2           "textures\2albedo.texture"
  3           "textures\0parameter.texture"
  4           "textures\1parameter.texture"
  5           "textures\2parameter.texture" 
  6           "textures\0normal.texture"
  7           "textures\1normal.texture"
  8           "textures\2normal.texture"         
}


  • For fx-replacement-type texture-replacement-texture, the comma and/or semicolon-separated values are the names of the files (ideally without the path or extension) to be referenced at that index.
Example: values "images/congleton.texture,images/burntisland.texture,images/buxton.texture,images/none.texture"
If you have the same path (and same extension) for all your files, you can greatly reduce the clutter by just specifying the path and extension once using the files-path tag. So, in this case the values entry would be:
Example: values "congleton,burntisland,buxton,none"
     0
     {
       enabled                    1
       property-visibility        1
       name                       "Workflow Text: "
       property-id                "p_workflow"
       description                "Sets the Workflow"
       kind                       "fx-replacement"
       fx-replacement-type        "texture-replacement-texture"
       consist-property-sync      1
       meshes                     "null"
       effects                    "texture-extra"
       asset                      "null"
       files-path                 "images/,.texture"
       values                     "congleton,burntisland,buxton,none"
       default-index              0
       trigger                    "user"
       display-type               "list"
       display-values             "Congleton,Burntisland,Buxton,None"
     }

default-index

Type: Integer (-1 = random)
Example: default-index 0
Compulsory: No
Default: 0
Desc: The default index for the property to start at. This will be 0 if the tag is left out. If it is -1, it will choose a random index to start at.

sound-triggers

Type: String - (a list of strings)
Example: sound-triggers "bell_1,bell_2"
Compulsory: No
Default: None
Desc: For kind sound-script only. This specifies the soundscript trigger(s) (comma separated) that this property will start/stop when the property is activated.

trigger

Type: String
Example: trigger "user"
Compulsory: No
Default: Null (ignored)
Desc: The event that will trigger/activate this property. Can be either an external event, such as a coal-loading animation, or a user-controlled event, or both. Setting it to none is useful if this is a HowTo/WagonX - Technical Reference#child-properties property of another property. Possible values are:
  • user
  • event
  • both
  • none

events

Type: String - (a list of strings)
Example: events "handbrake-release,handbrake-apply"
Compulsory: No
Default: None
Desc: For trigger kind “event” only. An array of the event(s) that must take place for the property value at the index to activate. Can be one of the following (separated by forward slashes and commas to save space).
  • begin-load/end-load/begin-unload/end-unload
  • handbrake-apply/handbrake-release
  • trainbrake-apply/trainbrake-release
  • headlight-on, headlight-off
  • horn
  • bell
  • sanding
  • pantograph-state-0/1/2/3 (see GetPantographState)
  • weather-0/1/2/3/4/5/6/7 (see GetWeatherType)
  • world-day/world-night
  • queue-(0 - ?)- loaded/empty (e.g. queue-0-loaded, queue-1-empty)
Type: String
Example: display-type "link"
Compulsory: No
Default: None
Desc: For trigger type “user” and “event” only. The type of button this will be. It can be any of the trainz property browser value types, plus “manual”, but not map-object or asset-list. For trainzbuild 5.1 and 5.0, only link is supported for the View Details page. Omitting this tag in combination with property-visibility set to 0 is useful for non-user triggers, such as world or train events.
  • string
  • int
  • float
  • list
  • link

display-values

Type: String - (a list of strings)
Example: display-values "Clean,Weathered,Dirty"
Compulsory: No
Default: None
Desc: For trigger type “user” and “event” only, and required for trigger type “user” properties to work, but optional for trigger type “event”. A list of comma-separated values which will be displayed in the view details page for the respective property. The number of values here must match the number of values in the “values” tag.


Copyright Notice

Much of the content on this page and child pages was derived from Dundun92's original Google Docs document. Permission was granted to use that information here.

Personal tools