https://online.ts2009.com/mediaWiki/api.php?action=feedcontributions&user=Pcas1986&feedformat=atomTrainzOnline - User contributions [en]2024-03-29T10:49:56ZUser contributionsMediaWiki 1.19.1https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Browser_Properties_Examples_and_Basic_TutorialsHowTo/WagonX - Browser Properties Examples and Basic Tutorials2024-03-05T01:00:15Z<p>Pcas1986: Added an example of a multiple mesh toggle with a child property.</p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/WagonX - Browser Properties Examples and Basic Tutorials--><br />
<span style="color: red; font-weight: 700; font-size: 15px;">Please note: Much of this page still needs some validation. If you find issues then please contact PCAS1986 in the Trainz Forums or in the Trainz Discord Server.</span><br />
<br />
= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several pages. This page contains some example WagonX config containers and basic guidance for setting up those containers. Other pages in the series are listed below:<br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Technical Reference]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
# [https://docs.google.com/document/d/1jd5nZNQJI_gKQp-X2GjNCBij9fZGAwgJy_BgBiXf3_8/edit#bookmark=id.kupvwsc34hnk| The asset author's documentation]<br />
<br />
= General Comments =<br />
Most of the notes and examples here are for Version 1 but WagonX continues to be developed. Features and/or changes for versions later than V1 are identified in the text.<br />
<br />
__TOC__<br />
<br />
=Browser property tutorials=<br />
<!--start of Browser property example--><br />
This tutorial takes you each step of creating a simple mesh toggle example. It is for a handbrake mesh, including animation, that the user may want to show (make visible) or hide (make invisible). We will add each property tag and explain its purpose.<br />
It may be useful to have the [[HowTo/WagonX - Technical Reference|WagonX Technical Reference]] page open in a browser to examine details of the various tags.<br />
<table width=1200><tr><td> <br />
==Creating a basic mesh toggle==<br />
*Start with an empty browser-properties container like this:<br />
<br />
browser-properties<br />
{<br />
}<br />
<br />
*Add an empty property container and name it "0". The names are not used but should be unique. When we add more properties, you should name them “1”, “2”, “3”, etc.<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
}<br />
}<br />
<br />
*There is no order required for each property, but using a standard order makes it easier to follow. Each tag is hyperlinked to the browser-property, so you can see more information about it.<br />
The first tag to add is [[HowTo/WagonX - Technical Reference#enabled|enabled]]. This determines whether or not the property is activated. Set it to 1, since we want our property to work in-game.<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
}<br />
}<br />
<br />
*Set the visibility of the property using [[HowTo/WagonX - Technical Reference#property-visibility|property-visibility]] and make that 1. Note this value is an integer and doesn't require quotes around it. A value of 1 makes the property visible in both Surveyor and Driver. See the reference for other available values.<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
}<br />
}<br />
<br />
*Set the [[HowTo/WagonX - Technical Reference#name|name]] of our property. The name will appear before the [[HowTo/WagonX - Technical Reference#display-values|display-values]], which we will get to in a moment. You also will want to add a space at the end; otherwise, the property name and display-value will appear as one word.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
}<br />
}<br />
<br />
*Set the [[HowTo/WagonX - Technical Reference#property-id|property-id]], which can be anything as long as it is unique and doesn't contain [[HowTo/WagonX - Technical Reference#Restricted_Characters|restricted characters]]. Trainz will use this to identify this property.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_meshToggle"<br />
}<br />
}<br />
<br />
*Set the [[HowTo/WagonX - Technical Reference#description|description]]. This will appear as the tool-tip when you hover over a browser-property.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_meshToggle"<br />
description "Toggles the mesh"<br />
}<br />
}<br />
<br />
*Set the property [[HowTo/WagonX - Technical Reference#kind|kind]]. Since we want a mesh-attachment kind, we must also specify the [[HowTo/WagonX - Technical Reference#mesh-attachment-type|mesh-attachment-type]] which for this application is mesh-toggle.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_meshToggle"<br />
description "Toggles the mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
}<br />
}<br />
<br />
*Now add a [[HowTo/WagonX - Technical Reference#meshes|meshes]] tag to specify what mesh we want to toggle. The mesh name must exist in the config mesh-table. We will use the script author's prestwins handbrake lever for this demo.<br />
<br />
Here is part of the config mesh-table:<br />
handbrake-lever<br />
{<br />
mesh "mesh/handbrake.lm"<br />
anim "mesh/handbrake_scene.kin"<br />
auto-create 1<br />
att-parent "default"<br />
}<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
}<br />
}<br />
<br />
*Add the [[HowTo/WagonX - Technical Reference#values|values]] tag. This determines what the state of the object will be at each index. The values tag varies depending on the kind and, since this is a toggle, we want a true (1) or false (0) value. For kind mesh-toggle, we set it at 0 to hide the mesh, and 1 to show the mesh. Each index is comma separated, so we will set the first one at 1, and the second one at 0.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
}<br />
}<br />
<br />
*Add the [[HowTo/WagonX - Technical Reference#default-index|default-index]]. This is an integer value starting from 0 and which indicates the position in a list. 0 is the first in the list, 1 is the second, and so on. <i>(The reasons for this are somewhat historical but also based on how computers find things in memory.)</i> If we set it to 1, it will start at the second comma-separated values tag which is "0". If we set it at -1, it will pick a random index within the size of the values tag.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
}<br />
}<br />
<br />
*Add the [[HowTo/WagonX - Technical Reference#trigger|trigger]] tag. We want our property to activate when a user presses a button on the properties page, so we will set it to <b>user</b>. If we set it to <b>event</b>, however, we could make it activate based on an event within the train or in the world, such as handbrake apply, or enabling it when it gets dark, and disabling it when its daytime again, but for now, we will leave it at user.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
trigger "user"<br />
}<br />
}<br />
<br />
*Specify the [[HowTo/WagonX - Technical Reference#display-type|display-type]]. Looking at the options, we see that <b>link</b> is what we want.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
}<br />
}<br />
<br />
*Finally, the last tag we need is the display-values tag, which we talked about earlier. Since we have two states for our property (specified in the values tag), we will create two comma-separated values for each state. We will call the first “Enabled”, and the second “Hidden”, which corresponds with the numbers we set in the values tag.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "Enabled,Hidden"<br />
}<br />
}<br />
<br />
And that's it! Run the asset into trainz, and when you view the properties, you should see your property appear:<br><br />
<br />
<!--Insert pic of View Details with suitable property shown--><br />
[[File:Toggle_handbrake_mesh_in_View_Details.jpg]]<br />
<br />
And when you click on the underlined part of your property, the property should change to “Hidden”, as we specified, and the handbrake on the underframe should disappear.<br><br />
[[File:Handbrake_mesh_show_%26_hide.jpg]]<br />
<br />
</td></tr></table><br />
<br />
= Browser-Property Examples =<br />
== User-Triggered Properties ==<br />
Here are a number of examples for user triggering - i.e. in the View Details property browser. Detailed information on the property browser tags can be found on the [[HowTo/WagonX - Reference|WagonX Reference]] page.<br />
<!--start of mesh toggle property example--><br />
<table width=1200><tr><td><br />
===Mesh-toggle property===<br />
This property allows you to show or hide a mesh that is in the config mesh-table. The values are 0 and 1 to represent false and true. The default is 0 or hidden when first placed.<br />
<br />
{<br />
enabled 1 <br />
property-visibility 1<br />
name "Toggle: "<br />
property-id "p_toggle"<br />
description "Hide or display the roof mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "roof"<br />
values "0,1"<br />
duration 3 <br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "Hidden,Visible"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of texture-replacement property example--><br />
<table width=1200><tr><td><br />
===texture-replacement property===<br />
This allows the choice of a texture from either local texture files (i.e. contained within the asset), or from a texture group asset, to retexture or reskin a mesh. You could use it for swapping between clean, dirty or weathered textures, logos and also entire liveries. <br />
</td></tr></table><br />
<br><br />
<br />
<!--start of texture replacement using local texture files example--><br />
<table width=1200><tr><td> <br />
====Texture replacement using local texture files====<br />
<br />
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. The values tag will contain a list of texture(.txt) files including a folder name if used. This is an example of three textures.<br />
<br />
values "images/congleton.texture,images/burntisland.texture,images/buxton.texture,images/none.texture"<br />
<br />
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. See the files-path and values usage below. Note that the display-values tag contains similar information but that is for the user to see.<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Workflow Text: "<br />
property-id "p_workflow"<br />
description "Sets the Workflow"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
consist-property-sync 1<br />
meshes "null"<br />
effects "texture-extra"<br />
asset "null"<br />
files-path "images/,.texture"<br />
values "congleton,burntisland,buxton,none"<br />
default-index 0<br />
trigger "user"<br />
display-type "list"<br />
display-values "Congleton,Burntisland,Buxton,None"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of texture replacement using a texture-group example--><br />
<table width=1200><tr><td> <br />
====Texture replacement using a texture-group library asset====<br />
You will need to specify the texture group asset in the kuid-table and give it a name such as "texturelib" or "gwrtexturelib", The name should not have any spaces or other special characters.<br />
This property container is set up to allow for three different variations of the the material used for the asset. They are named in the "display-values" tag as Skin 1, Skin 2, and Skin 3. <br />
Since it is a PBR material there are three textures used in the materail: the albedo, parameters, and normal. The normal texture is common to all three versions so it need not be changed.<br />
The "values" tag contains six numbers which are the numbers of the textures in the texture-group asset. For Skin 1 the "12" refers to the albedo texture, and the "15" refers to the parameter texture. "13" and "16" are the pair for Skin2, and "14" and "17" are the pair for Skin 3.<br />
The "effects" tag contains the texture effect names for meshes in the mesh-table.<br />
<br><br />
<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Weathering: "<br />
property-id "p_skin"<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
effects "texture-albedo,texture-parameter"<br />
asset "texturelib"<br />
files-path "null"<br />
values "12;15,13;16,14;17"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin 1,Skin 2,Skin 3"<br />
}<br />
</td></tr></table><br />
<br />
== User-Triggered Properties with Child Properties ==<br />
In some situations it isn't possible to make changes with just one property. WagonX can achieve multiple related changes using a child property. A parent can have one or more children but a child cannot have another child property. <br />
The parent child relationship works by the parent passing the choice made by either the user or an event to the child. So, if a user has chosen option 2 in the parent then the value 2 is passed to the child.<br />
<br />
Here are a number of examples:<br />
<!--start of mesh toggle property with child example--><br />
<table width=1200><tr><td><br />
===Mesh-toggle property with child property===<br />
<br />
In this instance a car has the option of three different bogies: two "4 wheel" bogies and a "6 wheel bogie". For this to work all the relevant bogie meshes must be contained in the one bogie asset.<br />
This is the parent property:<br />
<br />
7 {<br />
enabled 1<br />
property-visibility 1<br />
name "Bogie type: "<br />
description "Swap between Gresley, Wolverton and Pullman bogies"<br />
property-id "p_bogey0"<br />
child-properties "8"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle" <br />
target-asset "bogey-1"<br />
meshes "frame-0,axle0-0,axle0-1,axle0-1,frame-1,axle1-0,axle1-1,axle1-1,frame-2,axle2-0,axle2-1,axle2-2"<br />
values "1;1;1;1;0;0;0;0;0;0;0;0, 0;0;0;0;1;1;1;1;0;0;0;0, 0;0;0;0;0;0;0;0;1;1;1;1"<br />
default-index 0<br />
duration 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "Gresley 4 wheel,Wolverton 4 wheel,Pullman 6 wheel"<br />
} <br />
<br />
The three choices are in the "display-values" tag.<br><br />
The "target-asset" tag contains an identification of the bogey concerned. This name is a special format that should consist of "bogey-" plus the index of the bogey sub containeer in the traincar bogey container. In this case this is bogey number 1.<br><br />
The "meshes" tag contains a list, separated by commas, of the affected meshes. The first four are related to the first choice, the second four for the second choice, and the final four are for the last choice.<br><br />
The "values" tag contains three sets of boolean (false/true) values that indicate whether the related meshes in the meshes tag should be shown (1) or hidden (0). For each set we need a boolean value for each mesh.<br><br />
The "child-properties" tag identifies the child properties by using their property id. In this case we only need one which is property 8.<br />
<br />
This is the child property. It is virtually the same as the parent except for the target-asset, that identifies the second bogie, the trigger that uses the "parent" option, and the removal of several tags that are not needed for a child property.<br />
<br />
8 {<br />
enabled 1<br />
property-visibility 0<br />
property-id "p_bogey1"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle" <br />
target-asset "bogey-0"<br />
meshes "frame-0,axle0-0,axle0-1,axle0-1,frame-1,axle1-0,axle1-1,axle1-1,frame-2,axle2-0,axle2-1,axle2-2"<br />
values "1;1;1;1;0;0;0;0;0;0;0;0, 0;0;0;0;1;1;1;1;0;0;0;0, 0;0;0;0;0;0;0;0;1;1;1;1"<br />
default-index 0<br />
duration 0<br />
trigger "parent"<br />
}<br />
<br />
<!--Insert pic of View Details with above example--><br />
[[File:Swap_Bogies_in_View_Details.jpg]] <br />
</td></tr></table><br />
<br />
== Event-Triggered Properties ==<br />
<!--start of loading-doors property example--><br />
<table width=1200><tr><td><br />
===loading-doorsProperty ===<br />
The ‘meshes’ tag references a mesh-table asset named ‘loading-doors’, and sets the frame to 30 when begin-load is called (to open the doors), and 0 when end-load is called (to close the door). The default index is 0 (the animation frame will be at 0), and the animation duration is 1.5 seconds.<br />
{<br />
enabled 0<br />
property-visibility 0<br />
property-id "p_doors"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "loading-doors"<br />
values "0,30"<br />
trigger "event"<br />
events "end-load,begin-load"<br />
duration 1.5<br />
default-index 0<br />
}<br />
<br />
An alternate way to do it is use mesh-attachment-type "mesh-animation-state", and set a bool int (0 or 1) for the values tag.<br />
{<br />
enabled 0<br />
property-visibility 0<br />
property-id "p_doors"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-state"<br />
meshes "loading-doors"<br />
values "0,1"<br />
trigger "event"<br />
events "end-load,begin-load"<br />
default-index 0<br />
}<br />
<br />
If you want two doors to open at the same time, instead of creating another property, you can use a semicolon split in the values tag to change two in a single property:<br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "door-1,door-2"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.0<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of Weather-Based property example--><br />
<table width=1200><tr><td> <br />
===Weather-Based Texture Replacement===<br />
The texture effect will change based on the weather. It will display a snowy texture when the weather type is 6 (medium snow), a wet, rainy texture when the weather type is 3 (rain), and a dry texture when the weather type is 0.<br />
{<br />
enabled 1<br />
property-visibility 0<br />
property-id "p_weather_skin"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
effects "texture-weather"<br />
files-path "images/,.texture"<br />
values "texture-snow,texture-rain,texture-dry"<br />
default-index 0<br />
trigger "event"<br />
events "weather-6,weather-3,weather-0"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of day and night lights example--><br />
<table width=1200><tr><td> <br />
===Day and Night Light Control===<br />
WagonX Version 1.2 or greater only.<br><br />
This event property controls a set of eight exteruir lights on a traincar that must turn on for night and off for day. It also requires a locomotive at the head of its train for the lights to come on.<br />
<br><br />
The property is a kind fx-replacement of type corona. Turning a corona on and off requires a valid corona to be turned on and usually a null value to turn it off. In this case, instead of a null, we will use an invisible mesh, <kuid:217537:100812>, to achieve the same result. We do this because WagonX needs to obtain an asset from the asset kuid-table.<br><br />
There are two events to consider: the "World, Day" message represented as "world-day", and the "World, Night" message represented as "world-night".<br />
The requirement for a loco requires a conditions tag using the logic described at (insert link when tech ref updated). The results are boolean (false or true) and the first will be true if no loco exists at the head of the train, and the second if there is a loco. So the possible results are "1;0" (no loco) or "1;0" (loco exists) using the WagonX syntax.<br><br />
The effects tag contains a list of the corona effects from the asset mesh-table. Each is separated by a comma.<br><br />
The values tag contains two sets of kuid-table mesh references. Each set is separated by a comma, and the list within each set separated by a semi-colon. The first set turns off the eight coronas when the loco doesn't exist, and the second set turns the coronas on using the same corona asset for each light. You could have different coronas.<br />
{<br />
enabled 1<br />
property-visibility 0<br />
property-id "p_exterior_lights"<br />
kind "fx-replacement"<br />
fx-replacement-type "corona"<br />
duration 0 <br />
effects "leftlight-0,leftlight-1,leftlight-2,leftlight-3,rightlight-0,rightlight-1,rightlight-2,rightlight-3"<br />
values "nl;nl;nl;nl;nl;nl;nl;nl,exla;exla;exla;exla;exla;exla;exla;exla" <br />
trigger "multiple"<br />
conditions "tra_frontmost-locomotive|==|0,tra_frontmost-locomotive|==|1"<br />
events "world-day,world-night<br />
}<br />
...<br />
kuid-table {<br />
...<br />
exla <kuid:104722:100> // a white corona<br />
nl <kuid:217537:100812> // an invisible mesh<br />
} <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
===Day and Night Interior Control===<br />
WagonX Version 1.2 or greater only.<br><br />
This example controls the visibility of day and night traincar interiors using the "World, Day/Night" messages. The night interior will not show unless a locomotive is at the head of the traincar's train.<br><br />
{<br />
enabled 1<br />
property-visibility 0<br />
property-id "p_interior_lighting"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "day-interior,night-interior"<br />
values "1;0,0;1"<br />
default-index 0<br />
duration 0<br />
trigger "multiple"<br />
conditions "tra_frontmost-locomotive|==|0,tra_frontmost-locomotive|==|1"<br />
events "world-day,world-night"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of discussion about use of semicolons--><br />
<table width=1200><tr><td> <br />
== Using semicolons to set multiple values in one property ==<br />
When assigning values for a certain property, you will specify the mesh/effect/sound, etc that needs to be edited, and specify how you want to manipulate it (fx-replacement-type, mesh-attachment-type, etc), and set the value for a certain index. For example, In a texture replacement where a texture is being replaced by an external texture-group asset, the property would look something like this.<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin_parameter"<br />
description "Sets The Texture"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "texture-albedo"<br />
asset "texturelib"<br />
values "1,2,3,4"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin1,Skin2,Skin3,Skin"<br />
}<br />
<br />
As you can see, the comma-separated numbers in the “values” tag indicate the index in the texture-group asset to find the texture; here are the first few lines for that. Texture indexes 0, 1, 2, and 3 are referenced for the albedo texture types, since we have 4 weathering types.<br />
<br />
kuid <kuid2:661805:500009:0><br />
username "BR GrainHop Texture Group"<br />
kind "texture-group"<br />
trainz-build 5.0<br />
category-class "JO"<br />
author "dundun92"<br />
contact-email "jbvector93@outlook.com"<br />
description "A texture group for my GrainHop wagons"<br />
textures<br />
{<br />
0 "270cgo/0albedo.texture"<br />
1 "270cgo/1albedo.texture"<br />
2 "270cgo/2albedo.texture"<br />
3 "270cgo/2albedo.texture"<br />
4 "270cgo/0parameter.texture"<br />
5 "270cgo/1parameter.texture"<br />
6 "270cgo/2parameter.texture"<br />
.........<br />
}<br />
<br />
We specified the texture-group library in the kuid table, and referenced it in the “asset” tag.<br />
kuid-table<br />
{<br />
acslib <kuid2:60850:89100><br />
meshlib <kuid2:661805:500002><br />
texturelib <kuid2:661805:500009><br />
lamp <kuid2:661805:500003><br />
enginespec <kuid2:368699:50064><br />
bogie <kuid2:661805:400003><br />
}<br />
<br />
And then we specified the effect we wanted to change, (currently just the texture-albedo), inside the “effects” tag (this is not the effects tag below in this mesh table asset, but rather the one in the browser-properties at the top of this section!).<br />
body<br />
{<br />
mesh "mesh/body.lm"<br />
auto-create 1<br />
att-parent "default"<br />
effects<br />
{<br />
texture-albedo<br />
{<br />
kind "texture-replacement"<br />
texture "covhopp-1_albedo.texture"<br />
}<br />
texture-normal<br />
{<br />
kind "texture-replacement"<br />
texture "covhopp-1_normal.texture"<br />
}<br />
texture-parameter<br />
{<br />
kind "texture-replacement"<br />
texture "covhopp-1_parameter.texture"<br />
}<br />
}<br />
}<br />
<br />
But say you want to replace the normal map as well. You would probably just create another browser property and specify the proper index for the normals.<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin_parameter"<br />
description "Sets The Paramenter Texture"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "texture-albedo"<br />
asset "texturelib"<br />
values "1,2,3,4"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin1,Skin2,Skin3,Skin4"<br />
}<br />
1<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin_normal"<br />
description "Sets The Normal Texture"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "texture-normal"<br />
asset "texturelib"<br />
values "7,8,9,10"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin1,Skin2,Skin3,Skin4"<br />
}<br />
<br />
But we can't forget the parameter map… that will require a third property. What's worse, we will now have three different properties in the view details page that will each have to be clicked on to change each map! Assigning properties this way can get tedious and create extra clutter in the config. Thankfully, for properties that share the same kind and type, it can all be done in a single property using semicolons:<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin"<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
<b>effects "texture-albedo,texture-parameter,texture-normal"</b><br />
asset "texturelib"<br />
files-path "null"<br />
<b>values "0;4;8,1;5;9,2;6;10,3;7;11"</b><br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
<b>display-values "Clean,Weathered,Dirty,Rusty"</b><br />
}<br />
<br />
Take note of the three tag entries above: the <b>effects</b>, <b>values</b> and <b>display-values</b> tags. The <b>display-values</b> tag is what the user sees and can choose from. Our interest is in the remaining two tags as shown below:<br />
<br />
effects "texture-albedo,texture-parameter,texture-normal"<br />
values "0;4;8,1;5;9,2;6;9,3;7;11" <br />
<br />
There are four user options and, since each option requires three textures, the total number of textures is 12. The <b>values</b> tag contains a string of four groups of texture numbers separated by a comma. Within each texture group the texture numbers are delimited by a semi colon.<br />
<br />
To clarify, we can list the three textures associated with each user choice:<br />
<br />
0;4;8 -> Clean<br />
1;5;9 -> Weathered<br />
2;6;10 -> Dirty<br />
3;7;11 -> Rusty<br />
<br />
The first column of 0,1,2,3 identify the albedo textures. The second column of 4,5,6,7 identify the parameters textures, The third column of 8,9,10,11 identify the normal textures. Note that the numbers do not need to be in sequence or even consecutive. All those numbers do is to identify the correct texture in the texture-group asset.<br />
<br />
<br />
This system works for other kinds of properties, too. In this case, we are setting the animation frame of both the handbrake-lever, and braking system at the same time using the same property (triggered by the same event).<br />
<br />
1 <br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "handbrake-lever,braking-system"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.2<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
<br />
</td></tr></table><br />
<br />
<!--start of discussion about Naming ACS mesh-table attachments--><br />
<table width=1200><tr><td> <br />
== Naming ACS mesh-table attachments ==<br />
Please refer to this page on the ACS coupling system for setting up the “active-coupling-standard-60850” extensions container (which will be required for the ACS coupling to work): [[ACS_Coupling_System|ACS Coupling System]]<br />
<br />
These are the mesh-table naming conventions you must use for the beginning of the name of each ACS attachment mesh. The others will vary depending on the “animated” property above. <b>You must spell them exactly as shown below</b>.<br />
<br />
*coupler<br />
*gangway<br />
*airbrake<br />
*vacbrake<br />
*multiworking<br />
*heating<br />
*rch<br />
<br />
If the “animated” tag in the acs container (see [[HowTo/WagonX_-_Technical_Reference#ACS|acs]]) is set to 1, then the naming is quite simple. It's one of the 7 callbacks above + a dash + “<i>front</i>” or “<i>back</i>”. The anim tag must be present to specify the animation for it. Frame 0 is the uncoupled state, and the last frame is the coupled state. This setup is shown below:<br />
<br />
coupler-front<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-animated.lm"<br />
anim "coupler-screwlink-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
coupler-back<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-animated.lm"<br />
anim "coupler-screwlink-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
vacbrake-front<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-animated.lm"<br />
anim "vacbrake-single-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-back<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-animated.lm"<br />
anim "vacbrake-single-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
<br />
If, however, you do not want to use animations, but want to use separate meshes for each state (coupled and uncoupled), it gets a bit more complicated. The naming will follow the same as above at first, but you must add a third piece to it to specify the exact type of ACS attachment this is. The information on what to put there is originally from the [[ACS_Coupling_SystemACS Coupling System|ACS page]], but the 7 callbacks have been added plus the sub-callback here to make it easier (the third callback options are the ones with a delta symbol &Delta; ). And for the uncoupled state, the third callback is “non” (e.g. coupler-front-screwlink, and coupler-front-none).<br />
<br />
*coupler<br />
:*front/back<br />
::&Delta; "<b>hook</b>" -- connects to screwlink/instanter/3link/hst-emergency-bar.<br />
::&Delta; "<b>3link</b>" -- connects to hook.<br />
::&Delta; "<b>instanter</b>" -- connects to hook.<br />
::&Delta; "<b>screwlink</b>" -- connects to hook.<br />
::&Delta; "<b>hst-emergency-bar</b>" -- connects to hook.<br />
::&Delta; "<b>bar-full</b>" -- connects to "bar-none". Half of a handed pair for when one vehicle has the entire bar coupling.<br />
::&Delta; "<b>bar-none</b>" -- connected to by "bar-full". The other half of the handed pair.<br />
::&Delta; "<b>bar</b>" -- connects to self only. Used when both vehicles have half the bar coupling.<br />
::&Delta; "<b>knuckle</b>" - standard knuckle coupler.<br />
::&Delta; "<b>tightlock</b>" -- different from a standard knuckle, refers to a knuckle style coupler often fitted to multiple unit trains that also include electrical connections.<br />
::&Delta; "<b>wedgelock</b>" -- London Underground coupler.<br />
::&Delta; "<b>bsi</b>" -- Found on Sprinter DMUs and derived designs.<br />
::&Delta; "<b>dellner</b>" -- Also compatible with Scharfenberg coupling.<br />
::&Delta; "<b>scharfenberg</b>" -- Also compatible with dellner coupling.<br />
::&Delta; "(<b>other string identifier</b>)" -- Any string that is not recognized from the above list is assumed to be a symmetrical meet-in-the-middle type of coupler.<br />
::&Delta; “<b>none</b>”<br />
::Examples: <b>coupler-front-instanter</b>, coupler-back-none<br />
<br />
*gangway<br />
:*front/back<br />
::&Delta; <b>rubbing-plate</b><br />
::&Delta; <b>gangway</b><br />
::&Delta; <b>none</b><br />
::Example: <b>gangway-front-gangway</b><br />
<br />
*airbrake<br />
:*front/back<br />
::&Delta; <b>twin</b><br />
::&Delta; <b>single</b><br />
::&Delta; <b>none</b><br />
::Example: <b>airbrake-back-none</b><br />
<br />
*vacbrake<br />
:*front/back<br />
::&Delta; <b>twin</b><br />
::&Delta; <b>single</b><br />
::&Delta; <b>high</b><br />
::&Delta; <b>none</b><br />
::Example: <b>vacbrake-back-twin</b><br />
<br />
*multiworking<br />
::front/back<br />
::&Delta; "(color)-(shape)" -- e.g. "<b>blue-star</b>" or "<b>red-diamond</b>", etc<br />
::&Delta; "<b>AAR</b>" -- as used on GM locos<br />
::&Delta; "<b>SR27</b>" -- bagpipes<br />
::&Delta; "(other identifier string e.g. classname)"<br />
::Example: <b>multiworking-front-blue-square</b><br />
<br />
*heating<br />
::front/back<br />
::&Delta; "<b>none</b>"<br />
::&Delta; "<b>steam</b>"<br />
::&Delta; "<b>electric</b>"<br />
::&Delta; "<b>dual</b>"<br />
::&Delta; "<b>southern-electric</b>" <br />
::Example: <b>heating-back-steam</b><br />
<br />
*rch<br />
::front/back<br />
::&Delta; "<b>high</b>"<br />
::&Delta; "<b>low</b>"<br />
::&Delta; "<b>none</b>"<br />
::Example: <b>rch-back-high</b><br />
<br />
And an example how it would look inside a config.txt. The back attachments have been omitted for brevity. <br />
<br />
coupler-front-screwlink<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-coupled.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
coupler-front-none<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-retracted.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-front-single<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-coupled.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-front-none<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-retracted.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
<br />
<table width=1200><br />
=Copyright Notice=<br />
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.<br />
</table></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Swap_Bogies_in_View_Details.jpgFile:Swap Bogies in View Details.jpg2024-03-05T00:54:58Z<p>Pcas1986: Used in WagonX documentation examples</p>
<hr />
<div>Used in WagonX documentation examples</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Technical_ReferenceHowTo/WagonX - Technical Reference2024-03-05T00:13:04Z<p>Pcas1986: /* trigger */</p>
<hr />
<div><table width=1200><tr><td><br />
= Document Structure =<br />
<br />
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:<br />
<br />
# [[HowTo/Use the WagonX Library|How to use the WagonX library]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials|WagonX Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial|WagonX Traincar Tutorial]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial|WagonX Locomotive Tutorial]]<br><br />
</tr></td></table><br />
<br />
__TOC__<br />
<br />
<table width=1200><tr><td><br />
= The WagonX Reference =<br />
<br />
This page contains details of the WagonX extension container and sub-containers. Links to examples of use will be provided when available.<br />
</td></tr></table> <br />
<br />
<table width=1200><tr valign="top"><td><br />
= Restricted Characters =<br />
<br />
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. See also [[#display-values|display-values]].<br />
<br />
*Comma ( , ) <br />
*Semicolon ( ; ) <br />
*Backtick/Grave ( ` )<br />
*Colon ( : )<br />
*Caret ( ^ ) <br />
*Round brackets ( and )<br />
</td></tr></table><br />
<br />
<table width=1200><tr valign="top"><td><br />
== Using commas and semi-colons in a list ==<br />
WagonX uses commas to identify items in a list. Some examples might be "1,2,3,4"for a list of four integers, "Rita, Rose, Ruth" of three nameboards for a Pullman car, and "0,1" for a list of booleans (false and true).<br><br />
Semi-colons are used to items in a set, where sets are items in a list. Le's say we have three sets each consisting of integer numbers,then we might use something like "1;2;3;4,9;3;6;5,13;12;15;16". The first set is 1,2,3 and 4, the second set 9,3,6 and 5, and the last 13,12,15 and 16.<br />
<br>This notation is common where we might want apply some value to items in a set. For example, our sets might each consist of four meshes for a car to which we want to apply a particular livery. List such as these are commonly used in the [[#values|values]] tag.<br />
<br>See also [[WagonX_-_Browser_Properties_Examples_and_Basic_Tutorials#Using_semicolons_to_set_multiple_values_in_one_property|Using semicolons to set multiple values in one property]].<br />
</td></tr></table><br />
<br />
<table width=1200><tr valign="top"><td><br />
== Using the grave symbol in a list ==<br />
The backtick or grave symbol allows you to set multiple variables on a single function in one property. It's typically used to set the value for all the parameters in the pfx emitter functions. It's also used for mest-attachment-type mesh-translation-orientation parameters.<br />
For example, if you want to set the start color with these values (0,0,128,128,128,64), but you want each of those variables to be set in one property then use "0`0`128`128`128`64".<br />
You can also use this symbol to populate your set of parameters with variables such as "veh_velocity|/|2`veh_velocity|+2`veh_velocity|-|loc_abs_reverser". In simple english that means the first parameter is the vehicle velocity divided by 2, the second parameter is the vehicle velocity plus 2, and the final parameter is the vehicle length minus the absolute value of the loco reverser. Hmm, that doesn't make a lot of sense but its only an example.<br />
</td></tr></table><br />
<br />
<table width=1200><tr valign="top"><td><br />
== Other special characters ==<br />
Caret - The caret/circumflex symbol (^) is a math power operator. It can be used in variables.<br><br />
Round Brackets - Round brackets are used to group mesh vectors translation and orientation. In this instance, colons are used to separate the vectors. For example, "(0`2`4):(1.2`2`2),(0`0`0):(0`0`0)". See [[#values|values]].<br><br />
Colon - See Round Brackets above.<br />
</td></tr></table><br />
<br />
<table width=1200><tr valign="top"><td><tr><br />
= General Layout =<br />
<br />
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:<br />
extensions<br />
{<br />
max_permitted_speed-60850 "50mph"<br />
active-coupling-standard-60850<br />
{<br />
...<br />
}<br />
wagon-x<br />
{<br />
...<br />
}<br />
}<br />
</td></tr></table><br />
<br />
<table width=1200><tr valign="top"><td><br />
= WagonX Properties =<br />
<br />
There are currently four standard or "top level" WagonX containers that define properties for Marker Lights,text-x, 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.<br />
</td></tr></table><br />
<br />
<br />
<!--start of ACS table--><br />
<table width=1200><tr><td><br />
== ACS ==<br />
For help on creating the acs extensions and setting up the acs mesh-table objects, see [[HowTo/WagonX_-_Browser_Properties_Examples_and_Basic_Tutorials#Naming_ACS_mesh-table_attachments|Naming ACS mesh-table attachments]].<br />
<br><br />
Each tag is shown here with sample values. There are no default values.<br />
<br />
acs<br />
{<br />
animated 1<br />
use-jbv-animation 1<br />
duration 1.0<br />
}<br />
<br />
*<b>animated (1 = true, 0=false)</b><br />
:This determines whether to use animations to move between the coupled and uncoupled state, or use individual static assets for each state.<br />
*<b>use-jbv-animation (1 = true, 0=false)</b><br />
: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.<br />
*<b>duration (a floating point value)</b><br />
: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)<br />
*<b>buffer-length-front float</b><br />
:The distance between a.couple0 and a.limfront in meters. To be used with the jbv animation system. Requires the ‘use-jbv-animation’ tag to be set to 1<br />
*<b>buffer-length-back float</b><br />
:The distance between a.couple1 and a.limback in meters. To be used with the jbv animation system. Requires the ‘use-jbv-animation’ tag to be set to 1<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
== text-x ==<br />
<!--start of ACS table--><br />
WagonX V1.2 or greater.<br />
(description yet to be included - ARN and/or headcodes? - validation required)<br><br />
<br />
*<b>controller string</b> <br />
:Determines how the property will be controlled. Can be controlled by the user, the running number, or a custom range. <br />
:::*user<br />
:::*arn<br />
:::*range<br />
*<b>range string</b> <br />
:Defines the range of values the for the text proprety. It will choose a random index to start<br><br />
*<b>value string</b><br />
:The default value for the text property. This can be formated in two ways. For texture files with single-character identifiers, each character can be written together (e.g. “a12d”). For texture files with multiple-character identifiers, each identifier needs to be separated by a comma (e.g. “dot,3,dash,k”).<br><br />
*<b>font int</b><br />
:The default font index for the text property, these values can be changeed by adding a “config-edit” property to the browser-properties.<br />
*<b>files-path string</b><br />
: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.<br><br />
*<b>textures string</b><br />
:The list of texture files to use. The ‘#’ symbol is used by the script as a placeholder identifier for the value input. For example, if it is set to ‘alpha_digit-#’, each letter and number will go where the ‘#’, e.g. If the first chartcher in the value tag is ‘a’, it will look for the texture ‘images/alpha_digit-a.texture’, to use for the first texture effect digit. Each comma separated value coorispinds to the font to use at each index.<br><br />
*<b>effects string</b><br />
:The texture replacement effects to use for displaying the text.<br><br />
<br />
Each tag is shown here with sample values.<br />
<br />
text-x<br />
{<br />
text-properties<br />
{<br />
headcode<br />
{<br />
controller "user"<br />
range "null"<br />
value "2,5,dots,2"<br />
font 0<br />
files-path "images/,.texture"<br />
textures "fd-#"<br />
effects "fdigit-1,fdigit-2,fdigit-3,fdigit-4"<br />
}<br />
}<br />
}<br />
</td></tr></table><br />
<br />
<!--start of Misc table--><br />
<table width=1200><tr><td><br />
== Misc ==<br />
<br />
<!--Note for page author - is this for proper industries such as cargo or is it used for passengers at stations as well?--><br />
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.<br />
<br />
Each available tag is shown here with sample values. There are no defaults.<br />
<br />
misc<br />
{<br />
begin-load-time 5.0<br />
begin-unload-time 5.0<br />
end-load-time 1.0<br />
end-unload-time 1.0<br />
}<br />
<br />
*<b>mobile float</b> <b><i>(added in v1.2)</i></b> <br />
:Setting this to 1 indicates this asset is indended for use on trainz mobile platforms. This will disable and/or compromise certain script features to reduce complexity and improve performance for mobile devices.<br><br />
*<b>update-frequency float</b> <b><i>(added in v1.2)</i></b><br />
:The frequency, in seconds, at which certain event triggered browser-properties are updated. This has a huge impact on performance, and it is best kept as high as possible, ideally 5 or more secconds. The minimum allowed value is 1. If the moible tag is set to 1, the minumum allowed value is 3 secconds.<br />
*<b>begin-load-time (a floating point value)</b><br />
:The time it takes for the wagon to load at an industry<br />
*<b>begin-unload-time (a floating point value)</b><br />
:The time it takes for the wagon to unloading at an industry<br />
*<b>end-load-time (a floating point value)</b><br />
:The time it takes for the wagon end loading at an industry<br />
*<b>end-unload-time (a floating point value)</b><br />
:The time it takes for the wagon to end unloading at an industry<br />
</td></tr></table><br />
<!--end of misc table--><br />
<br />
<!--start of Marker-Lights table--><br />
<table width=1200><tr><td><br />
== Marker-Lights ==<br />
The Marker-Lights container is used to show or hide light meshes that are identied by entries in the config mesh-table.<br />
<br />
Each tag is shown here with sample values. There are no defaults. <br />
<br />
marker-lights<br />
{<br />
enabled 1<br />
car-minimum-count 1<br />
require-locomotive 1<br />
night-only 0<br />
front<br />
{<br />
head<br />
{<br />
mesh "null"<br />
}<br />
tail<br />
{<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back<br />
{<br />
head<br />
{<br />
mesh "lamp-back-white"<br />
}<br />
tail<br />
{<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
<br />
<br />
*<b>enabled (1 = true, 0=false)</b><br />
:Whether or not the marker lights are active on this asset.<br />
*<b>car-minimum-count (an integer number)</b><br />
:The minimum number of cars that must be present in the consist for the marker-lights to activate.<br />
*<b>require-locomotive (1 = true, 0=false)</b><br />
:If set to 1, a traincar of Class locomotive will need to be present in the consist for the marker-lights to activate.<br />
*<b>night-only (1 = true, 0=false)</b><br />
:If set to 1, the lamps will only be visible at night, otherwise they will be displayed 24/7.<br />
*<b>Front/back head/tail containers</b><br />
:These containers identify the mesh to use for the front, back, head, and tail lamps. These meshes must be in the config mesh-table.<br />
</td></tr></table><br />
<!--end of Marker-Lights table--><br />
<br />
<!--start of Browser-Properties container table--><br />
<table width=1200><tr><td><br />
== Browser-Properties ==<br />
<br />
*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.<br />
*A property can have sub properties that are activated with their parent.<br />
*A property container has a number of tags with values. Many are common to different property types but some are unique to a property.<br />
*A container need not contain all available tags.<br />
*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,<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin"<br />
consist-property-sync 1<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
effects "texture-albedo,texture-parameter"<br />
asset "texturelib"<br />
files-path "null"<br />
values "0;3,1;4,2;5"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Clean,Weathered,Dirty"<br />
}<br />
1<br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "handbrake-lever,braking-system"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.2<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
}<br />
</td></tr></table><br />
<br />
<!--start supported tags--><br />
<table width=1200><tr><td> <br />
===Supported Tags===<br />
Tag explanations. Some examples are included in the definition and, for others, see above for sample of usage.<br />
</td></tr></table><br />
<!--end supported tags--><br />
<br />
<!--start asset tag--><br />
<table width=1200><tr><td><br />
====asset====<br />
:Type: String<br />
:Example: asset "texturelib"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The kuid-table asset to be used by the property. Use this for cases where you need to reference another asset, such as a texture-replacement library. Use this tag, the [[#effects|effects]] tag, the [[#meshes|meshes]] tag, or the [[#particle-effects|particle-effects]] tag, but not more than one.<br />
<br />
</td></tr></table><br />
<!--end asset tag--> <br />
<br />
<table width=1200><tr><td> <br />
====child-properties====<br />
:Type: A string of numbers separated by commas.<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: child-properties "2,4,5"<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====conditions====<br />
<b><i>(added in v1.2)</i></b><br />
:Type: String - (a list of strings)<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: For trigger kind “condition”. An array of conditional 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). <br />
::The format in each comma-separated condition is a basic comparison operation with a left side, an operator, and a right side. The left and right sides can either be a variable (listed below), or a number (integer or float). The three parts are separated by a vertical bar. You can add more comparison operations to the same condition by adding an “&” (and) symbol after the first condition, then adding the second comparison operator (shown in the default conditions example above in black)(this is separate from the comma separation). You can add as many “&”s as you want to the operation, however it will get very long very quickly. The operators used are “==” (equals), “>” (greater than), “<” (less than), “>=” (greater than or equal to), “<=” (less than or equal to), and “!=” (not equal to), and must follow that format.<br />
<br />
:::*veh<br />
::::Contains functions used within Class Vehicle. Subclasses can be any of the listed ones below. All of these are derived from [[#Class_Vehicle|Class Vehicle]]. Please refer to that page for information on function behavior and usage.<br><br />
::::<b>example 1: veh_velocity|>=|5&veh_mass>1500 -></b> in plain English this reads, “If vehicle velocity is greater than or equal to 5 m/s and the mass is greater then 1500, then…. do something.<br />
::::<b>example 2: veh_engine-param_main-reservoir-pressure|<|0.5 -></b> in plain English this reads, “If the vehicles engine parameter, ‘main-reservoir-pressure’ is greater than 0.5, then…. do something.<br />
<br />
:::::For float:<br />
::::::*velocity (float)<br />
::::::*abs-velocity (float)<br />
:::::::The absolute value of the velocity, this is useful because moving in reverse will give negative inputs for “velocity”, but positive for “abs-velocity”<br />
::::::*mass (float)<br />
::::::*length (float)<br />
::::::*load-time (float)<br />
::::::*odometer-distance (float)<br />
::::::*trip-meter-distance (float)<br />
::::::*track-gradient (float)<br />
::::::*maximum-tractive-effort (float)<br />
::::::*default-maximum-tractive-effort (float)<br />
::::::*wheelslip-traction-multiplier (float)<br />
::::::*traction-multiplier (float)<br />
::::::*aux-reservoir-pressure (float)<br />
::::::*brake-cylinder-pressure (float)<br />
::::::*brake-pipe-pressure (float)<br />
::::::*cabin-sway-amount (float)<br />
::::::*coupling-stress (float)<br />
::::::*default-cabin-sway-amount (float)<br />
::::::*default-maximum-coupler-compression-stress (float)<br />
::::::*default-maximum-coupler-expansion-stress (float)<br />
::::::*maximum-coupler-compression-stress (float)<br />
::::::*maximum-coupler-expansion-stress (float)<br />
::::::*maximum-couple-velocity (float)<br />
::::::*default-maximum-couple-velocity (float)<br />
:::::For bool:<br />
::::::*coupler-breakage-enabled (bool)<br />
::::::*direction-relative-to-train (bool)<br />
::::::*drain-cocks (bool)<br />
::::::*random-automatic-running-number-support (bool)<br />
::::::*automatic-running-number (bool)<br />
::::::*high-beams (bool)<br />
::::::*is-ditch-flashing (bool)<br />
::::::*automatic-fireman-state (bool)<br />
::::::*interior-light (bool)<br />
::::::*interior-light-state (bool)<br />
::::::*bell-state (bool)<br />
::::::*has-bell (bool)<br />
::::::*in-tunnel (bool)<br />
::::::*on-bridge (bool)<br />
::::::*derailed (bool)<br />
::::::*loaded-this-stop (bool)<br />
::::::*unloaded-this-stop (bool)<br />
:::::For integer:<br />
::::::*engine-type (int)<br />
::::::*vehicle-type-flags (int)<br />
:::::For string:<br />
::::::*running-number (string)<br />
:::::And the engine parameter string:<br />
::::::*engine-param<br />
:::::::The main engine parameter strings you can use with this method are:<br />
:::::::*applied-force<br />
:::::::*brake-cylinder-pressure<br />
:::::::*brake-pipe-pressure<br />
:::::::*current-drawn<br />
:::::::*equaliser-pressure<br />
:::::::*flow<br />
:::::::*horn<br />
:::::::*main-reservoir-pressure<br />
:::::::*max-te<br />
:::::::*no3-pipe-pressure<br />
:::::::*wheelslip<br />
:::::::Values that refer only to steam engines:<br />
:::::::*coal-mass<br />
:::::::*engine-force<br />
:::::::*fire-temperature<br />
:::::::*max-coal-mass<br />
:::::::*max-fire-temperature<br />
:::::::*steam-boiler-liquid-percent<br />
:::::::*steam-boiler-pressure<br />
:::::::*steam-piston-cycle<br />
:::*loc<br />
::::Contains functions used within Class Locomotive. Subclasses can be any of the listed ones below. All of these are derived for Class Locomotive. Please refer to that page for information on function behavior and usage.<br />
::::*engine-setting<br />
:::::*The engine setting, currently the only one for the parent class ‘loc’.<br />
:::::*dynamic-brake<br />
:::::*headlight <br />
:::::*horn<br />
:::::*injector<br />
:::::*loco-auto-brake<br />
:::::*pantograph<br />
:::::*regulator<br />
:::::*reverser<br />
:::::*abs-reverser<br />
:::::*steam-blower<br />
:::::*throttle<br />
:::::*train-auto-brake <br />
:::::*train-lap-brake<br />
:::::*script-brake-pressure<br />
:::*tra<br />
::::For class Train<br />
::::For float:<br />
::::*smoothed-velocity (float)<br />
::::*train-velocity (float)<br />
::::*abs-smoothed-velocity (float)<br />
::::*abs-train-velocity (float)<br />
::::*dcc-throttle (float)<br />
::::*train-brakes (float)<br />
::::*speed-limit (float)<br />
::::*advisory-limit (float)<br />
::::*advisory-limit-2 (float)<br />
::::*ai-train-max-speed (float)<br />
::::For integer:<br />
::::*autopilot-mode (int)<br />
::::*reverser (int)<br />
::::*pantograph-state (int)<br />
::::*classification-signal (int)<br />
::::*train-priority-number (int)<br />
::::*frontmost-locomotive (int-bool)<br />
::::For bool:<br />
::::*allows-user-control (bool)<br />
::::*headlight-state (bool)<br />
::::*ditchlight-state (bool)<br />
::::*bell-state (bool)<br />
::::For string:<br />
::::*train-display-name (string)<br />
::::*owning-client (string)<br />
<br />
:::*wor<br />
::::For class World<br />
::::For float:<br />
::::*camera-yaw<br />
::::*camera-pitch<br />
::::*camera-zoom<br />
::::*game-time<br />
::::*game-season<br />
::::For integer:<br />
::::*weather-type<br />
::::*weather-changeability<br />
::::*camera-mode<br />
::::*camera-flags<br />
::::*game-time<br />
::::*game-year<br />
::::*game-month<br />
::::*game-date<br />
::::*game-session<br />
::::*current-module<br />
::::For string:<br />
::::*local-player-name (string)<br />
::::For bool:<br />
::::*restart-stuck-ai (bool)<br />
::::*asset-restriction-in-effect (bool)<br />
<br />
<!--end conditions--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====consist-property-sync====<br />
:Type: Integer - (0 off, 1 on (button), 2 on (automatic)<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: Whether or not to sync the property within the consist, if a tag with the same [[#property-sync-id|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.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start default-index--><br />
====default-index====<br />
:Type: Integer (-1 = random)<br />
:Example: default-index 0<br />
:Compulsory: No<br />
:Default: 0<br />
: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.<br><br />
Warning: If you have a list of values such as "1,2,3,4" and you want to set a default, then you should subtract 1 from the preferred value. For example if you want the first in the list then set the default to 0. This is because the browser counts the list entries from 0 and not 1.<br />
<!--end default-index--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====description====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The description of this attachment as it will appear in the Properties Browser.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start display-type--><br />
====display-type====<br />
:Type: String<br />
:Example: display-type "link"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>For trainzbuild 5.1 and 5.0, only link is supported for the View Details page.</b> Omitting this tag in combination with property-visibility set to 0 is useful for non-user triggers, such as world or train events.<br />
:::*string<br />
:::*int<br />
:::*float<br />
:::*list<br />
:::*link <br />
<!--end display-type--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start display-values--><br />
====display-values====<br />
:Type: String - (a list of strings)<br />
:Example: display-values "Clean,Weathered,Dirty"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end display-values--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start duration--><br />
====duration====<br />
:Type: Float<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>(There may be issues with using this tag with mesh-toggle.)</b><br />
:Example: duration 3.2<br />
<!--end duration--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start of effects (textures)--><br />
====effects====<br />
:Type: String - (a list of texture names (i.e. texture.txt names without the .txt) each separated by a comma)<br />
:Example: effects "texture-albedo,texture-parameter"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The comma-separated effect(s) to be modified by the property. Only use this tag if you are using [[#kind|kind]] fx-replacement. Use this tag, the mesh tag, or the asset tag, but not more than one.<br />
<!--end of effects--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====enabled====<br />
:Type: Boolean (1 = true, 0=false)<br />
:Compulsory: No<br />
:Default: No default.<br />
:Desc: Whether or not this property is active. This is useful for debugging, or if you want to disable it without removing everything.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start events--><br />
====events====<br />
:Type: String - (a list of strings)<br />
:Example: events "handbrake-release,handbrake-apply"<br />
:Compulsory: No<br />
:Default: None<br />
: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). <br />
:::*begin-load/end-load/begin-unload/end-unload<br />
:::*started-moving/stopped-moving <b><i>(added in v1.2)</i></b><br />
:::*handbrake-apply/handbrake-release<br />
:::*trainbrake-apply/trainbrake-release<br />
:::*headlight-on, headlight-off<br />
:::*throttle-changed <b><i>(added in v1.2)</i></b><br />
:::*front-coupled/back-coupled,front-uncoupled/back-uncoupled <b><i>(added in v1.2)</i></b><br />
:::*view-internal, view-external, view-tracking, view-roaming <b><i>(added in v1.2)</i></b><br />
:::*horn<br />
:::*bell<br />
:::*sanding<br />
:::*pantograph-state-0/1/2/3 (see [[Class_Train#GetPantographState|<span style="color: #0080ff">GetPantographState</span>]])<br />
:::*weather-0/1/2/3/4/5/6/7 (see [[Class_World#GetWeatherType|<span style="color: #0080ff">GetWeatherType</span>]])<br />
:::*world-day/world-night<br />
:::*priority-number-(0 - ∞) (e.g. priority-number-2) <b><i>(added in v1.2)</i></b><br />
:::*arn-(0 -∞ ) (e.g. arn-92220, arn-844) <b><i>(added in v1.2)</i></b><br />
:::*queue-(0 - ∞)- loaded/empty (e.g. <b>queue-0-loaded, queue-1-empty</b>)<br />
<!--end events--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start files-path tag--><br />
====files-path====<br />
:Type: String - (a list of two strings)<br />
:Example: files-path "images/,.texture"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>files-path “images/left/.texture”</b>), where images/left is the path, and .texture is the extension for all the files.<br />
<!--end files-path tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start fx-replacement-type--><br />
====fx-replacement-type====<br />
:Type: String)(kind fx-replacement only)<br />
:Example: kind "fx-replacement"<br />
:::fx-replacement-type "texture-replacement"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The type of fx replacement effect this property will be if the [[#kind|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 [[#values|values]] for instructions on how to implement these properties.<br />
::*[[Class_MeshObject#SetFXTextureReplacement|<span style="color: #0080ff">texture-replacement</span>]]<br />
:::Replaces a texture effect in this asset to one within a texture-group asset.<br />
::*[[Class_MeshObject#SetFXTextureReplacementTexture|<span style="color: #0080ff">texture-replacement-texture</span>]]<br />
:::Replaces a texture effect in this asset to one located within this asset.<br />
::*[[Class_MeshObject#SetFXCoronaTexture|<span style="color: #0080ff">corona</span>]]<br />
:::Replaces a corona effect in the asset.<br />
::*[[Class_MeshObject#SetFXNameText|<span style="color: #0080ff">name</span>]]<br />
:::Replaces a name effect in the asset.<br />
::*[[Class_MeshObject#SetFXAttachment|<span style="color: #0080ff">attachment</span>]]<br />
:::Replaces an attachment effect in the asset.<br />
::*[[Class_MeshObject#SetFXAnimationState|<span style="color: #0080ff">animation</span>]]<br />
:::Plays/Stops an animation effect in the asset.<br />
<!--end fx-replacement-type--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====kind====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The type of property this will be. Can be one of the options below. Most of these are derived from [[Class MeshObject|Class_MeshObject]]. For more info on implementing these, see [[#values|values]].<br />
::*mesh-attachment<br />
:::Manipulate the mesh’s animation, position, visibility, etc. See mesh-attachment-type.<br />
::*fx-replacement<br />
:::Change an effect in the mesh. See [[#fx-replacement-type|fx-replacement-type]].<br />
::*particle-effect<br />
:::Activate/Deactivate/Edit a particle effect (smoke0, smoke1, etc). See [[#particle-effects|particle-effects]] and [[#particle-effect=type|particle-effect-type]].<br />
::*sound-script<br />
:::Used to play a sound-script sound within this asset. See [[#sound-triggers|sound-triggers]].<br />
::*config-edit<br />
:::Used to edit a tag in the wagon-x config soup. See paths.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start meshes--><br />
====meshes====<br />
:Type: String - (a list of mesh names from the mesh-table separated by commas)<br />
:Example: meshes "handbrake-lever,braking-system"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The comma-separated mesh-table asset(s) to be modified by the property. Use this for [[#kind|kind]] mesh-toggle or kind mesh-animation. Use this tag, the effect tag, or the asset tag, but not more than one.<br />
<!--end meshes--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start mesh-attachment--><br />
====mesh-attachment-type====<br />
:Type: String - (kind mesh-attachment only)<br />
:Example: kind "mesh-attachment"<br />
:: mesh-attachment-type "mesh-animation-frame"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
::*[[Class_MeshObject#SetMeshVisible|<span style="color: #0080ff">mesh-toggle</span>]]<br />
:::Toggle between the mesh(s) being visible or hidden.<br />
::*[[Class_MeshObject#SetMeshOrientation|<span style="color: #0080ff">mesh-translation-orientation</span>]]<br />
:::Sets the translation and orientation of the mesh(es)<br />
::*[[Class_MeshObject#SetMeshAnimationFrame|<span style="color: #0080ff">mesh-animation-frame</span>]]<br />
:::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.<br />
::*[[Class_MeshObject#StartMeshAnimationLoop|<span style="color: #0080ff">mesh-animation-loop</span>]]<br />
:::Start or stop an animation-loop on the mesh.<br />
::*[[Class_MeshObject#SetMeshAnimationState|<span style="color: #0080ff">mesh-animation-state</span>]]<br />
:::Sets the state of the mesh(s) animation.<br />
::*[[Class_MeshObject#SetMeshAnimationSpeed|<span style="color: #0080ff">mesh-animation-speed</span>]]<br />
:::Changes the speed of the meshes animation.<br />
<!--end mesh-attachment--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====name====<br />
:Type: String<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: The display name of this property, as will appear on the properties page.<br />
</td></tr></table><br />
<br />
<!--start of particle-effects--><br />
<table width=1200><tr><td><br />
====particle-effects====<br />
:Type: String - (a list of integer numbers as a string)<br />
:Example: particle-effects "0,1"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: For kind particle-effect. The comma-separated list of PFX effects to be modified by the property. See kind for help on implementation. <b>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.</b><br />
<!--end particle-effects--> <br />
</td></tr></table><br />
<br />
<!--start of particle-effect-type--><br />
<!--need to come back and check this as I don't understand how this works--><br />
<table width=1200><tr><td><br />
====particle-effect-type====<br />
:Type: String (kind mesh-attachment only)<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The type of PFX function this property will be if the [[#kind|kind]] tag is set to particle-effect.<br />
Each one is hyperlinked to the corresponding trainzscript function, though it is not necessary to know them. See [[#values|values]] for instructions on how to implement these properties. Most of these are derived for the PFXEmitter properties specified in [[MapObject|Class MapObject]], with the prefix “GetPFXEmitter” omitted. All except [[MapObject#SetPFXEmitterTexture|SetPFXEmitterTexture]] are supported.<br />
:Example: kind "particle-effect"<br />
: particle-effect-type "pfx-message"<br />
:Comments: Needs to be validated with examples!<br />
::*[[pfx_Message|pfx-message]]<br />
:::Send a message to enable/disable a particle effect.<br />
::*[[Class_MapObject#SetPFXEmitterConeSize|cone-size <b><i>(added in v1.2)</i></b>]]<br />
:::Update the cone size with x,y and z sizes in values tag.<br />
::*[[Class_MapObject#SetPFXEmitterEmitParticles|emit-particles <b><i>(added in v1.2)</i></b>]]<br />
:::Update the number of particles and time they will be created.<br />
::*[[Class_MapObject#SetPFXEmitterEndColor|end-color <b><i>(added in v1.2)</i></b>]]<br />
:::Update the end colour of the particles.<br />
::*[[Class_MapObject#SetPFXEmitterStartColor|start-color <b><i>(added in v1.2)</i></b>]]<br />
:::Update the start colour of the particles.<br />
::*[[Class_MapObject#SetPFXEmitterLifetime|lifetime <b><i>(added in v1.2)</i></b>]]<br />
:::Update the emitter lifetime using seconds.<br />
::*[[Class_MapObject#SetPFXEmitterMaxRate|max-rate <b><i>(added in v1.2)</i></b>]]<br />
:::Update the emitter maximum rate per second.<br />
::*[[Class_MapObject#SetPFXEmitterMinRate|min-rate <b><i>(added in v1.2)</i></b><b><i>(added in v1.2)</i></b>]]<br />
:::Update the emitter minimum rate per second.<br />
::*[[Class_MapObject#SetPFXEmitterMaxSize|max-size <b><i>(added in v1.2)</i></b>]]<br />
:::Update the maximum size size of particles. The size is a single float.<br />
::*[[Class_MapObject#SetPFXEmitterMinSize|min-size <b><i>(added in v1.2)</i></b>]]<br />
:::Update the minimum size of particles. The size is a single float.<br />
::*[[Class_MapObject#SetPFXEmitterPhysicsDelay|physics-delay <b><i>(added in v1.2)</i></b>]]<br />
:::Update the physics delay for the emitter. The delay value is in seconds.<br />
::*[[Class_MapObject#SetPFXEmitterRate|rate <b><i>(added in v1.2)</i></b>]]<br />
:::Set a new rate of particle creation per second.<br />
::*[[Class_MapObject#SetPFXEmitterVelocity|velocity <b><i>(added in v1.2)</i></b>]]<br />
:::Set the emitter velocity in metres per second along the direction vector.<br />
<br />
For examples see.... (tbd)<br />
</td></tr></table><br />
<br />
<!--start paths tag--><br />
<table width=1200><tr><td><br />
<!--THIS DOESN'T LOOK RIGHT - CHECK--><br />
====paths====<br />
:Type: String - (a list of two strings)<br />
:Example: paths "marker-lights/night-only""<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: For kind config-edit. A comma-separated list of paths that point to the tag in the wagon-x config to edit.<br />
<!--end paths tag--><br />
</td></tr></table><br />
<br />
<!--start property-id tag--><br />
<table width=1200><tr><td><br />
====property-id====<br />
:Type: String<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: The formal name (ID) of this property, used to identify and change this property. For example, If the name is <b>Workflow</b>, it might be a good idea to call this <b>p_workflow</b>. <div style="color: #ff0080">This must be unique for each browser-property</div>.<br />
</td></tr></table><br />
<br />
<!--start property-sync-id tag--><br />
<table width=1200><tr><td><br />
====property-sync-id====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: property-sync-id "soundBell"<br />
</td></tr></table><br />
<br />
<!--start property-visibility tag--><br />
<table width=1200><tr><td> <br />
====property-visibility====<br />
:Type: Integer - (0 = Hidden, 1 = Visible, 2 = Surveyor Only, 3 = Driver Only) <br />
:Compulsory: No<br />
:Default: 0 (hidden)<br />
:Desc: Indicates whether the property will be visible in the Properties Browser and in what mode. <br />
</td></tr></table><br />
<br />
<!--start sound-triggers--><br />
<table width=1200><tr><td><br />
====sound-triggers====<br />
:Type: String - (a list of strings)<br />
:Example: sound-triggers "bell_1,bell_2"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<br />
</td></tr></table><br />
<!--end sound-triggers--> <br />
<br />
<!--start target-asset tag--><br />
<table width=1200><tr><td><br />
====target-asset====<br />
:Type: String<br />
:Example: target-asset "bogey-0"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>Only properties of kind “mesh-attachment” or “fx-replacement” can be used for properties that use this tag.</b><br />
</td></tr></table><br />
<!--end target-asset tag--> <br />
<br />
<!--start trigger--><br />
<table width=1200><tr><td><br />
====trigger====<br />
:Type: String<br />
:Example: trigger "user"<br />
:Compulsory: No<br />
:Default: Null (ignored)<br />
: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 [[#child-properties|child-properties]] property of another property. Possible values are:<br />
:::*user<br />
:::*event<br />
:::*parent<br />
:::*condition <b><i>(added in v1.2)</i></b><br />
:::*variable <b><i>(added in v1.2)</i></b><br />
::::multiple <b><i>(added in v1.2)</i></b><br />
:::*both <b><i>(obsolete as of v1.2)</i></b><br />
:::*none<br />
<br><br />
:User: Used when the property is updated by the user in the Properties Browser.<br />
:Event: Used when the property is to be triggering by an event initiated by Trainz such as day to night. These are generally the result of messages posted either by the system or other asset scripts.<br />
:Parent: Used in a child property where the property is to be activated by a parent property.<br />
:Condition: TBA<br />
:Variable: TBA <br />
:Multiple: TBA<br />
:Both: TBA<br />
:None: No trigger.<br />
</td></tr></table><br />
<!--end trigger--><br />
<br />
<!--start update-events--><br />
<table width=1200><tr><td><br />
<br />
====update-events====<br />
<b><i>(added in v1.2)</i></b><br />
:Type: String - (a list of strings)<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: Very similar to the ‘events’ tag, except this tag triggers a refresh of the conditional and variable events within this property based on the triggered event. By default, conditional events refresh at a certain time interval, based on the ‘update-frequency’ tag. Adding this tag will refresh the property immediately when the trigger event is activated. Can be any of the property events in the ‘events’ tag.<br />
</td></tr></table><br />
<!--end update-events--> <br />
<br />
<!--start values tag--><br />
<table width=1200><tr><td><br />
====values====<br />
:Type: String - (a string list separated by special characters)<br />
:Example1 values "0,15,30"<br />
:Compulsory: No<br />
:Default: None<br />
: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 [[WagonX_-_Browser_Properties_Examples_and_Basic_Tutorials#Using_semicolons_to_set_multiple_values_in_one_property|Examples and Basic Tutorials]].<br><br />
Each kind has its own rules for what to put here, explained below. See the [[#kind|kind]] property for more info on these.<br><br />
<!--mesh-attachment--><br />
:::*For kind mesh-attachment:<br />
::::*For mesh-attachment-type mesh-toggle, the value must be either 0 or 1 (visible/hidden) ???<br />
::::*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).<br />
::::Example: values "(0`2`4):(1.2`2`2),(0`0`0):(0`0`0)"<br />
<!--mesh-attachment-type--><br />
:::*For mesh-attachment-type mesh-animation-speed, the value is the speed of the animation for that index<br />
:::*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 [[#child-properties|child-properties]] property to control the speed of the loop.<br />
:::*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 [[Class_MeshObject#GetMeshAnimationFrameCount|<span style="color: #0080ff">GetMeshAnimationFrameCount</span>]]).<br />
::::Example: values "0,30"<br />
:::*For mesh-attachment-type mesh-animation-loop, the value can be 0 or 1, to start/stop the loop<br />
<!--sound-script--><br />
:::*For kind sound-script, the value can be 0 or 1, to start/stop the soundscript event<br />
<!--config-edit--><br />
:::*For kind config-edit, the value is a string indicating the string value to assign to the config tag.<br />
<!--particle-effect--><br />
:::*For kind particle-effect:<br />
:::*For particle-effect-type pfx-message, the value follows the same rules for [[Pfx_Message|pfx message]].<br />
::::*particle-effect-type "pfx-message"<br />
::::Example: values "+0+1,-1-0"<br />
<!--fx-replacement--><br />
:::*For kind fx-replacement:<br />
::::*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:<br />
::::Values “0,2,1” will reference the textures in the texture container at indexes 0, 2, and 1, in that order when cycled through.<br />
::::Example: values “0,2,1”<br />
<br />
kuid <kuid:1234:123456><br />
username "test texture group asset"<br />
trainz-build 4.6<br />
description "test texture group"<br />
textures<br />
{<br />
0 "textures\0albedo.texture"<br />
1 "textures\1albedo.texture"<br />
2 "textures\2albedo.texture"<br />
3 "textures\0parameter.texture"<br />
4 "textures\1parameter.texture"<br />
5 "textures\2parameter.texture" <br />
6 "textures\0normal.texture"<br />
7 "textures\1normal.texture"<br />
8 "textures\2normal.texture" <br />
}<br />
<br />
<br />
::::*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. <br />
::::Example: values "images/congleton.texture,images/burntisland.texture,images/buxton.texture,images/none.texture"<br />
::::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:<br />
::::Example: values "congleton,burntisland,buxton,none" <br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Workflow Text: "<br />
property-id "p_workflow"<br />
description "Sets the Workflow"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
consist-property-sync 1<br />
meshes "null"<br />
effects "texture-extra"<br />
asset "null"<br />
files-path "images/,.texture"<br />
values "congleton,burntisland,buxton,none"<br />
default-index 0<br />
trigger "user"<br />
display-type "list"<br />
display-values "Congleton,Burntisland,Buxton,None"<br />
}<br />
<br />
::::*For fx-replacement-type attachment, the values are the names of the attachment effects to be replaced by the specified [[#asset|asset]].<br />
::::*For fx-replacement-type corona, the values are the names of the corona effects to be replaced by the specified [[#asset|asset]].<br />
::::*For fx-replacement-type animation, the values are the names of the animation effects to be replaced by the specified [[#asset|asset]].<br />
::::*For fx-replacement-type name, the values are the names that will replace the current name of the specified name effect. <br />
<br />
</td></tr></table><br />
<!--end values tag--><br />
<br />
<!--start variables--><br />
<table width=1200><tr><td><br />
====variables====<br />
<b><i>Added in version 1.2 (needs validation)</i></b><br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: For trigger kind “variable”. An array of variable event(s) that control the value of the property using any of the conditional values and five arithmetic operators, ‘+’ (addition), ‘-’ (subtraction), ‘*’ (multiplication), ‘/’ (division), ‘^’ (exponent). You can use as many ‘|’ separated operators as you want. The operations do not follow the standard PEMDAS order of operations but are performed in a left-to-right additive manner. <br />
:Example1: a*b+c is the same as (a*b)+c,<br />
:Example2: c+a*b is the same as (c+a)*b, and<br />
:Example3: a*b+c/2 is the same as ((a*b)+c)/2<br />
</td></tr></table><br />
<!--end variables--><br />
<br />
<!--start copyright notice--><br />
<table width=1200><tr><td><br />
=Copyright Notice=<br />
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.<br />
</td></tr></table><br />
<!--end copyright notice--></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Technical_ReferenceHowTo/WagonX - Technical Reference2024-02-29T06:24:52Z<p>Pcas1986: Added changes for WagonX 1.2 (still in development) and some tidy up</p>
<hr />
<div><table width=1200><tr><td><br />
= Document Structure =<br />
<br />
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:<br />
<br />
# [[HowTo/Use the WagonX Library|How to use the WagonX library]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials|WagonX Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial|WagonX Traincar Tutorial]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial|WagonX Locomotive Tutorial]]<br><br />
</tr></td></table><br />
<br />
__TOC__<br />
<br />
<table width=1200><tr><td><br />
= The WagonX Reference =<br />
<br />
This page contains details of the WagonX extension container and sub-containers. Links to examples of use will be provided when available.<br />
</td></tr></table> <br />
<br />
<table width=1200><tr valign="top"><td><br />
= Restricted Characters =<br />
<br />
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. See also [[#display-values|display-values]].<br />
<br />
*Comma ( , ) <br />
*Semicolon ( ; ) <br />
*Backtick/Grave ( ` )<br />
*Colon ( : )<br />
*Caret ( ^ ) <br />
*Round brackets ( and )<br />
</td></tr></table><br />
<br />
<table width=1200><tr valign="top"><td><br />
== Using commas and semi-colons in a list ==<br />
WagonX uses commas to identify items in a list. Some examples might be "1,2,3,4"for a list of four integers, "Rita, Rose, Ruth" of three nameboards for a Pullman car, and "0,1" for a list of booleans (false and true).<br><br />
Semi-colons are used to items in a set, where sets are items in a list. Le's say we have three sets each consisting of integer numbers,then we might use something like "1;2;3;4,9;3;6;5,13;12;15;16". The first set is 1,2,3 and 4, the second set 9,3,6 and 5, and the last 13,12,15 and 16.<br />
<br>This notation is common where we might want apply some value to items in a set. For example, our sets might each consist of four meshes for a car to which we want to apply a particular livery. List such as these are commonly used in the [[#values|values]] tag.<br />
<br>See also [[WagonX_-_Browser_Properties_Examples_and_Basic_Tutorials#Using_semicolons_to_set_multiple_values_in_one_property|Using semicolons to set multiple values in one property]].<br />
</td></tr></table><br />
<br />
<table width=1200><tr valign="top"><td><br />
== Using the grave symbol in a list ==<br />
The backtick or grave symbol allows you to set multiple variables on a single function in one property. It's typically used to set the value for all the parameters in the pfx emitter functions. It's also used for mest-attachment-type mesh-translation-orientation parameters.<br />
For example, if you want to set the start color with these values (0,0,128,128,128,64), but you want each of those variables to be set in one property then use "0`0`128`128`128`64".<br />
You can also use this symbol to populate your set of parameters with variables such as "veh_velocity|/|2`veh_velocity|+2`veh_velocity|-|loc_abs_reverser". In simple english that means the first parameter is the vehicle velocity divided by 2, the second parameter is the vehicle velocity plus 2, and the final parameter is the vehicle length minus the absolute value of the loco reverser. Hmm, that doesn't make a lot of sense but its only an example.<br />
</td></tr></table><br />
<br />
<table width=1200><tr valign="top"><td><br />
== Other special characters ==<br />
Caret - The caret/circumflex symbol (^) is a math power operator. It can be used in variables.<br><br />
Round Brackets - Round brackets are used to group mesh vectors translation and orientation. In this instance, colons are used to separate the vectors. For example, "(0`2`4):(1.2`2`2),(0`0`0):(0`0`0)". See [[#values|values]].<br><br />
Colon - See Round Brackets above.<br />
</td></tr></table><br />
<br />
<table width=1200><tr valign="top"><td><tr><br />
= General Layout =<br />
<br />
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:<br />
extensions<br />
{<br />
max_permitted_speed-60850 "50mph"<br />
active-coupling-standard-60850<br />
{<br />
...<br />
}<br />
wagon-x<br />
{<br />
...<br />
}<br />
}<br />
</td></tr></table><br />
<br />
<table width=1200><tr valign="top"><td><br />
= WagonX Properties =<br />
<br />
There are currently four standard or "top level" WagonX containers that define properties for Marker Lights,text-x, 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.<br />
</td></tr></table><br />
<br />
<br />
<!--start of ACS table--><br />
<table width=1200><tr><td><br />
== ACS ==<br />
For help on creating the acs extensions and setting up the acs mesh-table objects, see [[HowTo/WagonX_-_Browser_Properties_Examples_and_Basic_Tutorials#Naming_ACS_mesh-table_attachments|Naming ACS mesh-table attachments]].<br />
<br><br />
Each tag is shown here with sample values. There are no default values.<br />
<br />
acs<br />
{<br />
animated 1<br />
use-jbv-animation 1<br />
duration 1.0<br />
}<br />
<br />
*<b>animated (1 = true, 0=false)</b><br />
:This determines whether to use animations to move between the coupled and uncoupled state, or use individual static assets for each state.<br />
*<b>use-jbv-animation (1 = true, 0=false)</b><br />
: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.<br />
*<b>duration (a floating point value)</b><br />
: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)<br />
*<b>buffer-length-front float</b><br />
:The distance between a.couple0 and a.limfront in meters. To be used with the jbv animation system. Requires the ‘use-jbv-animation’ tag to be set to 1<br />
*<b>buffer-length-back float</b><br />
:The distance between a.couple1 and a.limback in meters. To be used with the jbv animation system. Requires the ‘use-jbv-animation’ tag to be set to 1<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
== text-x ==<br />
<!--start of ACS table--><br />
WagonX V1.2 or greater.<br />
(description yet to be included - ARN and/or headcodes? - validation required)<br><br />
<br />
*<b>controller string</b> <br />
:Determines how the property will be controlled. Can be controlled by the user, the running number, or a custom range. <br />
:::*user<br />
:::*arn<br />
:::*range<br />
*<b>range string</b> <br />
:Defines the range of values the for the text proprety. It will choose a random index to start<br><br />
*<b>value string</b><br />
:The default value for the text property. This can be formated in two ways. For texture files with single-character identifiers, each character can be written together (e.g. “a12d”). For texture files with multiple-character identifiers, each identifier needs to be separated by a comma (e.g. “dot,3,dash,k”).<br><br />
*<b>font int</b><br />
:The default font index for the text property, these values can be changeed by adding a “config-edit” property to the browser-properties.<br />
*<b>files-path string</b><br />
: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.<br><br />
*<b>textures string</b><br />
:The list of texture files to use. The ‘#’ symbol is used by the script as a placeholder identifier for the value input. For example, if it is set to ‘alpha_digit-#’, each letter and number will go where the ‘#’, e.g. If the first chartcher in the value tag is ‘a’, it will look for the texture ‘images/alpha_digit-a.texture’, to use for the first texture effect digit. Each comma separated value coorispinds to the font to use at each index.<br><br />
*<b>effects string</b><br />
:The texture replacement effects to use for displaying the text.<br><br />
<br />
Each tag is shown here with sample values.<br />
<br />
text-x<br />
{<br />
text-properties<br />
{<br />
headcode<br />
{<br />
controller "user"<br />
range "null"<br />
value "2,5,dots,2"<br />
font 0<br />
files-path "images/,.texture"<br />
textures "fd-#"<br />
effects "fdigit-1,fdigit-2,fdigit-3,fdigit-4"<br />
}<br />
}<br />
}<br />
</td></tr></table><br />
<br />
<!--start of Misc table--><br />
<table width=1200><tr><td><br />
== Misc ==<br />
<br />
<!--Note for page author - is this for proper industries such as cargo or is it used for passengers at stations as well?--><br />
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.<br />
<br />
Each available tag is shown here with sample values. There are no defaults.<br />
<br />
misc<br />
{<br />
begin-load-time 5.0<br />
begin-unload-time 5.0<br />
end-load-time 1.0<br />
end-unload-time 1.0<br />
}<br />
<br />
*<b>mobile float</b> <b><i>(added in v1.2)</i></b> <br />
:Setting this to 1 indicates this asset is indended for use on trainz mobile platforms. This will disable and/or compromise certain script features to reduce complexity and improve performance for mobile devices.<br><br />
*<b>update-frequency float</b> <b><i>(added in v1.2)</i></b><br />
:The frequency, in seconds, at which certain event triggered browser-properties are updated. This has a huge impact on performance, and it is best kept as high as possible, ideally 5 or more secconds. The minimum allowed value is 1. If the moible tag is set to 1, the minumum allowed value is 3 secconds.<br />
*<b>begin-load-time (a floating point value)</b><br />
:The time it takes for the wagon to load at an industry<br />
*<b>begin-unload-time (a floating point value)</b><br />
:The time it takes for the wagon to unloading at an industry<br />
*<b>end-load-time (a floating point value)</b><br />
:The time it takes for the wagon end loading at an industry<br />
*<b>end-unload-time (a floating point value)</b><br />
:The time it takes for the wagon to end unloading at an industry<br />
</td></tr></table><br />
<!--end of misc table--><br />
<br />
<!--start of Marker-Lights table--><br />
<table width=1200><tr><td><br />
== Marker-Lights ==<br />
The Marker-Lights container is used to show or hide light meshes that are identied by entries in the config mesh-table.<br />
<br />
Each tag is shown here with sample values. There are no defaults. <br />
<br />
marker-lights<br />
{<br />
enabled 1<br />
car-minimum-count 1<br />
require-locomotive 1<br />
night-only 0<br />
front<br />
{<br />
head<br />
{<br />
mesh "null"<br />
}<br />
tail<br />
{<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back<br />
{<br />
head<br />
{<br />
mesh "lamp-back-white"<br />
}<br />
tail<br />
{<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
<br />
<br />
*<b>enabled (1 = true, 0=false)</b><br />
:Whether or not the marker lights are active on this asset.<br />
*<b>car-minimum-count (an integer number)</b><br />
:The minimum number of cars that must be present in the consist for the marker-lights to activate.<br />
*<b>require-locomotive (1 = true, 0=false)</b><br />
:If set to 1, a traincar of Class locomotive will need to be present in the consist for the marker-lights to activate.<br />
*<b>night-only (1 = true, 0=false)</b><br />
:If set to 1, the lamps will only be visible at night, otherwise they will be displayed 24/7.<br />
*<b>Front/back head/tail containers</b><br />
:These containers identify the mesh to use for the front, back, head, and tail lamps. These meshes must be in the config mesh-table.<br />
</td></tr></table><br />
<!--end of Marker-Lights table--><br />
<br />
<!--start of Browser-Properties container table--><br />
<table width=1200><tr><td><br />
== Browser-Properties ==<br />
<br />
*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.<br />
*A property can have sub properties that are activated with their parent.<br />
*A property container has a number of tags with values. Many are common to different property types but some are unique to a property.<br />
*A container need not contain all available tags.<br />
*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,<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin"<br />
consist-property-sync 1<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
effects "texture-albedo,texture-parameter"<br />
asset "texturelib"<br />
files-path "null"<br />
values "0;3,1;4,2;5"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Clean,Weathered,Dirty"<br />
}<br />
1<br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "handbrake-lever,braking-system"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.2<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
}<br />
</td></tr></table><br />
<br />
<!--start supported tags--><br />
<table width=1200><tr><td> <br />
===Supported Tags===<br />
Tag explanations. Some examples are included in the definition and, for others, see above for sample of usage.<br />
</td></tr></table><br />
<!--end supported tags--><br />
<br />
<!--start asset tag--><br />
<table width=1200><tr><td><br />
====asset====<br />
:Type: String<br />
:Example: asset "texturelib"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The kuid-table asset to be used by the property. Use this for cases where you need to reference another asset, such as a texture-replacement library. Use this tag, the [[#effects|effects]] tag, the [[#meshes|meshes]] tag, or the [[#particle-effects|particle-effects]] tag, but not more than one.<br />
<br />
</td></tr></table><br />
<!--end asset tag--> <br />
<br />
<table width=1200><tr><td> <br />
====child-properties====<br />
:Type: A string of numbers separated by commas.<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: child-properties "2,4,5"<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====conditions====<br />
<b><i>(added in v1.2)</i></b><br />
:Type: String - (a list of strings)<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: For trigger kind “condition”. An array of conditional 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). <br />
::The format in each comma-separated condition is a basic comparison operation with a left side, an operator, and a right side. The left and right sides can either be a variable (listed below), or a number (integer or float). The three parts are separated by a vertical bar. You can add more comparison operations to the same condition by adding an “&” (and) symbol after the first condition, then adding the second comparison operator (shown in the default conditions example above in black)(this is separate from the comma separation). You can add as many “&”s as you want to the operation, however it will get very long very quickly. The operators used are “==” (equals), “>” (greater than), “<” (less than), “>=” (greater than or equal to), “<=” (less than or equal to), and “!=” (not equal to), and must follow that format.<br />
<br />
:::*veh<br />
::::Contains functions used within Class Vehicle. Subclasses can be any of the listed ones below. All of these are derived from [[#Class_Vehicle|Class Vehicle]]. Please refer to that page for information on function behavior and usage.<br><br />
::::<b>example 1: veh_velocity|>=|5&veh_mass>1500 -></b> in plain English this reads, “If vehicle velocity is greater than or equal to 5 m/s and the mass is greater then 1500, then…. do something.<br />
::::<b>example 2: veh_engine-param_main-reservoir-pressure|<|0.5 -></b> in plain English this reads, “If the vehicles engine parameter, ‘main-reservoir-pressure’ is greater than 0.5, then…. do something.<br />
<br />
:::::For float:<br />
::::::*velocity (float)<br />
::::::*abs-velocity (float)<br />
:::::::The absolute value of the velocity, this is useful because moving in reverse will give negative inputs for “velocity”, but positive for “abs-velocity”<br />
::::::*mass (float)<br />
::::::*length (float)<br />
::::::*load-time (float)<br />
::::::*odometer-distance (float)<br />
::::::*trip-meter-distance (float)<br />
::::::*track-gradient (float)<br />
::::::*maximum-tractive-effort (float)<br />
::::::*default-maximum-tractive-effort (float)<br />
::::::*wheelslip-traction-multiplier (float)<br />
::::::*traction-multiplier (float)<br />
::::::*aux-reservoir-pressure (float)<br />
::::::*brake-cylinder-pressure (float)<br />
::::::*brake-pipe-pressure (float)<br />
::::::*cabin-sway-amount (float)<br />
::::::*coupling-stress (float)<br />
::::::*default-cabin-sway-amount (float)<br />
::::::*default-maximum-coupler-compression-stress (float)<br />
::::::*default-maximum-coupler-expansion-stress (float)<br />
::::::*maximum-coupler-compression-stress (float)<br />
::::::*maximum-coupler-expansion-stress (float)<br />
::::::*maximum-couple-velocity (float)<br />
::::::*default-maximum-couple-velocity (float)<br />
:::::For bool:<br />
::::::*coupler-breakage-enabled (bool)<br />
::::::*direction-relative-to-train (bool)<br />
::::::*drain-cocks (bool)<br />
::::::*random-automatic-running-number-support (bool)<br />
::::::*automatic-running-number (bool)<br />
::::::*high-beams (bool)<br />
::::::*is-ditch-flashing (bool)<br />
::::::*automatic-fireman-state (bool)<br />
::::::*interior-light (bool)<br />
::::::*interior-light-state (bool)<br />
::::::*bell-state (bool)<br />
::::::*has-bell (bool)<br />
::::::*in-tunnel (bool)<br />
::::::*on-bridge (bool)<br />
::::::*derailed (bool)<br />
::::::*loaded-this-stop (bool)<br />
::::::*unloaded-this-stop (bool)<br />
:::::For integer:<br />
::::::*engine-type (int)<br />
::::::*vehicle-type-flags (int)<br />
:::::For string:<br />
::::::*running-number (string)<br />
:::::And the engine parameter string:<br />
::::::*engine-param<br />
:::::::The main engine parameter strings you can use with this method are:<br />
:::::::*applied-force<br />
:::::::*brake-cylinder-pressure<br />
:::::::*brake-pipe-pressure<br />
:::::::*current-drawn<br />
:::::::*equaliser-pressure<br />
:::::::*flow<br />
:::::::*horn<br />
:::::::*main-reservoir-pressure<br />
:::::::*max-te<br />
:::::::*no3-pipe-pressure<br />
:::::::*wheelslip<br />
:::::::Values that refer only to steam engines:<br />
:::::::*coal-mass<br />
:::::::*engine-force<br />
:::::::*fire-temperature<br />
:::::::*max-coal-mass<br />
:::::::*max-fire-temperature<br />
:::::::*steam-boiler-liquid-percent<br />
:::::::*steam-boiler-pressure<br />
:::::::*steam-piston-cycle<br />
:::*loc<br />
::::Contains functions used within Class Locomotive. Subclasses can be any of the listed ones below. All of these are derived for Class Locomotive. Please refer to that page for information on function behavior and usage.<br />
::::*engine-setting<br />
:::::*The engine setting, currently the only one for the parent class ‘loc’.<br />
:::::*dynamic-brake<br />
:::::*headlight <br />
:::::*horn<br />
:::::*injector<br />
:::::*loco-auto-brake<br />
:::::*pantograph<br />
:::::*regulator<br />
:::::*reverser<br />
:::::*abs-reverser<br />
:::::*steam-blower<br />
:::::*throttle<br />
:::::*train-auto-brake <br />
:::::*train-lap-brake<br />
:::::*script-brake-pressure<br />
:::*tra<br />
::::For class Train<br />
::::For float:<br />
::::*smoothed-velocity (float)<br />
::::*train-velocity (float)<br />
::::*abs-smoothed-velocity (float)<br />
::::*abs-train-velocity (float)<br />
::::*dcc-throttle (float)<br />
::::*train-brakes (float)<br />
::::*speed-limit (float)<br />
::::*advisory-limit (float)<br />
::::*advisory-limit-2 (float)<br />
::::*ai-train-max-speed (float)<br />
::::For integer:<br />
::::*autopilot-mode (int)<br />
::::*reverser (int)<br />
::::*pantograph-state (int)<br />
::::*classification-signal (int)<br />
::::*train-priority-number (int)<br />
::::*frontmost-locomotive (int-bool)<br />
::::For bool:<br />
::::*allows-user-control (bool)<br />
::::*headlight-state (bool)<br />
::::*ditchlight-state (bool)<br />
::::*bell-state (bool)<br />
::::For string:<br />
::::*train-display-name (string)<br />
::::*owning-client (string)<br />
<br />
:::*wor<br />
::::For class World<br />
::::For float:<br />
::::*camera-yaw<br />
::::*camera-pitch<br />
::::*camera-zoom<br />
::::*game-time<br />
::::*game-season<br />
::::For integer:<br />
::::*weather-type<br />
::::*weather-changeability<br />
::::*camera-mode<br />
::::*camera-flags<br />
::::*game-time<br />
::::*game-year<br />
::::*game-month<br />
::::*game-date<br />
::::*game-session<br />
::::*current-module<br />
::::For string:<br />
::::*local-player-name (string)<br />
::::For bool:<br />
::::*restart-stuck-ai (bool)<br />
::::*asset-restriction-in-effect (bool)<br />
<br />
<!--end conditions--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====consist-property-sync====<br />
:Type: Integer - (0 off, 1 on (button), 2 on (automatic)<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: Whether or not to sync the property within the consist, if a tag with the same [[#property-sync-id|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.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start default-index--><br />
====default-index====<br />
:Type: Integer (-1 = random)<br />
:Example: default-index 0<br />
:Compulsory: No<br />
:Default: 0<br />
: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.<br><br />
Warning: If you have a list of values such as "1,2,3,4" and you want to set a default, then you should subtract 1 from the preferred value. For example if you want the first in the list then set the default to 0. This is because the browser counts the list entries from 0 and not 1.<br />
<!--end default-index--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====description====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The description of this attachment as it will appear in the Properties Browser.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start display-type--><br />
====display-type====<br />
:Type: String<br />
:Example: display-type "link"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>For trainzbuild 5.1 and 5.0, only link is supported for the View Details page.</b> Omitting this tag in combination with property-visibility set to 0 is useful for non-user triggers, such as world or train events.<br />
:::*string<br />
:::*int<br />
:::*float<br />
:::*list<br />
:::*link <br />
<!--end display-type--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start display-values--><br />
====display-values====<br />
:Type: String - (a list of strings)<br />
:Example: display-values "Clean,Weathered,Dirty"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end display-values--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start duration--><br />
====duration====<br />
:Type: Float<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>(There may be issues with using this tag with mesh-toggle.)</b><br />
:Example: duration 3.2<br />
<!--end duration--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start of effects (textures)--><br />
====effects====<br />
:Type: String - (a list of texture names (i.e. texture.txt names without the .txt) each separated by a comma)<br />
:Example: effects "texture-albedo,texture-parameter"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The comma-separated effect(s) to be modified by the property. Only use this tag if you are using [[#kind|kind]] fx-replacement. Use this tag, the mesh tag, or the asset tag, but not more than one.<br />
<!--end of effects--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====enabled====<br />
:Type: Boolean (1 = true, 0=false)<br />
:Compulsory: No<br />
:Default: No default.<br />
:Desc: Whether or not this property is active. This is useful for debugging, or if you want to disable it without removing everything.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start events--><br />
====events====<br />
:Type: String - (a list of strings)<br />
:Example: events "handbrake-release,handbrake-apply"<br />
:Compulsory: No<br />
:Default: None<br />
: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). <br />
:::*begin-load/end-load/begin-unload/end-unload<br />
:::*started-moving/stopped-moving <b><i>(added in v1.2)</i></b><br />
:::*handbrake-apply/handbrake-release<br />
:::*trainbrake-apply/trainbrake-release<br />
:::*headlight-on, headlight-off<br />
:::*throttle-changed <b><i>(added in v1.2)</i></b><br />
:::*front-coupled/back-coupled,front-uncoupled/back-uncoupled <b><i>(added in v1.2)</i></b><br />
:::*view-internal, view-external, view-tracking, view-roaming <b><i>(added in v1.2)</i></b><br />
:::*horn<br />
:::*bell<br />
:::*sanding<br />
:::*pantograph-state-0/1/2/3 (see [[Class_Train#GetPantographState|<span style="color: #0080ff">GetPantographState</span>]])<br />
:::*weather-0/1/2/3/4/5/6/7 (see [[Class_World#GetWeatherType|<span style="color: #0080ff">GetWeatherType</span>]])<br />
:::*world-day/world-night<br />
:::*priority-number-(0 - ∞) (e.g. priority-number-2) <b><i>(added in v1.2)</i></b><br />
:::*arn-(0 -∞ ) (e.g. arn-92220, arn-844) <b><i>(added in v1.2)</i></b><br />
:::*queue-(0 - ∞)- loaded/empty (e.g. <b>queue-0-loaded, queue-1-empty</b>)<br />
<!--end events--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start files-path tag--><br />
====files-path====<br />
:Type: String - (a list of two strings)<br />
:Example: files-path "images/,.texture"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>files-path “images/left/.texture”</b>), where images/left is the path, and .texture is the extension for all the files.<br />
<!--end files-path tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start fx-replacement-type--><br />
====fx-replacement-type====<br />
:Type: String)(kind fx-replacement only)<br />
:Example: kind "fx-replacement"<br />
:::fx-replacement-type "texture-replacement"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The type of fx replacement effect this property will be if the [[#kind|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 [[#values|values]] for instructions on how to implement these properties.<br />
::*[[Class_MeshObject#SetFXTextureReplacement|<span style="color: #0080ff">texture-replacement</span>]]<br />
:::Replaces a texture effect in this asset to one within a texture-group asset.<br />
::*[[Class_MeshObject#SetFXTextureReplacementTexture|<span style="color: #0080ff">texture-replacement-texture</span>]]<br />
:::Replaces a texture effect in this asset to one located within this asset.<br />
::*[[Class_MeshObject#SetFXCoronaTexture|<span style="color: #0080ff">corona</span>]]<br />
:::Replaces a corona effect in the asset.<br />
::*[[Class_MeshObject#SetFXNameText|<span style="color: #0080ff">name</span>]]<br />
:::Replaces a name effect in the asset.<br />
::*[[Class_MeshObject#SetFXAttachment|<span style="color: #0080ff">attachment</span>]]<br />
:::Replaces an attachment effect in the asset.<br />
::*[[Class_MeshObject#SetFXAnimationState|<span style="color: #0080ff">animation</span>]]<br />
:::Plays/Stops an animation effect in the asset.<br />
<!--end fx-replacement-type--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====kind====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The type of property this will be. Can be one of the options below. Most of these are derived from [[Class MeshObject|Class_MeshObject]]. For more info on implementing these, see [[#values|values]].<br />
::*mesh-attachment<br />
:::Manipulate the mesh’s animation, position, visibility, etc. See mesh-attachment-type.<br />
::*fx-replacement<br />
:::Change an effect in the mesh. See [[#fx-replacement-type|fx-replacement-type]].<br />
::*particle-effect<br />
:::Activate/Deactivate/Edit a particle effect (smoke0, smoke1, etc). See [[#particle-effects|particle-effects]] and [[#particle-effect=type|particle-effect-type]].<br />
::*sound-script<br />
:::Used to play a sound-script sound within this asset. See [[#sound-triggers|sound-triggers]].<br />
::*config-edit<br />
:::Used to edit a tag in the wagon-x config soup. See paths.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start meshes--><br />
====meshes====<br />
:Type: String - (a list of mesh names from the mesh-table separated by commas)<br />
:Example: meshes "handbrake-lever,braking-system"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The comma-separated mesh-table asset(s) to be modified by the property. Use this for [[#kind|kind]] mesh-toggle or kind mesh-animation. Use this tag, the effect tag, or the asset tag, but not more than one.<br />
<!--end meshes--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start mesh-attachment--><br />
====mesh-attachment-type====<br />
:Type: String - (kind mesh-attachment only)<br />
:Example: kind "mesh-attachment"<br />
:: mesh-attachment-type "mesh-animation-frame"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
::*[[Class_MeshObject#SetMeshVisible|<span style="color: #0080ff">mesh-toggle</span>]]<br />
:::Toggle between the mesh(s) being visible or hidden.<br />
::*[[Class_MeshObject#SetMeshOrientation|<span style="color: #0080ff">mesh-translation-orientation</span>]]<br />
:::Sets the translation and orientation of the mesh(es)<br />
::*[[Class_MeshObject#SetMeshAnimationFrame|<span style="color: #0080ff">mesh-animation-frame</span>]]<br />
:::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.<br />
::*[[Class_MeshObject#StartMeshAnimationLoop|<span style="color: #0080ff">mesh-animation-loop</span>]]<br />
:::Start or stop an animation-loop on the mesh.<br />
::*[[Class_MeshObject#SetMeshAnimationState|<span style="color: #0080ff">mesh-animation-state</span>]]<br />
:::Sets the state of the mesh(s) animation.<br />
::*[[Class_MeshObject#SetMeshAnimationSpeed|<span style="color: #0080ff">mesh-animation-speed</span>]]<br />
:::Changes the speed of the meshes animation.<br />
<!--end mesh-attachment--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====name====<br />
:Type: String<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: The display name of this property, as will appear on the properties page.<br />
</td></tr></table><br />
<br />
<!--start of particle-effects--><br />
<table width=1200><tr><td><br />
====particle-effects====<br />
:Type: String - (a list of integer numbers as a string)<br />
:Example: particle-effects "0,1"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: For kind particle-effect. The comma-separated list of PFX effects to be modified by the property. See kind for help on implementation. <b>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.</b><br />
<!--end particle-effects--> <br />
</td></tr></table><br />
<br />
<!--start of particle-effect-type--><br />
<!--need to come back and check this as I don't understand how this works--><br />
<table width=1200><tr><td><br />
====particle-effect-type====<br />
:Type: String (kind mesh-attachment only)<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The type of PFX function this property will be if the [[#kind|kind]] tag is set to particle-effect.<br />
Each one is hyperlinked to the corresponding trainzscript function, though it is not necessary to know them. See [[#values|values]] for instructions on how to implement these properties. Most of these are derived for the PFXEmitter properties specified in [[MapObject|Class MapObject]], with the prefix “GetPFXEmitter” omitted. All except [[MapObject#SetPFXEmitterTexture|SetPFXEmitterTexture]] are supported.<br />
:Example: kind "particle-effect"<br />
: particle-effect-type "pfx-message"<br />
:Comments: Needs to be validated with examples!<br />
::*[[pfx_Message|pfx-message]]<br />
:::Send a message to enable/disable a particle effect.<br />
::*[[Class_MapObject#SetPFXEmitterConeSize|cone-size <b><i>(added in v1.2)</i></b>]]<br />
:::Update the cone size with x,y and z sizes in values tag.<br />
::*[[Class_MapObject#SetPFXEmitterEmitParticles|emit-particles <b><i>(added in v1.2)</i></b>]]<br />
:::Update the number of particles and time they will be created.<br />
::*[[Class_MapObject#SetPFXEmitterEndColor|end-color <b><i>(added in v1.2)</i></b>]]<br />
:::Update the end colour of the particles.<br />
::*[[Class_MapObject#SetPFXEmitterStartColor|start-color <b><i>(added in v1.2)</i></b>]]<br />
:::Update the start colour of the particles.<br />
::*[[Class_MapObject#SetPFXEmitterLifetime|lifetime <b><i>(added in v1.2)</i></b>]]<br />
:::Update the emitter lifetime using seconds.<br />
::*[[Class_MapObject#SetPFXEmitterMaxRate|max-rate <b><i>(added in v1.2)</i></b>]]<br />
:::Update the emitter maximum rate per second.<br />
::*[[Class_MapObject#SetPFXEmitterMinRate|min-rate <b><i>(added in v1.2)</i></b><b><i>(added in v1.2)</i></b>]]<br />
:::Update the emitter minimum rate per second.<br />
::*[[Class_MapObject#SetPFXEmitterMaxSize|max-size <b><i>(added in v1.2)</i></b>]]<br />
:::Update the maximum size size of particles. The size is a single float.<br />
::*[[Class_MapObject#SetPFXEmitterMinSize|min-size <b><i>(added in v1.2)</i></b>]]<br />
:::Update the minimum size of particles. The size is a single float.<br />
::*[[Class_MapObject#SetPFXEmitterPhysicsDelay|physics-delay <b><i>(added in v1.2)</i></b>]]<br />
:::Update the physics delay for the emitter. The delay value is in seconds.<br />
::*[[Class_MapObject#SetPFXEmitterRate|rate <b><i>(added in v1.2)</i></b>]]<br />
:::Set a new rate of particle creation per second.<br />
::*[[Class_MapObject#SetPFXEmitterVelocity|velocity <b><i>(added in v1.2)</i></b>]]<br />
:::Set the emitter velocity in metres per second along the direction vector.<br />
<br />
For examples see.... (tbd)<br />
</td></tr></table><br />
<br />
<!--start paths tag--><br />
<table width=1200><tr><td><br />
<!--THIS DOESN'T LOOK RIGHT - CHECK--><br />
====paths====<br />
:Type: String - (a list of two strings)<br />
:Example: paths "marker-lights/night-only""<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: For kind config-edit. A comma-separated list of paths that point to the tag in the wagon-x config to edit.<br />
<!--end paths tag--><br />
</td></tr></table><br />
<br />
<!--start property-id tag--><br />
<table width=1200><tr><td><br />
====property-id====<br />
:Type: String<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: The formal name (ID) of this property, used to identify and change this property. For example, If the name is <b>Workflow</b>, it might be a good idea to call this <b>p_workflow</b>. <div style="color: #ff0080">This must be unique for each browser-property</div>.<br />
</td></tr></table><br />
<br />
<!--start property-sync-id tag--><br />
<table width=1200><tr><td><br />
====property-sync-id====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: property-sync-id "soundBell"<br />
</td></tr></table><br />
<br />
<!--start property-visibility tag--><br />
<table width=1200><tr><td> <br />
====property-visibility====<br />
:Type: Integer - (0 = Hidden, 1 = Visible, 2 = Surveyor Only, 3 = Driver Only) <br />
:Compulsory: No<br />
:Default: 0 (hidden)<br />
:Desc: Indicates whether the property will be visible in the Properties Browser and in what mode. <br />
</td></tr></table><br />
<br />
<!--start sound-triggers--><br />
<table width=1200><tr><td><br />
====sound-triggers====<br />
:Type: String - (a list of strings)<br />
:Example: sound-triggers "bell_1,bell_2"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<br />
</td></tr></table><br />
<!--end sound-triggers--> <br />
<br />
<!--start target-asset tag--><br />
<table width=1200><tr><td><br />
====target-asset====<br />
:Type: String<br />
:Example: target-asset "bogey-0"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>Only properties of kind “mesh-attachment” or “fx-replacement” can be used for properties that use this tag.</b><br />
</td></tr></table><br />
<!--end target-asset tag--> <br />
<br />
<!--start trigger--><br />
<table width=1200><tr><td><br />
====trigger====<br />
:Type: String<br />
:Example: trigger "user"<br />
:Compulsory: No<br />
:Default: Null (ignored)<br />
: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 [[#child-properties|child-properties]] property of another property. Possible values are:<br />
:::*user<br />
:::*event<br />
:::*condition <b><i>(added in v1.2)</i></b><br />
:::*variable <b><i>(added in v1.2)</i></b><br />
::::multiple <b><i>(added in v1.2)</i></b><br />
:::*both <b><i>(obsolete as of v1.2)</i></b><br />
:::*none <br />
</td></tr></table><br />
<!--end trigger--><br />
<br />
<!--start update-events--><br />
<table width=1200><tr><td><br />
====update-events====<br />
<b><i>(added in v1.2)</i></b><br />
:Type: String - (a list of strings)<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: Very similar to the ‘events’ tag, except this tag triggers a refresh of the conditional and variable events within this property based on the triggered event. By default, conditional events refresh at a certain time interval, based on the ‘update-frequency’ tag. Adding this tag will refresh the property immediately when the trigger event is activated. Can be any of the property events in the ‘events’ tag.<br />
</td></tr></table><br />
<!--end update-events--> <br />
<br />
<!--start values tag--><br />
<table width=1200><tr><td><br />
====values====<br />
:Type: String - (a string list separated by special characters)<br />
:Example1 values "0,15,30"<br />
:Compulsory: No<br />
:Default: None<br />
: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 [[WagonX_-_Browser_Properties_Examples_and_Basic_Tutorials#Using_semicolons_to_set_multiple_values_in_one_property|Examples and Basic Tutorials]].<br><br />
Each kind has its own rules for what to put here, explained below. See the [[#kind|kind]] property for more info on these.<br><br />
<!--mesh-attachment--><br />
:::*For kind mesh-attachment:<br />
::::*For mesh-attachment-type mesh-toggle, the value must be either 0 or 1 (visible/hidden) ???<br />
::::*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).<br />
::::Example: values "(0`2`4):(1.2`2`2),(0`0`0):(0`0`0)"<br />
<!--mesh-attachment-type--><br />
:::*For mesh-attachment-type mesh-animation-speed, the value is the speed of the animation for that index<br />
:::*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 [[#child-properties|child-properties]] property to control the speed of the loop.<br />
:::*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 [[Class_MeshObject#GetMeshAnimationFrameCount|<span style="color: #0080ff">GetMeshAnimationFrameCount</span>]]).<br />
::::Example: values "0,30"<br />
:::*For mesh-attachment-type mesh-animation-loop, the value can be 0 or 1, to start/stop the loop<br />
<!--sound-script--><br />
:::*For kind sound-script, the value can be 0 or 1, to start/stop the soundscript event<br />
<!--config-edit--><br />
:::*For kind config-edit, the value is a string indicating the string value to assign to the config tag.<br />
<!--particle-effect--><br />
:::*For kind particle-effect:<br />
:::*For particle-effect-type pfx-message, the value follows the same rules for [[Pfx_Message|pfx message]].<br />
::::*particle-effect-type "pfx-message"<br />
::::Example: values "+0+1,-1-0"<br />
<!--fx-replacement--><br />
:::*For kind fx-replacement:<br />
::::*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:<br />
::::Values “0,2,1” will reference the textures in the texture container at indexes 0, 2, and 1, in that order when cycled through.<br />
::::Example: values “0,2,1”<br />
<br />
kuid <kuid:1234:123456><br />
username "test texture group asset"<br />
trainz-build 4.6<br />
description "test texture group"<br />
textures<br />
{<br />
0 "textures\0albedo.texture"<br />
1 "textures\1albedo.texture"<br />
2 "textures\2albedo.texture"<br />
3 "textures\0parameter.texture"<br />
4 "textures\1parameter.texture"<br />
5 "textures\2parameter.texture" <br />
6 "textures\0normal.texture"<br />
7 "textures\1normal.texture"<br />
8 "textures\2normal.texture" <br />
}<br />
<br />
<br />
::::*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. <br />
::::Example: values "images/congleton.texture,images/burntisland.texture,images/buxton.texture,images/none.texture"<br />
::::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:<br />
::::Example: values "congleton,burntisland,buxton,none" <br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Workflow Text: "<br />
property-id "p_workflow"<br />
description "Sets the Workflow"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
consist-property-sync 1<br />
meshes "null"<br />
effects "texture-extra"<br />
asset "null"<br />
files-path "images/,.texture"<br />
values "congleton,burntisland,buxton,none"<br />
default-index 0<br />
trigger "user"<br />
display-type "list"<br />
display-values "Congleton,Burntisland,Buxton,None"<br />
}<br />
<br />
::::*For fx-replacement-type attachment, the values are the names of the attachment effects to be replaced by the specified [[#asset|asset]].<br />
::::*For fx-replacement-type corona, the values are the names of the corona effects to be replaced by the specified [[#asset|asset]].<br />
::::*For fx-replacement-type animation, the values are the names of the animation effects to be replaced by the specified [[#asset|asset]].<br />
::::*For fx-replacement-type name, the values are the names that will replace the current name of the specified name effect. <br />
<br />
</td></tr></table><br />
<!--end values tag--><br />
<br />
<!--start variables--><br />
<table width=1200><tr><td><br />
====variables====<br />
<b><i>Added in version 1.2 (needs validation)</i></b><br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: For trigger kind “variable”. An array of variable event(s) that control the value of the property using any of the conditional values and five arithmetic operators, ‘+’ (addition), ‘-’ (subtraction), ‘*’ (multiplication), ‘/’ (division), ‘^’ (exponent). You can use as many ‘|’ separated operators as you want. The operations do not follow the standard PEMDAS order of operations but are performed in a left-to-right additive manner. <br />
:Example1: a*b+c is the same as (a*b)+c,<br />
:Example2: c+a*b is the same as (c+a)*b, and<br />
:Example3: a*b+c/2 is the same as ((a*b)+c)/2<br />
</td></tr></table><br />
<!--end variables--><br />
<br />
<!--start copyright notice--><br />
<table width=1200><tr><td><br />
=Copyright Notice=<br />
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.<br />
</td></tr></table><br />
<!--end copyright notice--></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Browser_Properties_Examples_and_Basic_TutorialsHowTo/WagonX - Browser Properties Examples and Basic Tutorials2024-02-28T01:22:25Z<p>Pcas1986: Added some more examples and some updates for WagonX 1.2</p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/WagonX - Browser Properties Examples and Basic Tutorials--><br />
<span style="color: red; font-weight: 700; font-size: 15px;">Please note: Much of this page still needs some validation. If you find issues then please contact PCAS1986 in the Trainz Forums or in the Trainz Discord Server.</span><br />
<br />
= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several pages. This page contains some example WagonX config containers and basic guidance for setting up those containers. Other pages in the series are listed below:<br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Technical Reference]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
# [https://docs.google.com/document/d/1jd5nZNQJI_gKQp-X2GjNCBij9fZGAwgJy_BgBiXf3_8/edit#bookmark=id.kupvwsc34hnk| The asset author's documentation]<br />
<br />
= General Comments =<br />
Most of the notes and examples here are for Version 1 but WagonX continues to be developed. Features and/or changes for versions later than V1 are identified in the text.<br />
<br />
__TOC__<br />
<br />
=Browser property tutorials=<br />
<!--start of Browser property example--><br />
This tutorial takes you each step of creating a simple mesh toggle example. It is for a handbrake mesh, including animation, that the user may want to show (make visible) or hide (make invisible). We will add each property tag and explain its purpose.<br />
It may be useful to have the [[HowTo/WagonX - Technical Reference|WagonX Technical Reference]] page open in a browser to examine details of the various tags.<br />
<table width=1200><tr><td> <br />
==Creating a basic mesh toggle==<br />
*Start with an empty browser-properties container like this:<br />
<br />
browser-properties<br />
{<br />
}<br />
<br />
*Add an empty property container and name it "0". The names are not used but should be unique. When we add more properties, you should name them “1”, “2”, “3”, etc.<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
}<br />
}<br />
<br />
*There is no order required for each property, but using a standard order makes it easier to follow. Each tag is hyperlinked to the browser-property, so you can see more information about it.<br />
The first tag to add is [[HowTo/WagonX - Technical Reference#enabled|enabled]]. This determines whether or not the property is activated. Set it to 1, since we want our property to work in-game.<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
}<br />
}<br />
<br />
*Set the visibility of the property using [[HowTo/WagonX - Technical Reference#property-visibility|property-visibility]] and make that 1. Note this value is an integer and doesn't require quotes around it. A value of 1 makes the property visible in both Surveyor and Driver. See the reference for other available values.<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
}<br />
}<br />
<br />
*Set the [[HowTo/WagonX - Technical Reference#name|name]] of our property. The name will appear before the [[HowTo/WagonX - Technical Reference#display-values|display-values]], which we will get to in a moment. You also will want to add a space at the end; otherwise, the property name and display-value will appear as one word.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
}<br />
}<br />
<br />
*Set the [[HowTo/WagonX - Technical Reference#property-id|property-id]], which can be anything as long as it is unique and doesn't contain [[HowTo/WagonX - Technical Reference#Restricted_Characters|restricted characters]]. Trainz will use this to identify this property.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_meshToggle"<br />
}<br />
}<br />
<br />
*Set the [[HowTo/WagonX - Technical Reference#description|description]]. This will appear as the tool-tip when you hover over a browser-property.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_meshToggle"<br />
description "Toggles the mesh"<br />
}<br />
}<br />
<br />
*Set the property [[HowTo/WagonX - Technical Reference#kind|kind]]. Since we want a mesh-attachment kind, we must also specify the [[HowTo/WagonX - Technical Reference#mesh-attachment-type|mesh-attachment-type]] which for this application is mesh-toggle.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_meshToggle"<br />
description "Toggles the mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
}<br />
}<br />
<br />
*Now add a [[HowTo/WagonX - Technical Reference#meshes|meshes]] tag to specify what mesh we want to toggle. The mesh name must exist in the config mesh-table. We will use the script author's prestwins handbrake lever for this demo.<br />
<br />
Here is part of the config mesh-table:<br />
handbrake-lever<br />
{<br />
mesh "mesh/handbrake.lm"<br />
anim "mesh/handbrake_scene.kin"<br />
auto-create 1<br />
att-parent "default"<br />
}<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
}<br />
}<br />
<br />
*Add the [[HowTo/WagonX - Technical Reference#values|values]] tag. This determines what the state of the object will be at each index. The values tag varies depending on the kind and, since this is a toggle, we want a true (1) or false (0) value. For kind mesh-toggle, we set it at 0 to hide the mesh, and 1 to show the mesh. Each index is comma separated, so we will set the first one at 1, and the second one at 0.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
}<br />
}<br />
<br />
*Add the [[HowTo/WagonX - Technical Reference#default-index|default-index]]. This is an integer value starting from 0 and which indicates the position in a list. 0 is the first in the list, 1 is the second, and so on. <i>(The reasons for this are somewhat historical but also based on how computers find things in memory.)</i> If we set it to 1, it will start at the second comma-separated values tag which is "0". If we set it at -1, it will pick a random index within the size of the values tag.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
}<br />
}<br />
<br />
*Add the [[HowTo/WagonX - Technical Reference#trigger|trigger]] tag. We want our property to activate when a user presses a button on the properties page, so we will set it to <b>user</b>. If we set it to <b>event</b>, however, we could make it activate based on an event within the train or in the world, such as handbrake apply, or enabling it when it gets dark, and disabling it when its daytime again, but for now, we will leave it at user.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
trigger "user"<br />
}<br />
}<br />
<br />
*Specify the [[HowTo/WagonX - Technical Reference#display-type|display-type]]. Looking at the options, we see that <b>link</b> is what we want.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
}<br />
}<br />
<br />
*Finally, the last tag we need is the display-values tag, which we talked about earlier. Since we have two states for our property (specified in the values tag), we will create two comma-separated values for each state. We will call the first “Enabled”, and the second “Hidden”, which corresponds with the numbers we set in the values tag.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "Enabled,Hidden"<br />
}<br />
}<br />
<br />
And that's it! Run the asset into trainz, and when you view the properties, you should see your property appear:<br><br />
<br />
<!--Insert pic of View Details with suitable property shown--><br />
[[File:Toggle_handbrake_mesh_in_View_Details.jpg]]<br />
<br />
And when you click on the underlined part of your property, the property should change to “Hidden”, as we specified, and the handbrake on the underframe should disappear.<br><br />
[[File:Handbrake_mesh_show_%26_hide.jpg]]<br />
<br />
</td></tr></table><br />
<br />
= Browser-Property Examples =<br />
== User-Triggered Properties ==<br />
Here are a number of examples for user triggering - i.e. in the View Details property browser. Detailed information on the property browser tags can be found on the [[HowTo/WagonX - Reference|WagonX Reference]] page.<br />
<!--start of mesh toggle property example--><br />
<table width=1200><tr><td><br />
===Mesh-toggle property===<br />
This property allows you to show or hide a mesh that is in the config mesh-table. The values are 0 and 1 to represent false and true. The default is 0 or hidden when first placed.<br />
<br />
{<br />
enabled 1 <br />
property-visibility 1<br />
name "Toggle: "<br />
property-id "p_toggle"<br />
description "Hide or display the roof mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "roof"<br />
values "0,1"<br />
duration 3 <br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "Hidden,Visible"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of texture-replacement property example--><br />
<table width=1200><tr><td><br />
===texture-replacement property===<br />
This allows the choice of a texture from either local texture files (i.e. contained within the asset), or from a texture group asset, to retexture or reskin a mesh. You could use it for swapping between clean, dirty or weathered textures, logos and also entire liveries. <br />
</td></tr></table><br />
<br><br />
<br />
<!--start of texture replacement using local texture files example--><br />
<table width=1200><tr><td> <br />
====Texture replacement using local texture files====<br />
<br />
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. The values tag will contain a list of texture(.txt) files including a folder name if used. This is an example of three textures.<br />
<br />
values "images/congleton.texture,images/burntisland.texture,images/buxton.texture,images/none.texture"<br />
<br />
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. See the files-path and values usage below. Note that the display-values tag contains similar information but that is for the user to see.<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Workflow Text: "<br />
property-id "p_workflow"<br />
description "Sets the Workflow"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
consist-property-sync 1<br />
meshes "null"<br />
effects "texture-extra"<br />
asset "null"<br />
files-path "images/,.texture"<br />
values "congleton,burntisland,buxton,none"<br />
default-index 0<br />
trigger "user"<br />
display-type "list"<br />
display-values "Congleton,Burntisland,Buxton,None"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of texture replacement using a texture-group example--><br />
<table width=1200><tr><td> <br />
====Texture replacement using a texture-group library asset====<br />
You will need to specify the texture group asset in the kuid-table and give it a name such as "texturelib" or "gwrtexturelib", The name should not have any spaces or other special characters.<br />
This property container is set up to allow for three different variations of the the material used for the asset. They are named in the "display-values" tag as Skin 1, Skin 2, and Skin 3. <br />
Since it is a PBR material there are three textures used in the materail: the albedo, parameters, and normal. The normal texture is common to all three versions so it need not be changed.<br />
The "values" tag contains six numbers which are the numbers of the textures in the texture-group asset. For Skin 1 the "12" refers to the albedo texture, and the "15" refers to the parameter texture. "13" and "16" are the pair for Skin2, and "14" and "17" are the pair for Skin 3.<br />
The "effects" tag contains the texture effect names for meshes in the mesh-table.<br />
<br><br />
<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Weathering: "<br />
property-id "p_skin"<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
effects "texture-albedo,texture-parameter"<br />
asset "texturelib"<br />
files-path "null"<br />
values "12;15,13;16,14;17"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin 1,Skin 2,Skin 3"<br />
}<br />
</td></tr></table><br />
<br />
<br />
<br />
== Event-Triggered Properties ==<br />
<!--start of loading-doors property example--><br />
<table width=1200><tr><td><br />
===loading-doorsProperty ===<br />
The ‘meshes’ tag references a mesh-table asset named ‘loading-doors’, and sets the frame to 30 when begin-load is called (to open the doors), and 0 when end-load is called (to close the door). The default index is 0 (the animation frame will be at 0), and the animation duration is 1.5 seconds.<br />
{<br />
enabled 0<br />
property-visibility 0<br />
property-id "p_doors"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "loading-doors"<br />
values "0,30"<br />
trigger "event"<br />
events "end-load,begin-load"<br />
duration 1.5<br />
default-index 0<br />
}<br />
<br />
An alternate way to do it is use mesh-attachment-type "mesh-animation-state", and set a bool int (0 or 1) for the values tag.<br />
{<br />
enabled 0<br />
property-visibility 0<br />
property-id "p_doors"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-state"<br />
meshes "loading-doors"<br />
values "0,1"<br />
trigger "event"<br />
events "end-load,begin-load"<br />
default-index 0<br />
}<br />
<br />
If you want two doors to open at the same time, instead of creating another property, you can use a semicolon split in the values tag to change two in a single property:<br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "door-1,door-2"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.0<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of Weather-Based property example--><br />
<table width=1200><tr><td> <br />
===Weather-Based Texture Replacement===<br />
The texture effect will change based on the weather. It will display a snowy texture when the weather type is 6 (medium snow), a wet, rainy texture when the weather type is 3 (rain), and a dry texture when the weather type is 0.<br />
{<br />
enabled 1<br />
property-visibility 0<br />
property-id "p_weather_skin"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
effects "texture-weather"<br />
files-path "images/,.texture"<br />
values "texture-snow,texture-rain,texture-dry"<br />
default-index 0<br />
trigger "event"<br />
events "weather-6,weather-3,weather-0"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of day and night lights example--><br />
<table width=1200><tr><td> <br />
===Day and Night Light Control===<br />
WagonX Version 1.2 or greater only.<br><br />
This event property controls a set of eight exteruir lights on a traincar that must turn on for night and off for day. It also requires a locomotive at the head of its train for the lights to come on.<br />
<br><br />
The property is a kind fx-replacement of type corona. Turning a corona on and off requires a valid corona to be turned on and usually a null value to turn it off. In this case, instead of a null, we will use an invisible mesh, <kuid:217537:100812>, to achieve the same result. We do this because WagonX needs to obtain an asset from the asset kuid-table.<br><br />
There are two events to consider: the "World, Day" message represented as "world-day", and the "World, Night" message represented as "world-night".<br />
The requirement for a loco requires a conditions tag using the logic described at (insert link when tech ref updated). The results are boolean (false or true) and the first will be true if no loco exists at the head of the train, and the second if there is a loco. So the possible results are "1;0" (no loco) or "1;0" (loco exists) using the WagonX syntax.<br><br />
The effects tag contains a list of the corona effects from the asset mesh-table. Each is separated by a comma.<br><br />
The values tag contains two sets of kuid-table mesh references. Each set is separated by a comma, and the list within each set separated by a semi-colon. The first set turns off the eight coronas when the loco doesn't exist, and the second set turns the coronas on using the same corona asset for each light. You could have different coronas.<br />
{<br />
enabled 1<br />
property-visibility 0<br />
property-id "p_exterior_lights"<br />
kind "fx-replacement"<br />
fx-replacement-type "corona"<br />
duration 0 <br />
effects "leftlight-0,leftlight-1,leftlight-2,leftlight-3,rightlight-0,rightlight-1,rightlight-2,rightlight-3"<br />
values "nl;nl;nl;nl;nl;nl;nl;nl,exla;exla;exla;exla;exla;exla;exla;exla" <br />
trigger "multiple"<br />
conditions "tra_frontmost-locomotive|==|0,tra_frontmost-locomotive|==|1"<br />
events "world-day,world-night<br />
}<br />
...<br />
kuid-table {<br />
...<br />
exla <kuid:104722:100> // a white corona<br />
nl <kuid:217537:100812> // an invisible mesh<br />
} <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
===Day and Night Interior Control===<br />
WagonX Version 1.2 or greater only.<br><br />
This example controls the visibility of day and night traincar interiors using the "World, Day/Night" messages. The night interior will not show unless a locomotive is at the head of the traincar's train.<br><br />
{<br />
enabled 1<br />
property-visibility 0<br />
property-id "p_interior_lighting"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "day-interior,night-interior"<br />
values "1;0,0;1"<br />
default-index 0<br />
duration 0<br />
trigger "multiple"<br />
conditions "tra_frontmost-locomotive|==|0,tra_frontmost-locomotive|==|1"<br />
events "world-day,world-night"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of discussion about use of semicolons--><br />
<table width=1200><tr><td> <br />
== Using semicolons to set multiple values in one property ==<br />
When assigning values for a certain property, you will specify the mesh/effect/sound, etc that needs to be edited, and specify how you want to manipulate it (fx-replacement-type, mesh-attachment-type, etc), and set the value for a certain index. For example, In a texture replacement where a texture is being replaced by an external texture-group asset, the property would look something like this.<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin_parameter"<br />
description "Sets The Texture"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "texture-albedo"<br />
asset "texturelib"<br />
values "1,2,3,4"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin1,Skin2,Skin3,Skin"<br />
}<br />
<br />
As you can see, the comma-separated numbers in the “values” tag indicate the index in the texture-group asset to find the texture; here are the first few lines for that. Texture indexes 0, 1, 2, and 3 are referenced for the albedo texture types, since we have 4 weathering types.<br />
<br />
kuid <kuid2:661805:500009:0><br />
username "BR GrainHop Texture Group"<br />
kind "texture-group"<br />
trainz-build 5.0<br />
category-class "JO"<br />
author "dundun92"<br />
contact-email "jbvector93@outlook.com"<br />
description "A texture group for my GrainHop wagons"<br />
textures<br />
{<br />
0 "270cgo/0albedo.texture"<br />
1 "270cgo/1albedo.texture"<br />
2 "270cgo/2albedo.texture"<br />
3 "270cgo/2albedo.texture"<br />
4 "270cgo/0parameter.texture"<br />
5 "270cgo/1parameter.texture"<br />
6 "270cgo/2parameter.texture"<br />
.........<br />
}<br />
<br />
We specified the texture-group library in the kuid table, and referenced it in the “asset” tag.<br />
kuid-table<br />
{<br />
acslib <kuid2:60850:89100><br />
meshlib <kuid2:661805:500002><br />
texturelib <kuid2:661805:500009><br />
lamp <kuid2:661805:500003><br />
enginespec <kuid2:368699:50064><br />
bogie <kuid2:661805:400003><br />
}<br />
<br />
And then we specified the effect we wanted to change, (currently just the texture-albedo), inside the “effects” tag (this is not the effects tag below in this mesh table asset, but rather the one in the browser-properties at the top of this section!).<br />
body<br />
{<br />
mesh "mesh/body.lm"<br />
auto-create 1<br />
att-parent "default"<br />
effects<br />
{<br />
texture-albedo<br />
{<br />
kind "texture-replacement"<br />
texture "covhopp-1_albedo.texture"<br />
}<br />
texture-normal<br />
{<br />
kind "texture-replacement"<br />
texture "covhopp-1_normal.texture"<br />
}<br />
texture-parameter<br />
{<br />
kind "texture-replacement"<br />
texture "covhopp-1_parameter.texture"<br />
}<br />
}<br />
}<br />
<br />
But say you want to replace the normal map as well. You would probably just create another browser property and specify the proper index for the normals.<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin_parameter"<br />
description "Sets The Paramenter Texture"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "texture-albedo"<br />
asset "texturelib"<br />
values "1,2,3,4"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin1,Skin2,Skin3,Skin4"<br />
}<br />
1<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin_normal"<br />
description "Sets The Normal Texture"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "texture-normal"<br />
asset "texturelib"<br />
values "7,8,9,10"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin1,Skin2,Skin3,Skin4"<br />
}<br />
<br />
But we can't forget the parameter map… that will require a third property. What's worse, we will now have three different properties in the view details page that will each have to be clicked on to change each map! Assigning properties this way can get tedious and create extra clutter in the config. Thankfully, for properties that share the same kind and type, it can all be done in a single property using semicolons:<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin"<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
<b>effects "texture-albedo,texture-parameter,texture-normal"</b><br />
asset "texturelib"<br />
files-path "null"<br />
<b>values "0;4;8,1;5;9,2;6;10,3;7;11"</b><br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
<b>display-values "Clean,Weathered,Dirty,Rusty"</b><br />
}<br />
<br />
Take note of the three tag entries above: the <b>effects</b>, <b>values</b> and <b>display-values</b> tags. The <b>display-values</b> tag is what the user sees and can choose from. Our interest is in the remaining two tags as shown below:<br />
<br />
effects "texture-albedo,texture-parameter,texture-normal"<br />
values "0;4;8,1;5;9,2;6;9,3;7;11" <br />
<br />
There are four user options and, since each option requires three textures, the total number of textures is 12. The <b>values</b> tag contains a string of four groups of texture numbers separated by a comma. Within each texture group the texture numbers are delimited by a semi colon.<br />
<br />
To clarify, we can list the three textures associated with each user choice:<br />
<br />
0;4;8 -> Clean<br />
1;5;9 -> Weathered<br />
2;6;10 -> Dirty<br />
3;7;11 -> Rusty<br />
<br />
The first column of 0,1,2,3 identify the albedo textures. The second column of 4,5,6,7 identify the parameters textures, The third column of 8,9,10,11 identify the normal textures. Note that the numbers do not need to be in sequence or even consecutive. All those numbers do is to identify the correct texture in the texture-group asset.<br />
<br />
<br />
This system works for other kinds of properties, too. In this case, we are setting the animation frame of both the handbrake-lever, and braking system at the same time using the same property (triggered by the same event).<br />
<br />
1 <br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "handbrake-lever,braking-system"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.2<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
<br />
</td></tr></table><br />
<br />
<!--start of discussion about Naming ACS mesh-table attachments--><br />
<table width=1200><tr><td> <br />
== Naming ACS mesh-table attachments ==<br />
Please refer to this page on the ACS coupling system for setting up the “active-coupling-standard-60850” extensions container (which will be required for the ACS coupling to work): [[ACS_Coupling_System|ACS Coupling System]]<br />
<br />
These are the mesh-table naming conventions you must use for the beginning of the name of each ACS attachment mesh. The others will vary depending on the “animated” property above. <b>You must spell them exactly as shown below</b>.<br />
<br />
*coupler<br />
*gangway<br />
*airbrake<br />
*vacbrake<br />
*multiworking<br />
*heating<br />
*rch<br />
<br />
If the “animated” tag in the acs container (see [[HowTo/WagonX_-_Technical_Reference#ACS|acs]]) is set to 1, then the naming is quite simple. It's one of the 7 callbacks above + a dash + “<i>front</i>” or “<i>back</i>”. The anim tag must be present to specify the animation for it. Frame 0 is the uncoupled state, and the last frame is the coupled state. This setup is shown below:<br />
<br />
coupler-front<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-animated.lm"<br />
anim "coupler-screwlink-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
coupler-back<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-animated.lm"<br />
anim "coupler-screwlink-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
vacbrake-front<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-animated.lm"<br />
anim "vacbrake-single-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-back<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-animated.lm"<br />
anim "vacbrake-single-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
<br />
If, however, you do not want to use animations, but want to use separate meshes for each state (coupled and uncoupled), it gets a bit more complicated. The naming will follow the same as above at first, but you must add a third piece to it to specify the exact type of ACS attachment this is. The information on what to put there is originally from the [[ACS_Coupling_SystemACS Coupling System|ACS page]], but the 7 callbacks have been added plus the sub-callback here to make it easier (the third callback options are the ones with a delta symbol &Delta; ). And for the uncoupled state, the third callback is “non” (e.g. coupler-front-screwlink, and coupler-front-none).<br />
<br />
*coupler<br />
:*front/back<br />
::&Delta; "<b>hook</b>" -- connects to screwlink/instanter/3link/hst-emergency-bar.<br />
::&Delta; "<b>3link</b>" -- connects to hook.<br />
::&Delta; "<b>instanter</b>" -- connects to hook.<br />
::&Delta; "<b>screwlink</b>" -- connects to hook.<br />
::&Delta; "<b>hst-emergency-bar</b>" -- connects to hook.<br />
::&Delta; "<b>bar-full</b>" -- connects to "bar-none". Half of a handed pair for when one vehicle has the entire bar coupling.<br />
::&Delta; "<b>bar-none</b>" -- connected to by "bar-full". The other half of the handed pair.<br />
::&Delta; "<b>bar</b>" -- connects to self only. Used when both vehicles have half the bar coupling.<br />
::&Delta; "<b>knuckle</b>" - standard knuckle coupler.<br />
::&Delta; "<b>tightlock</b>" -- different from a standard knuckle, refers to a knuckle style coupler often fitted to multiple unit trains that also include electrical connections.<br />
::&Delta; "<b>wedgelock</b>" -- London Underground coupler.<br />
::&Delta; "<b>bsi</b>" -- Found on Sprinter DMUs and derived designs.<br />
::&Delta; "<b>dellner</b>" -- Also compatible with Scharfenberg coupling.<br />
::&Delta; "<b>scharfenberg</b>" -- Also compatible with dellner coupling.<br />
::&Delta; "(<b>other string identifier</b>)" -- Any string that is not recognized from the above list is assumed to be a symmetrical meet-in-the-middle type of coupler.<br />
::&Delta; “<b>none</b>”<br />
::Examples: <b>coupler-front-instanter</b>, coupler-back-none<br />
<br />
*gangway<br />
:*front/back<br />
::&Delta; <b>rubbing-plate</b><br />
::&Delta; <b>gangway</b><br />
::&Delta; <b>none</b><br />
::Example: <b>gangway-front-gangway</b><br />
<br />
*airbrake<br />
:*front/back<br />
::&Delta; <b>twin</b><br />
::&Delta; <b>single</b><br />
::&Delta; <b>none</b><br />
::Example: <b>airbrake-back-none</b><br />
<br />
*vacbrake<br />
:*front/back<br />
::&Delta; <b>twin</b><br />
::&Delta; <b>single</b><br />
::&Delta; <b>high</b><br />
::&Delta; <b>none</b><br />
::Example: <b>vacbrake-back-twin</b><br />
<br />
*multiworking<br />
::front/back<br />
::&Delta; "(color)-(shape)" -- e.g. "<b>blue-star</b>" or "<b>red-diamond</b>", etc<br />
::&Delta; "<b>AAR</b>" -- as used on GM locos<br />
::&Delta; "<b>SR27</b>" -- bagpipes<br />
::&Delta; "(other identifier string e.g. classname)"<br />
::Example: <b>multiworking-front-blue-square</b><br />
<br />
*heating<br />
::front/back<br />
::&Delta; "<b>none</b>"<br />
::&Delta; "<b>steam</b>"<br />
::&Delta; "<b>electric</b>"<br />
::&Delta; "<b>dual</b>"<br />
::&Delta; "<b>southern-electric</b>" <br />
::Example: <b>heating-back-steam</b><br />
<br />
*rch<br />
::front/back<br />
::&Delta; "<b>high</b>"<br />
::&Delta; "<b>low</b>"<br />
::&Delta; "<b>none</b>"<br />
::Example: <b>rch-back-high</b><br />
<br />
And an example how it would look inside a config.txt. The back attachments have been omitted for brevity. <br />
<br />
coupler-front-screwlink<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-coupled.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
coupler-front-none<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-retracted.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-front-single<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-coupled.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-front-none<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-retracted.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
<br />
<table width=1200><br />
=Copyright Notice=<br />
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.<br />
</table></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Technical_ReferenceHowTo/WagonX - Technical Reference2024-02-23T05:02:46Z<p>Pcas1986: /* default-index */ added a warning about setting a default value.</p>
<hr />
<div>= Document Structure =<br />
<table width=1200><br />
<tr><td>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:<br />
</td></tr><br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
<br><br />
<br />
__TOC__<br />
<br />
= The WagonX Reference =<br />
<table width=1200><br />
<tr><td>This page contains details of the WagonX extension container and sub-containers. Practical examples of usage can be found in the tutorials listed above.<br />
</td></tr><br />
</table> <br />
<br><br />
= Restricted Characters =<br />
<table width=1200><br />
<tr valign="top"><br />
<td>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 [[HowTo/WagonX - Technical Reference#display-values|display-values]].<br />
</td><br />
</tr><br />
<br />
<tr><br />
<td><br />
*Comma ( , )<br />
*Semicolon ( ; )<br />
*Backtick ( ` )<br />
*Colon ( : ) <br />
</td><br />
</tr><br />
</table><br />
<br><br />
= General Layout =<br />
<table width=1200><br />
<tr valign="top"><br />
<td>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:<br />
</td><br />
</tr><br />
<tr><td><br />
extensions<br />
{<br />
max_permitted_speed-60850 "50mph"<br />
active-coupling-standard-60850<br />
{<br />
...<br />
}<br />
wagon-x<br />
{<br />
...<br />
}<br />
}<br />
</td></tr><br />
</table><br />
<br><br />
<br />
= WagonX Properties =<br />
<table width=1200><br />
<tr valign="top"><br />
<td>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.<br />
</td><br />
</tr><br />
</table><br />
== ACS ==<br />
<!--start of ACS table--><br />
<table width=1200><br />
For help on creating the acs extensions and setting up the acs mesh-table objects, see [[HowTo/WagonX_-_Browser_Properties_Examples_and_Basic_Tutorials#Naming_ACS_mesh-table_attachments|Naming ACS mesh-table attachments]].<br />
<br><br />
Each tag is shown here with sample values. There are no default values.<br />
<tr><td><br />
acs<br />
{<br />
animated 1<br />
use-jbv-animation 1<br />
duration 1.0<br />
}<br />
<br />
*<b>animated (1 = true, 0=false)</b><br />
:This determines whether to use animations to move between the coupled and uncoupled state, or use individual static assets for each state.<br />
*<b>use-jbv-animation (1 = true, 0=false)</b><br />
: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.<br />
*<b>duration (a floating point value)</b><br />
: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)<br />
</td></tr><br />
</table> <!--end of ACS table--><br />
<br><br />
<br />
== Misc ==<br />
<!--start of Misc table--><br />
<table width=1200><br />
<!--Note for page author - is this for proper industries such as cargo or is it used for passengers at stations as well?--><br />
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.<br />
<br />
Each available tag is shown here with sample values. There are no defaults.<br />
<tr><td><br />
misc<br />
{<br />
begin-load-time 5.0<br />
begin-unload-time 5.0<br />
end-load-time 1.0<br />
end-unload-time 1.0<br />
}<br />
<br />
*<b>begin-load-time (a floating point value)</b><br />
:The time it takes for the wagon to load at an industry<br />
*<b>begin-unload-time (a floating point value)</b><br />
:The time it takes for the wagon to unloading at an industry<br />
*<b>end-load-time (a floating point value)</b><br />
:The time it takes for the wagon end loading at an industry<br />
*<b>end-unload-time (a floating point value)</b><br />
:The time it takes for the wagon to end unloading at an industry<br />
</td></tr><br />
</table><br />
<!--end of misc table--><br />
<br />
== Marker-Lights ==<br />
<!--start of Marker-Lights table--><br />
<table width=1200><br />
The Marker-Lights container is used to show or hide light meshes that are identied by entries in the config mesh-table.<br />
<br />
Each tag is shown here with sample values. There are no defaults. <br />
<tr><td><br />
marker-lights<br />
{<br />
enabled 1<br />
car-minimum-count 1<br />
require-locomotive 1<br />
night-only 0<br />
front<br />
{<br />
head<br />
{<br />
mesh "null"<br />
}<br />
tail<br />
{<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back<br />
{<br />
head<br />
{<br />
mesh "lamp-back-white"<br />
}<br />
tail<br />
{<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
<br />
<br />
*<b>enabled (1 = true, 0=false)</b><br />
:Whether or not the marker lights are active on this asset.<br />
*<b>car-minimum-count (an integer number)</b><br />
:The minimum number of cars that must be present in the consist for the marker-lights to activate.<br />
*<b>require-locomotive (1 = true, 0=false)</b><br />
:If set to 1, a traincar of Class locomotive will need to be present in the consist for the marker-lights to activate.<br />
*<b>night-only (1 = true, 0=false)</b><br />
:If set to 1, the lamps will only be visible at night, otherwise they will be displayed 24/7.<br />
*<b>Front/back head/tail containers</b><br />
:These containers identify the mesh to use for the front, back, head, and tail lamps. These meshes must be in the config mesh-table.<br />
</td></tr></table><br />
<!--end of Marker-Lights table--><br />
<br />
== Browser-Properties ==<br />
<!--start of Browser-Properties container table--><br />
<table width=1200><br />
<tr><td><br />
*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.<br />
*A property can have sub properties that are activated with their parent.<br />
*A property container has a number of tags with values. Many are common to different property types but some are unique to a property.<br />
*A container need not contain all available tags.<br />
*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,<br />
</td></tr><br />
<br />
<tr><td><br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin"<br />
consist-property-sync 1<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
effects "texture-albedo,texture-parameter"<br />
asset "texturelib"<br />
files-path "null"<br />
values "0;3,1;4,2;5"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Clean,Weathered,Dirty"<br />
}<br />
1<br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "handbrake-lever,braking-system"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.2<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
}<br />
</td></tr><br />
</table><br />
<br />
<table width=1200><tr><td> <br />
===Supported Tags===<br />
Tag explanations. Some examples are included in the definition and, for others, see above for sample of usage.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====enabled====<br />
:Type: Boolean (1 = true, 0=false)<br />
:Compulsory: No<br />
:Default: No default.<br />
:Desc: Whether or not this property is active. This is useful for debugging, or if you want to disable it without removing everything.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====property-visibility====<br />
:Type: Integer - (0 = Hidden, 1 = Visible, 2 = Surveyor Only, 3 = Driver Only) <br />
:Compulsory: No<br />
:Default: 0 (hidden)<br />
:Desc: Indicates whether the property will be visible in the Properties Browser and in what mode. <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====name====<br />
:Type: String<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: The display name of this property, as will appear on the properties page.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====child-properties====<br />
:Type: A string of numbers separated by commas.<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: child-properties "2,4,5"<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====property-id====<br />
:Type: String<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: The formal name (ID) of this property, used to identify and change this property. For example, If the name is <b>Workflow</b>, it might be a good idea to call this <b>p_workflow</b>. <div style="color: #ff0080">This must be unique for each browser-property</div>.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====consist-property-sync====<br />
:Type: Integer - (0 off, 1 on (button), 2 on (automatic)<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====property-sync-id====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: property-sync-id "soundBell"<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====description====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The description of this attachment as it will appear in the Properties Browser.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====kind====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The type of property this will be. Can be one of the options below. Most of these are derived from [[Class MeshObject|Class_MeshObject]]. For more info on implementing these, see [[HowTo/WagonX - Technical Reference#values]].<br />
::*mesh-attachment<br />
:::Manipulate the mesh’s animation, position, visibility, etc. See mesh-attachment-type.<br />
::*fx-replacement<br />
:::Change an effect in the mesh. See [[HowTo/WagonX - Technical Reference#fx-replacement-type]].<br />
::*particle-effect<br />
:::Activate/Deactivate/Edit a particle effect (smoke0, smoke1, etc). See [[HowTo/WagonX - Technical Reference#particle-effects]] and [[HowTo/WagonX - Technical Reference#particle-effect-type]].<br />
::*sound-script<br />
:::Used to play a sound-script sound within this asset. See [[HowTo/WagonX - Technical Reference#sound-triggers]].<br />
::*config-edit<br />
:::Used to edit a tag in the wagon-x config soup. See paths.<br />
<!--need to come back and check this as I don't understand how this works--><br />
====particle-effect-type====<br />
:Type: String (kind mesh-attachment only)<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: kind "particle-effect"<br />
: particle-effect-type "pfx-message"<br />
::*[[pfx_Message|<span style="color: #0080ff">pfx-message</span>]]<br />
:::Send a message to enable/disable a particle effect.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start mesh-attachment--><br />
====mesh-attachment-type====<br />
:Type: String - (kind mesh-attachment only)<br />
:Example: kind "mesh-attachment"<br />
:: mesh-attachment-type "mesh-animation-frame"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
::*[[Class_MeshObject#SetMeshVisible|<span style="color: #0080ff">mesh-toggle</span>]]<br />
:::Toggle between the mesh(s) being visible or hidden.<br />
::*[[Class_MeshObject#SetMeshOrientation|<span style="color: #0080ff">mesh-translation-orientation</span>]]<br />
:::Sets the translation and orientation of the mesh(es)<br />
::*[[Class_MeshObject#SetMeshAnimationFrame|<span style="color: #0080ff">mesh-animation-frame</span>]]<br />
:::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.<br />
::*[[Class_MeshObject#StartMeshAnimationLoop|<span style="color: #0080ff">mesh-animation-loop</span>]]<br />
:::Start or stop an animation-loop on the mesh.<br />
::*[[Class_MeshObject#SetMeshAnimationState|<span style="color: #0080ff">mesh-animation-state</span>]]<br />
:::Sets the state of the mesh(s) animation.<br />
::*[[Class_MeshObject#SetMeshAnimationSpeed|<span style="color: #0080ff">mesh-animation-speed</span>]]<br />
:::Changes the speed of the meshes animation.<br />
<!--end mesh-attachment--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start fx-replacement-type--><br />
====fx-replacement-type====<br />
:Type: String)(kind fx-replacement only)<br />
:Example: kind "fx-replacement"<br />
:::fx-replacement-type "texture-replacement"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
::*[[Class_MeshObject#SetFXTextureReplacement|<span style="color: #0080ff">texture-replacement</span>]]<br />
:::Replaces a texture effect in this asset to one within a texture-group asset.<br />
::*[[Class_MeshObject#SetFXTextureReplacementTexture|<span style="color: #0080ff">texture-replacement-texture</span>]]<br />
:::Replaces a texture effect in this asset to one located within this asset.<br />
::*[[Class_MeshObject#SetFXCoronaTexture|<span style="color: #0080ff">corona</span>]]<br />
:::Replaces a corona effect in the asset.<br />
::*[[Class_MeshObject#SetFXNameText|<span style="color: #0080ff">name</span>]]<br />
:::Replaces a name effect in the asset.<br />
::*[[Class_MeshObject#SetFXAttachment|<span style="color: #0080ff">attachment</span>]]<br />
:::Replaces an attachment effect in the asset.<br />
::*[[Class_MeshObject#SetFXAnimationState|<span style="color: #0080ff">animation</span>]]<br />
:::Plays/Stops an animation effect in the asset.<br />
<!--end fx-replacement-type--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start duration--><br />
====duration====<br />
:Type: Float<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>(There may be issues with using this tag with mesh-toggle.)</b><br />
:Example: duration 3.2<br />
<!--end duration--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start meshes--><br />
====meshes====<br />
:Type: String - (a list of mesh names from the mesh-table separated by commas)<br />
:Example: meshes "handbrake-lever,braking-system"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end meshes--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start of effects (textures)--><br />
====effects====<br />
:Type: String - (a list of texture names (i.e. texture.txt names without the .txt) each separated by a comma)<br />
:Example: effects "texture-albedo,texture-parameter"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end of effects--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start of particle-effects--><br />
====particle-effects====<br />
:Type: String - (a list of integer numbers as a string)<br />
:Example: particle-effects "0,1"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: For kind particle-effect. The comma-separated list of PFX effects to be modified by the property. See kind for help on implementation. <b>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.</b><br />
<!--end particle-effects--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start target-asset tag--><br />
====target-asset====<br />
:Type: String<br />
:Example: target-asset "bogey-0"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>Only properties of kind “mesh-attachment” or “fx-replacement” can be used for properties that use this tag.</b><br />
<!--end target-asset tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start asset tag--><br />
====asset====<br />
:Type: String<br />
:Example: asset "texturelib"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end asset tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start files-path tag--><br />
====files-path====<br />
:Type: String - (a list of two strings)<br />
:Example: files-path "images/,.texture"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>files-path “images/left/.texture”</b>), where images/left is the path, and .texture is the extension for all the files.<br />
<!--end files-path tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start paths tag--><br />
<!--THIS DOESN'T LOOK RIGHT - CHECK--><br />
====paths====<br />
:Type: String - (a list of two strings)<br />
:Example: paths "marker-lights/night-only""<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: For kind config-edit. A comma-separated list of paths that point to the tag in the wagon-x config to edit.<br />
<!--end paths tag--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start values tag--><br />
====values====<br />
:Type: String - (a string list separated by special characters)<br />
:Example1 values "0,15,30"<br />
:Compulsory: No<br />
:Default: None<br />
: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]].<br />
:<b>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.</b><br />
<!--mesh-attachment--><br />
:::*For kind mesh-attachment:<br />
::::*For mesh-attachment-type mesh-toggle, the value must be either 0 or 1 (visible/hidden) ???<br />
::::*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).<br />
::::Example: values "(0`2`4):(1.2`2`2),(0`0`0):(0`0`0)"<br />
<!--mesh-attachment-type--><br />
:::*For mesh-attachment-type mesh-animation-speed, the value is the speed of the animation for that index<br />
:::*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.<br />
:::*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 [[Class_MeshObject#GetMeshAnimationFrameCount|<span style="color: #0080ff">GetMeshAnimationFrameCount</span>]]).<br />
::::Example: values "0,30"<br />
:::*For mesh-attachment-type mesh-animation-loop, the value can be 0 or 1, to start/stop the loop<br />
<!--sound-script--><br />
:::*For kind sound-script, the value can be 0 or 1, to start/stop the soundscript event<br />
<!--config-edit--><br />
:::*For kind config-edit, the value is a string indicating the string value to assign to the config tag.<br />
<!--particle-effect--><br />
:::*For kind particle-effect:<br />
:::*For particle-effect-type pfx-message, the value follows the same rules for [[pfx message|<span style="color: #0080ff">pfx messages</span>]].<br />
::::*particle-effect-type "pfx-message"<br />
::::Example: values "+0+1,-1-0"<br />
<!--fx-replacement--><br />
:::*For kind fx-replacement:<br />
::::*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:<br />
::::Values “0,2,1” will reference the textures in the texture container at indexes 0, 2, and 1, in that order when cycled through.<br />
::::Example: values “0,2,1”<br />
<br />
kuid <kuid:1234:123456><br />
username "test texture group asset"<br />
trainz-build 4.6<br />
description "test texture group"<br />
textures<br />
{<br />
0 "textures\0albedo.texture"<br />
1 "textures\1albedo.texture"<br />
2 "textures\2albedo.texture"<br />
3 "textures\0parameter.texture"<br />
4 "textures\1parameter.texture"<br />
5 "textures\2parameter.texture" <br />
6 "textures\0normal.texture"<br />
7 "textures\1normal.texture"<br />
8 "textures\2normal.texture" <br />
}<br />
<br />
<br />
::::*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. <br />
::::Example: values "images/congleton.texture,images/burntisland.texture,images/buxton.texture,images/none.texture"<br />
::::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:<br />
::::Example: values "congleton,burntisland,buxton,none" <br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Workflow Text: "<br />
property-id "p_workflow"<br />
description "Sets the Workflow"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
consist-property-sync 1<br />
meshes "null"<br />
effects "texture-extra"<br />
asset "null"<br />
files-path "images/,.texture"<br />
values "congleton,burntisland,buxton,none"<br />
default-index 0<br />
trigger "user"<br />
display-type "list"<br />
display-values "Congleton,Burntisland,Buxton,None"<br />
}<br />
<br />
::::*For fx-replacement-type attachment, the values are the names of the attachment effects to be replaced by the specified [[HowTo/WagonX - Technical Reference#asset]].<br />
::::*For fx-replacement-type corona, the values are the names of the corona effects to be replaced by the specified [[HowTo/WagonX - Technical Reference#asset]].<br />
::::*For fx-replacement-type animation, the values are the names of the animation effects to be replaced by the specified [[HowTo/WagonX - Technical Reference#asset]].<br />
::::*For fx-replacement-type name, the values are the names that will replace the current name of the specified name effect. <br />
<!--end values tag--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start default-index--><br />
====default-index====<br />
:Type: Integer (-1 = random)<br />
:Example: default-index 0<br />
:Compulsory: No<br />
:Default: 0<br />
: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.<br><br />
Warning: If you have a list of values such as "1,2,3,4" and you want to set a default, then you should subtract 1 from the preferred value. For example if you want the first in the list then set the default to 0. This is because the browser counts the list entries from 0 and not 1.<br />
<!--end default-index--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start sound-triggers--><br />
<br />
====sound-triggers====<br />
:Type: String - (a list of strings)<br />
:Example: sound-triggers "bell_1,bell_2"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end sound-triggers--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start trigger--><br />
====trigger====<br />
:Type: String<br />
:Example: trigger "user"<br />
:Compulsory: No<br />
:Default: Null (ignored)<br />
: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:<br />
:::*user<br />
:::*event<br />
:::*both<br />
:::*none <br />
<!--end trigger--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start events--><br />
====events====<br />
:Type: String - (a list of strings)<br />
:Example: events "handbrake-release,handbrake-apply"<br />
:Compulsory: No<br />
:Default: None<br />
: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). <br />
:::*begin-load/end-load/begin-unload/end-unload<br />
:::*handbrake-apply/handbrake-release<br />
:::*trainbrake-apply/trainbrake-release<br />
:::*headlight-on, headlight-off<br />
:::*horn<br />
:::*bell<br />
:::*sanding<br />
:::*pantograph-state-0/1/2/3 (see [[Class_Train#GetPantographState|<span style="color: #0080ff">GetPantographState</span>]])<br />
:::*weather-0/1/2/3/4/5/6/7 (see [[Class_World#GetWeatherType|<span style="color: #0080ff">GetWeatherType</span>]])<br />
:::*world-day/world-night<br />
:::*queue-(0 - ?)- loaded/empty (e.g. <b>queue-0-loaded, queue-1-empty</b>)<br />
<!--end events--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start display-type--><br />
:Type: String<br />
:Example: display-type "link"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>For trainzbuild 5.1 and 5.0, only link is supported for the View Details page.</b> Omitting this tag in combination with property-visibility set to 0 is useful for non-user triggers, such as world or train events.<br />
:::*string<br />
:::*int<br />
:::*float<br />
:::*list<br />
:::*link <br />
<!--end display-type--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start display-values--><br />
====display-values====<br />
:Type: String - (a list of strings)<br />
:Example: display-values "Clean,Weathered,Dirty"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end display-values--> <br />
</td></tr></table><br />
<br />
<br />
<table width=1200><br />
=Copyright Notice=<br />
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.<br />
</table></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Technical_ReferenceHowTo/WagonX - Technical Reference2024-02-21T05:01:57Z<p>Pcas1986: Corrected some broken links</p>
<hr />
<div>= Document Structure =<br />
<table width=1200><br />
<tr><td>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:<br />
</td></tr><br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
<br><br />
<br />
__TOC__<br />
<br />
= The WagonX Reference =<br />
<table width=1200><br />
<tr><td>This page contains details of the WagonX extension container and sub-containers. Practical examples of usage can be found in the tutorials listed above.<br />
</td></tr><br />
</table> <br />
<br><br />
= Restricted Characters =<br />
<table width=1200><br />
<tr valign="top"><br />
<td>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 [[HowTo/WagonX - Technical Reference#display-values|display-values]].<br />
</td><br />
</tr><br />
<br />
<tr><br />
<td><br />
*Comma ( , )<br />
*Semicolon ( ; )<br />
*Backtick ( ` )<br />
*Colon ( : ) <br />
</td><br />
</tr><br />
</table><br />
<br><br />
= General Layout =<br />
<table width=1200><br />
<tr valign="top"><br />
<td>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:<br />
</td><br />
</tr><br />
<tr><td><br />
extensions<br />
{<br />
max_permitted_speed-60850 "50mph"<br />
active-coupling-standard-60850<br />
{<br />
...<br />
}<br />
wagon-x<br />
{<br />
...<br />
}<br />
}<br />
</td></tr><br />
</table><br />
<br><br />
<br />
= WagonX Properties =<br />
<table width=1200><br />
<tr valign="top"><br />
<td>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.<br />
</td><br />
</tr><br />
</table><br />
== ACS ==<br />
<!--start of ACS table--><br />
<table width=1200><br />
For help on creating the acs extensions and setting up the acs mesh-table objects, see [[HowTo/WagonX_-_Browser_Properties_Examples_and_Basic_Tutorials#Naming_ACS_mesh-table_attachments|Naming ACS mesh-table attachments]].<br />
<br><br />
Each tag is shown here with sample values. There are no default values.<br />
<tr><td><br />
acs<br />
{<br />
animated 1<br />
use-jbv-animation 1<br />
duration 1.0<br />
}<br />
<br />
*<b>animated (1 = true, 0=false)</b><br />
:This determines whether to use animations to move between the coupled and uncoupled state, or use individual static assets for each state.<br />
*<b>use-jbv-animation (1 = true, 0=false)</b><br />
: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.<br />
*<b>duration (a floating point value)</b><br />
: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)<br />
</td></tr><br />
</table> <!--end of ACS table--><br />
<br><br />
<br />
== Misc ==<br />
<!--start of Misc table--><br />
<table width=1200><br />
<!--Note for page author - is this for proper industries such as cargo or is it used for passengers at stations as well?--><br />
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.<br />
<br />
Each available tag is shown here with sample values. There are no defaults.<br />
<tr><td><br />
misc<br />
{<br />
begin-load-time 5.0<br />
begin-unload-time 5.0<br />
end-load-time 1.0<br />
end-unload-time 1.0<br />
}<br />
<br />
*<b>begin-load-time (a floating point value)</b><br />
:The time it takes for the wagon to load at an industry<br />
*<b>begin-unload-time (a floating point value)</b><br />
:The time it takes for the wagon to unloading at an industry<br />
*<b>end-load-time (a floating point value)</b><br />
:The time it takes for the wagon end loading at an industry<br />
*<b>end-unload-time (a floating point value)</b><br />
:The time it takes for the wagon to end unloading at an industry<br />
</td></tr><br />
</table><br />
<!--end of misc table--><br />
<br />
== Marker-Lights ==<br />
<!--start of Marker-Lights table--><br />
<table width=1200><br />
The Marker-Lights container is used to show or hide light meshes that are identied by entries in the config mesh-table.<br />
<br />
Each tag is shown here with sample values. There are no defaults. <br />
<tr><td><br />
marker-lights<br />
{<br />
enabled 1<br />
car-minimum-count 1<br />
require-locomotive 1<br />
night-only 0<br />
front<br />
{<br />
head<br />
{<br />
mesh "null"<br />
}<br />
tail<br />
{<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back<br />
{<br />
head<br />
{<br />
mesh "lamp-back-white"<br />
}<br />
tail<br />
{<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
<br />
<br />
*<b>enabled (1 = true, 0=false)</b><br />
:Whether or not the marker lights are active on this asset.<br />
*<b>car-minimum-count (an integer number)</b><br />
:The minimum number of cars that must be present in the consist for the marker-lights to activate.<br />
*<b>require-locomotive (1 = true, 0=false)</b><br />
:If set to 1, a traincar of Class locomotive will need to be present in the consist for the marker-lights to activate.<br />
*<b>night-only (1 = true, 0=false)</b><br />
:If set to 1, the lamps will only be visible at night, otherwise they will be displayed 24/7.<br />
*<b>Front/back head/tail containers</b><br />
:These containers identify the mesh to use for the front, back, head, and tail lamps. These meshes must be in the config mesh-table.<br />
</td></tr></table><br />
<!--end of Marker-Lights table--><br />
<br />
== Browser-Properties ==<br />
<!--start of Browser-Properties container table--><br />
<table width=1200><br />
<tr><td><br />
*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.<br />
*A property can have sub properties that are activated with their parent.<br />
*A property container has a number of tags with values. Many are common to different property types but some are unique to a property.<br />
*A container need not contain all available tags.<br />
*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,<br />
</td></tr><br />
<br />
<tr><td><br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin"<br />
consist-property-sync 1<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
effects "texture-albedo,texture-parameter"<br />
asset "texturelib"<br />
files-path "null"<br />
values "0;3,1;4,2;5"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Clean,Weathered,Dirty"<br />
}<br />
1<br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "handbrake-lever,braking-system"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.2<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
}<br />
</td></tr><br />
</table><br />
<br />
<table width=1200><tr><td> <br />
===Supported Tags===<br />
Tag explanations. Some examples are included in the definition and, for others, see above for sample of usage.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====enabled====<br />
:Type: Boolean (1 = true, 0=false)<br />
:Compulsory: No<br />
:Default: No default.<br />
:Desc: Whether or not this property is active. This is useful for debugging, or if you want to disable it without removing everything.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====property-visibility====<br />
:Type: Integer - (0 = Hidden, 1 = Visible, 2 = Surveyor Only, 3 = Driver Only) <br />
:Compulsory: No<br />
:Default: 0 (hidden)<br />
:Desc: Indicates whether the property will be visible in the Properties Browser and in what mode. <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====name====<br />
:Type: String<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: The display name of this property, as will appear on the properties page.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====child-properties====<br />
:Type: A string of numbers separated by commas.<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: child-properties "2,4,5"<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====property-id====<br />
:Type: String<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: The formal name (ID) of this property, used to identify and change this property. For example, If the name is <b>Workflow</b>, it might be a good idea to call this <b>p_workflow</b>. <div style="color: #ff0080">This must be unique for each browser-property</div>.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====consist-property-sync====<br />
:Type: Integer - (0 off, 1 on (button), 2 on (automatic)<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====property-sync-id====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: property-sync-id "soundBell"<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====description====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The description of this attachment as it will appear in the Properties Browser.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====kind====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The type of property this will be. Can be one of the options below. Most of these are derived from [[Class MeshObject|Class_MeshObject]]. For more info on implementing these, see [[HowTo/WagonX - Technical Reference#values]].<br />
::*mesh-attachment<br />
:::Manipulate the mesh’s animation, position, visibility, etc. See mesh-attachment-type.<br />
::*fx-replacement<br />
:::Change an effect in the mesh. See [[HowTo/WagonX - Technical Reference#fx-replacement-type]].<br />
::*particle-effect<br />
:::Activate/Deactivate/Edit a particle effect (smoke0, smoke1, etc). See [[HowTo/WagonX - Technical Reference#particle-effects]] and [[HowTo/WagonX - Technical Reference#particle-effect-type]].<br />
::*sound-script<br />
:::Used to play a sound-script sound within this asset. See [[HowTo/WagonX - Technical Reference#sound-triggers]].<br />
::*config-edit<br />
:::Used to edit a tag in the wagon-x config soup. See paths.<br />
<!--need to come back and check this as I don't understand how this works--><br />
====particle-effect-type====<br />
:Type: String (kind mesh-attachment only)<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: kind "particle-effect"<br />
: particle-effect-type "pfx-message"<br />
::*[[pfx_Message|<span style="color: #0080ff">pfx-message</span>]]<br />
:::Send a message to enable/disable a particle effect.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start mesh-attachment--><br />
====mesh-attachment-type====<br />
:Type: String - (kind mesh-attachment only)<br />
:Example: kind "mesh-attachment"<br />
:: mesh-attachment-type "mesh-animation-frame"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
::*[[Class_MeshObject#SetMeshVisible|<span style="color: #0080ff">mesh-toggle</span>]]<br />
:::Toggle between the mesh(s) being visible or hidden.<br />
::*[[Class_MeshObject#SetMeshOrientation|<span style="color: #0080ff">mesh-translation-orientation</span>]]<br />
:::Sets the translation and orientation of the mesh(es)<br />
::*[[Class_MeshObject#SetMeshAnimationFrame|<span style="color: #0080ff">mesh-animation-frame</span>]]<br />
:::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.<br />
::*[[Class_MeshObject#StartMeshAnimationLoop|<span style="color: #0080ff">mesh-animation-loop</span>]]<br />
:::Start or stop an animation-loop on the mesh.<br />
::*[[Class_MeshObject#SetMeshAnimationState|<span style="color: #0080ff">mesh-animation-state</span>]]<br />
:::Sets the state of the mesh(s) animation.<br />
::*[[Class_MeshObject#SetMeshAnimationSpeed|<span style="color: #0080ff">mesh-animation-speed</span>]]<br />
:::Changes the speed of the meshes animation.<br />
<!--end mesh-attachment--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start fx-replacement-type--><br />
====fx-replacement-type====<br />
:Type: String)(kind fx-replacement only)<br />
:Example: kind "fx-replacement"<br />
:::fx-replacement-type "texture-replacement"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
::*[[Class_MeshObject#SetFXTextureReplacement|<span style="color: #0080ff">texture-replacement</span>]]<br />
:::Replaces a texture effect in this asset to one within a texture-group asset.<br />
::*[[Class_MeshObject#SetFXTextureReplacementTexture|<span style="color: #0080ff">texture-replacement-texture</span>]]<br />
:::Replaces a texture effect in this asset to one located within this asset.<br />
::*[[Class_MeshObject#SetFXCoronaTexture|<span style="color: #0080ff">corona</span>]]<br />
:::Replaces a corona effect in the asset.<br />
::*[[Class_MeshObject#SetFXNameText|<span style="color: #0080ff">name</span>]]<br />
:::Replaces a name effect in the asset.<br />
::*[[Class_MeshObject#SetFXAttachment|<span style="color: #0080ff">attachment</span>]]<br />
:::Replaces an attachment effect in the asset.<br />
::*[[Class_MeshObject#SetFXAnimationState|<span style="color: #0080ff">animation</span>]]<br />
:::Plays/Stops an animation effect in the asset.<br />
<!--end fx-replacement-type--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start duration--><br />
====duration====<br />
:Type: Float<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>(There may be issues with using this tag with mesh-toggle.)</b><br />
:Example: duration 3.2<br />
<!--end duration--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start meshes--><br />
====meshes====<br />
:Type: String - (a list of mesh names from the mesh-table separated by commas)<br />
:Example: meshes "handbrake-lever,braking-system"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end meshes--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start of effects (textures)--><br />
====effects====<br />
:Type: String - (a list of texture names (i.e. texture.txt names without the .txt) each separated by a comma)<br />
:Example: effects "texture-albedo,texture-parameter"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end of effects--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start of particle-effects--><br />
====particle-effects====<br />
:Type: String - (a list of integer numbers as a string)<br />
:Example: particle-effects "0,1"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: For kind particle-effect. The comma-separated list of PFX effects to be modified by the property. See kind for help on implementation. <b>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.</b><br />
<!--end particle-effects--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start target-asset tag--><br />
====target-asset====<br />
:Type: String<br />
:Example: target-asset "bogey-0"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>Only properties of kind “mesh-attachment” or “fx-replacement” can be used for properties that use this tag.</b><br />
<!--end target-asset tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start asset tag--><br />
====asset====<br />
:Type: String<br />
:Example: asset "texturelib"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end asset tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start files-path tag--><br />
====files-path====<br />
:Type: String - (a list of two strings)<br />
:Example: files-path "images/,.texture"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>files-path “images/left/.texture”</b>), where images/left is the path, and .texture is the extension for all the files.<br />
<!--end files-path tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start paths tag--><br />
<!--THIS DOESN'T LOOK RIGHT - CHECK--><br />
====paths====<br />
:Type: String - (a list of two strings)<br />
:Example: paths "marker-lights/night-only""<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: For kind config-edit. A comma-separated list of paths that point to the tag in the wagon-x config to edit.<br />
<!--end paths tag--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start values tag--><br />
====values====<br />
:Type: String - (a string list separated by special characters)<br />
:Example1 values "0,15,30"<br />
:Compulsory: No<br />
:Default: None<br />
: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]].<br />
:<b>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.</b><br />
<!--mesh-attachment--><br />
:::*For kind mesh-attachment:<br />
::::*For mesh-attachment-type mesh-toggle, the value must be either 0 or 1 (visible/hidden) ???<br />
::::*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).<br />
::::Example: values "(0`2`4):(1.2`2`2),(0`0`0):(0`0`0)"<br />
<!--mesh-attachment-type--><br />
:::*For mesh-attachment-type mesh-animation-speed, the value is the speed of the animation for that index<br />
:::*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.<br />
:::*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 [[Class_MeshObject#GetMeshAnimationFrameCount|<span style="color: #0080ff">GetMeshAnimationFrameCount</span>]]).<br />
::::Example: values "0,30"<br />
:::*For mesh-attachment-type mesh-animation-loop, the value can be 0 or 1, to start/stop the loop<br />
<!--sound-script--><br />
:::*For kind sound-script, the value can be 0 or 1, to start/stop the soundscript event<br />
<!--config-edit--><br />
:::*For kind config-edit, the value is a string indicating the string value to assign to the config tag.<br />
<!--particle-effect--><br />
:::*For kind particle-effect:<br />
:::*For particle-effect-type pfx-message, the value follows the same rules for [[pfx message|<span style="color: #0080ff">pfx messages</span>]].<br />
::::*particle-effect-type "pfx-message"<br />
::::Example: values "+0+1,-1-0"<br />
<!--fx-replacement--><br />
:::*For kind fx-replacement:<br />
::::*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:<br />
::::Values “0,2,1” will reference the textures in the texture container at indexes 0, 2, and 1, in that order when cycled through.<br />
::::Example: values “0,2,1”<br />
<br />
kuid <kuid:1234:123456><br />
username "test texture group asset"<br />
trainz-build 4.6<br />
description "test texture group"<br />
textures<br />
{<br />
0 "textures\0albedo.texture"<br />
1 "textures\1albedo.texture"<br />
2 "textures\2albedo.texture"<br />
3 "textures\0parameter.texture"<br />
4 "textures\1parameter.texture"<br />
5 "textures\2parameter.texture" <br />
6 "textures\0normal.texture"<br />
7 "textures\1normal.texture"<br />
8 "textures\2normal.texture" <br />
}<br />
<br />
<br />
::::*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. <br />
::::Example: values "images/congleton.texture,images/burntisland.texture,images/buxton.texture,images/none.texture"<br />
::::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:<br />
::::Example: values "congleton,burntisland,buxton,none" <br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Workflow Text: "<br />
property-id "p_workflow"<br />
description "Sets the Workflow"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
consist-property-sync 1<br />
meshes "null"<br />
effects "texture-extra"<br />
asset "null"<br />
files-path "images/,.texture"<br />
values "congleton,burntisland,buxton,none"<br />
default-index 0<br />
trigger "user"<br />
display-type "list"<br />
display-values "Congleton,Burntisland,Buxton,None"<br />
}<br />
<br />
::::*For fx-replacement-type attachment, the values are the names of the attachment effects to be replaced by the specified [[HowTo/WagonX - Technical Reference#asset]].<br />
::::*For fx-replacement-type corona, the values are the names of the corona effects to be replaced by the specified [[HowTo/WagonX - Technical Reference#asset]].<br />
::::*For fx-replacement-type animation, the values are the names of the animation effects to be replaced by the specified [[HowTo/WagonX - Technical Reference#asset]].<br />
::::*For fx-replacement-type name, the values are the names that will replace the current name of the specified name effect. <br />
<!--end values tag--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start default-index--><br />
====default-index====<br />
:Type: Integer (-1 = random)<br />
:Example: default-index 0<br />
:Compulsory: No<br />
:Default: 0<br />
: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.<br />
<!--end default-index--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start sound-triggers--><br />
====sound-triggers====<br />
:Type: String - (a list of strings)<br />
:Example: sound-triggers "bell_1,bell_2"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end sound-triggers--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start trigger--><br />
====trigger====<br />
:Type: String<br />
:Example: trigger "user"<br />
:Compulsory: No<br />
:Default: Null (ignored)<br />
: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:<br />
:::*user<br />
:::*event<br />
:::*both<br />
:::*none <br />
<!--end trigger--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start events--><br />
====events====<br />
:Type: String - (a list of strings)<br />
:Example: events "handbrake-release,handbrake-apply"<br />
:Compulsory: No<br />
:Default: None<br />
: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). <br />
:::*begin-load/end-load/begin-unload/end-unload<br />
:::*handbrake-apply/handbrake-release<br />
:::*trainbrake-apply/trainbrake-release<br />
:::*headlight-on, headlight-off<br />
:::*horn<br />
:::*bell<br />
:::*sanding<br />
:::*pantograph-state-0/1/2/3 (see [[Class_Train#GetPantographState|<span style="color: #0080ff">GetPantographState</span>]])<br />
:::*weather-0/1/2/3/4/5/6/7 (see [[Class_World#GetWeatherType|<span style="color: #0080ff">GetWeatherType</span>]])<br />
:::*world-day/world-night<br />
:::*queue-(0 - ?)- loaded/empty (e.g. <b>queue-0-loaded, queue-1-empty</b>)<br />
<!--end events--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start display-type--><br />
:Type: String<br />
:Example: display-type "link"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>For trainzbuild 5.1 and 5.0, only link is supported for the View Details page.</b> Omitting this tag in combination with property-visibility set to 0 is useful for non-user triggers, such as world or train events.<br />
:::*string<br />
:::*int<br />
:::*float<br />
:::*list<br />
:::*link <br />
<!--end display-type--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start display-values--><br />
====display-values====<br />
:Type: String - (a list of strings)<br />
:Example: display-values "Clean,Weathered,Dirty"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end display-values--> <br />
</td></tr></table><br />
<br />
<br />
<table width=1200><br />
=Copyright Notice=<br />
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.<br />
</table></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Traincar_TutorialHowTo/WagonX - Traincar Tutorial2024-02-20T06:33:10Z<p>Pcas1986: Minor format error</p>
<hr />
<div>= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several pages. This page is a tutorial for adding WagonX capability to a passenger traincar and a goods carrying wagon. Other pages in the series are listed below:<br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Technical Reference]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
<br />
__TOC__<br />
= Adding WagonX to a Traincar =<br />
== Setting the scene ==<br />
A traincar can have different purposes such as a passenger vehicle such as a car or carriage, or as a wagon carrying, loading and unloading goods. WagonX can assist with both of those so two examples are included here. The first example is of a GWR carriage made by Andi Smith and repaired by the CRG. The second example will likely be a coal vehicle by Ben Dorsey. That example will follow later.<br />
For the GWR carriage we will add the Automated Coupling System (ACS), texture swapping, and attachments that can be shown or hidden.<br />
All of this is defined in the config.<br />
Some of the config tag set up is rather complicated so rather than describe here the tutorial frequently refers to the [[HowTo/WagonX - Technical Reference|Technical Reference]]. It would be useful to keep a brower tab open on that page.<br />
Mesh libraries used in these examples are available on the DLS however they may not be suitable for your application so please use whatever is appropriate for your situation.<br />
<br />
== Setting up the config for the script, class and script-include-table ==<br />
=== The script ===<br />
You need a simple script called ref.gs that is in the WagonX asset. Alternatively you can easily create it yourself in any plain text editor. The contents are:<br />
<br />
include "locowagonx.gs"<br />
class eRef isclass WagonX {};<br />
<br />
=== The class and script-include table ===<br />
Include these tags in the config, where <kuid:661805:500008> is the WagonX library.<br />
<br />
class "eRef"<br />
script-include-table {<br />
0 <kuid:661805:500008><br />
}<br />
<br />
<br />
== Setting up the extensions container ==<br />
<br />
The extensions container contains sub containers for ACS, if used, and WagonX. So, the general format, with no tags yet, is:<br />
<br />
extensions {<br />
active-coupling-standard-60850 {<br />
<br />
}<br />
wagon-x {<br />
<br />
}<br />
}<br />
<br />
== The ACS container ==<br />
The ACS container is fully described at [[ACS_Coupling_System]], but for our purposes we will use the following as an example. Add/change/remove as required for your vehicle.<br />
<br />
active-coupling-standard-60850 {<br />
version-major "2"<br />
version-minor "0"<br />
brakes "vac"<br />
front {<br />
coupler "screwlink|hook"<br />
vacbrake "single"<br />
heating-type "steam"<br />
gangway "gangway" <br />
}<br />
back {<br />
coupler "screwlink|hook"<br />
vacbrake "single"<br />
heating-type "steam"<br />
gangway "gangway"<br />
}<br />
<br />
== The Wagon-X Container ==<br />
==== The WagonX ACS sub-container ====<br />
See the [[HowTo/WagonX_-_Technical_Reference#ACS\|WagonX ACS Technical Reference]] for details of tag usage.<br><br />
WagonX needs information about ACS that isn't defined in the ACS container so, within the wagon-x sub container include an acs sub container that has three tags: animate, use-jbv-animation, and duration.<br />
Animated and use-jbv-animation are self explanatory and duration is the fade time.<br />
extensions {<br />
active-coupling-standard-60850 {<br />
...<br />
}<br />
wagon-x<br />
{<br />
acs<br />
{<br />
animated 1 <br />
use-jbv-animation 0 <br />
duration 1.0 <br />
}<br />
}<br />
}<br />
<br />
==== The Misc sub-container ====<br />
See the [[HowTo/WagonX_-_Technical_Reference#Misc\|WagonX Misc Technical Reference]] for details of tag usage.<br> <br />
The Misc sub-container includes times, in seconds, for loads and unloads at industries. This can be useful for effects such as smoke or dust. Since this is a passenger vehicle we will just set all values to zero. <br />
<br />
extensions {<br />
active-coupling-standard-60850 {<br />
...<br />
}<br />
wagon-x<br />
{<br />
acs<br />
{<br />
...<br />
}<br />
misc {<br />
begin-load-time 0<br />
begin-unload-time 0<br />
end-load-time 0<br />
end-unload-time 0<br />
}<br />
}<br />
}<br />
<br />
==== Marker Lights ====<br />
See the [[HowTo/WagonX_-_Technical_Reference#Marker-Lights|WagonX Marker Lights Technical Reference]] for details of tag usage.<br><br />
The marker-lights sub container is required even if you are not using them. If you don't need it then just set enabled to 0 and the mesh values to null.<br><br />
The name "front" indicates the physical front of the vehicle. i.e. where a.limfront is located. "Back" is the physical back of the vehicle.<br />
"Head" is the direction of train travel, and "tail" is the direction from which the train has come. In other words the tail of the train. Note that Trainz always has a nominal train direction of travel even if it is stopped.<br><br />
If you don't need a lamp at a position then just use "null". There are some conditions on when lights are shown.<br><br />
The head and tail meshes are lamp meshes in the mesh-table.<br><br />
<br />
extensions {<br />
active-coupling-standard-60850 {<br />
...<br />
}<br />
wagon-x<br />
{<br />
acs<br />
{<br />
...<br />
}<br />
misc {<br />
...<br />
}<br />
marker-lights {<br />
enabled 1<br />
car-minimum-count 2<br />
require-locomotive 1<br />
night-only 0<br />
front {<br />
head {<br />
mesh "lamp-front-white"<br />
}<br />
tail {<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back {<br />
head {<br />
mesh "lamp-back-white"<br />
}<br />
tail {<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
==== Browser-Properties ====<br />
See the [[HowTo/WagonX_-_Technical_Reference#Browser-Properties|Browser Properties Technical Reference]] for details of tag usage.<br><br />
The example that follows is a relatively simple browser setup to control:<br />
*Texture swapping<br />
*Control of the marker lights<br />
*Control of an interior night mesh<br />
*Control of a "front" indicator<br />
<br />
Each property has a number of control tags that are located in a property container and each container has a simple number id. The number of tags in a container depends on the property type. Not all properties are subject to user control and can be triggered by other events, such as changing from day to night. Each property can be disabled, however this can only be done in the config.<br />
===== Texture Swapping =====<br />
Texture swapping is controlled in the Properties Browser and can be configured by the user. There are six possible textures including a blank which like an underpaint coat. The default livery is number 1 which is not the first in the list as the list starts with 0 (zero).<br />
Since the number of texture effects is 4, and the number of different textures is 6, then the values tag must contain 24 values that are indices to the actual textures in the relevant texture library.<br />
<br />
===== Marker Lights =====<br />
The marker lights is quite simple and just controls whether they are used only at night or also during the day as well.<br />
<br />
===== Front Indicator =====<br />
The front indicator is a simple tool provided by the original creator, Andi Smith, to show which end of the car is the physical front. The property is visible in the Properties Browser as a simple show or hide option.<br />
<br />
===== Interior Lighting =====<br />
This is an example of a property triggered by an external event. In this case changing from day to night, and night to day. WagonX intercepts the message posted on these events and that triggers a mesh swap using the event type and the values to show the correct mesh.<br />
<br />
extensions {<br />
active-coupling-standard-60850 {<br />
...<br />
}<br />
wagon-x<br />
{<br />
acs<br />
{<br />
...<br />
}<br />
misc {<br />
...<br />
}<br />
marker-lights {<br />
...<br />
}<br />
browser-properties {<br />
0 {<br />
consist-property-sync 1<br />
property-sync-id "GWRsynctexture"<br />
enabled 1<br />
property-visibility 1<br />
name "Current traincar livery: "<br />
property-id "p_livery"<br />
description "Sets the livery for the carriage"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "livery-main,livery-leftdoor,livery-rightdoor,livery-crest"<br />
asset "liveries"<br />
values "0;0;0;0,1;1;1;5,2;2;2;6,2;2;2;7,3;3;3;8,4;4;4;8"<br />
default-index 1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Blank,GWR 1922,GWR 1930,GWR 1934,Crimson Cream,Maroon"<br />
}<br />
1 {<br />
enabled 1<br />
property-visibility 1<br />
name "Night Only: "<br />
property-id "p_cfg"<br />
description "Sets the Day Night"<br />
kind "config-edit"<br />
paths "marker-lights/night-only"<br />
values "0,1"<br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "False,True"<br />
}<br />
2 {<br />
enabled 1<br />
property-visibility 1<br />
name "Front Indicator: "<br />
property-id "p_front"<br />
description "Large F character showing front of carriage"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "front"<br />
values "0,1"<br />
default-index 0<br />
duration 2<br />
trigger "user"<br />
display-type "link"<br />
display-values "Hidden, Visible"<br />
}<br />
3 {<br />
enabled 1<br />
property-visibility 0<br />
name "Interior lighting: "<br />
property-id "p_interior_lighting"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "day-interior,night-interior"<br />
values "1;0,0;1"<br />
default-index 0<br />
duration 2<br />
trigger "event"<br />
events "world-day,world-night"<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
= Adding other effects =<br />
You can easily add other mesh effects using the front indicator in the example above as a template. For example, some versions of a traincar may have a real life structure for different versions of the same basic car. For that just copy the front indicator container and change the tag contents as necessary.<br />
<br />
<br />
= The final config.txt (relevant parts) =<br />
Here is the completed config.txt for those parts covered by the example including the mesh-table:<br />
<br />
script-include-table {<br />
0 <kuid:661805:500008><br />
}<br />
script "ref"<br />
class "eRef"<br />
extensions {<br />
active-coupling-standard-60850 {<br />
version-major "2"<br />
version-minor "0"<br />
brakes "vac"<br />
front {<br />
coupler "screwlink|hook"<br />
vacbrake "single"<br />
heating-type "steam"<br />
gangway "gangway"<br />
}<br />
back {<br />
coupler "screwlink|hook"<br />
vacbrake "single"<br />
heating-type "steam"<br />
gangway "gangway"<br />
}<br />
}<br />
wagon-x {<br />
acs {<br />
animated 1<br />
use-jbv-animation 0<br />
duration 5<br />
}<br />
marker-lights {<br />
enabled 1<br />
car-minimum-count 2<br />
require-locomotive 1<br />
night-only 0<br />
front {<br />
head {<br />
mesh "lamp-front-white"<br />
}<br />
tail {<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back {<br />
head {<br />
mesh "lamp-back-white"<br />
}<br />
tail {<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
misc {<br />
begin-load-time 0<br />
begin-unload-time 0<br />
end-load-time 0<br />
end-unload-time 0<br />
}<br />
browser-properties {<br />
0 {<br />
consist-property-sync 1<br />
property-sync-id "GWRsynctexture"<br />
enabled 1<br />
property-visibility 1<br />
name "Current traincar livery: "<br />
property-id "p_livery"<br />
description "Sets the livery for the carriage"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "livery-main,livery-leftdoor,livery-rightdoor,livery-crest"<br />
asset "liveries"<br />
values "0;0;0;0,1;1;1;5,2;2;2;6,2;2;2;7,3;3;3;8,4;4;4;8"<br />
default-index 1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Blank,GWR 1922,GWR 1930,GWR 1934,Crimson Cream,Maroon"<br />
}<br />
1 {<br />
enabled 1<br />
property-visibility 1<br />
name "Night Only: "<br />
property-id "p_cfg"<br />
description "Sets the Day Night"<br />
kind "config-edit"<br />
paths "marker-lights/night-only"<br />
values "0,1"<br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "False,True"<br />
}<br />
2 {<br />
enabled 1<br />
property-visibility 1<br />
name "Front Indicator: "<br />
property-id "p_front"<br />
description "Large F character showing front of carriage"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "front"<br />
values "0,1"<br />
default-index 0<br />
duration 2<br />
trigger "user"<br />
display-type "link"<br />
display-values "Hidden, Visible"<br />
}<br />
3 {<br />
enabled 1<br />
property-visibility 0<br />
name "Interior lightingr: "<br />
property-id "p_interior_lighting"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "day-interior,night-interior"<br />
values "1;0,0;1"<br />
default-index 0<br />
duration 2<br />
trigger "event"<br />
events "world-day,world-night"<br />
}<br />
}<br />
}<br />
}<br />
fonts 0<br />
mesh-table {<br />
default {<br />
mesh "default.lm"<br />
auto-create 1<br />
effects {<br />
livery-main {<br />
kind "texture-replacement"<br />
texture "livery.texture"<br />
}<br />
livery-crest {<br />
kind "texture-replacement"<br />
texture "crest-crest.texture"<br />
}<br />
}<br />
}<br />
day-interior {<br />
mesh "interior.lm"<br />
auto-create 1<br />
does-cast-shadows 0<br />
lod-level 0<br />
}<br />
night-interior {<br />
mesh "interior-night.lm"<br />
auto-create 0<br />
does-cast-shadows 0<br />
lod-level 0<br />
}<br />
coupler-front {<br />
mesh-asset <kuid:186372:900007><br />
mesh "screwlink.lm"<br />
anim "screwlink.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
coupler-back {<br />
mesh-asset <kuid:186372:900007><br />
mesh "screwlink.lm"<br />
anim "screwlink.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
vacbrake-front {<br />
mesh-asset <kuid:186372:900007><br />
mesh "vac_low_low.lm"<br />
anim "vac_low_low.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-back {<br />
mesh-asset <kuid:186372:900007><br />
mesh "vac_low_low.lm"<br />
anim "vac_low_low.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
heating-front {<br />
mesh-asset <kuid:186372:900007><br />
mesh "steamheat.lm"<br />
anim "steamheat.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
heating-back {<br />
mesh-asset <kuid:186372:900007><br />
mesh "steamheat.lm"<br />
anim "steamheat.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
gangway-front {<br />
mesh-asset <kuid:186372:900007><br />
mesh "gangway.lm"<br />
anim "gangway.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
gangway-back {<br />
mesh-asset <kuid:186372:900007><br />
mesh "gangway.lm"<br />
anim "gangway.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
lamp-front-red {<br />
mesh-asset <kuid:661805:500003><br />
mesh "oil_lamp_red.lm"<br />
auto-create 0<br />
att "a.taillamp0"<br />
att-parent "default"<br />
}<br />
lamp-front-white {<br />
mesh-asset <kuid:661805:500003><br />
mesh "oil_lamp_white.lm"<br />
auto-create 0<br />
att "a.taillamp0"<br />
att-parent "default"<br />
}<br />
lamp-back-red {<br />
mesh-asset <kuid:661805:500003><br />
mesh "oil_lamp_red.lm"<br />
auto-create 0<br />
att "a.taillamp1"<br />
att-parent "default"<br />
}<br />
lamp-back-white {<br />
auto-create 0<br />
mesh-asset <kuid:661805:500003><br />
mesh "oil_lamp_white.lm"<br />
att "a.taillamp1"<br />
att-parent "default"<br />
}<br />
front {<br />
att-parent "default"<br />
att "a.limfront"<br />
auto-create 1<br />
mesh "extra_meshes\front.lm"<br />
}<br />
}<br />
<br />
<br />
[[Category:How-to guides]]<br />
[[Category:Modeling]]<br />
[[Category:Content creation]]</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Traincar_TutorialHowTo/WagonX - Traincar Tutorial2024-02-20T06:31:38Z<p>Pcas1986: First proper version. Second example, of a goods wagon, still to come.</p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/WagonX - Traincar Tutorial--><br />
<!--<span style="color: red; font-weight: 700; font-size: 30px;">Draft Only</span>--><br />
<br />
= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several pages. This page is a tutorial for adding WagonX capability to a passenger traincar and a goods carrying wagon. Other pages in the series are listed below:<br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Technical Reference]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
<br />
__TOC__<br />
= Adding WagonX to a Traincar =<br />
== Setting the scene ==<br />
A traincar can have different purposes such as a passenger vehicle such as a car or carriage, or as a wagon carrying, loading and unloading goods. WagonX can assist with both of those so two examples are included here. The first example is of a GWR carriage made by Andi Smith and repaired by the CRG. The second example will likely be a coal vehicle by Ben Dorsey. That example will follow later.<br />
For the GWR carriage we will add the Automated Coupling System (ACS), texture swapping, and attachments that can be shown or hidden.<br />
All of this is defined in the config.<br />
Some of the config tag set up is rather complicated so rather than describe here the tutorial frequently refers to the [[HowTo/WagonX - Technical Reference|Technical Reference]]. It would be useful to keep a brower tab open on that page.<br />
Mesh libraries used in these examples are available on the DLS however they may not be suitable for your application so please use whatever is appropriate for your situation.<br />
<br />
== Setting up the config for the script, class and script-include-table ==<br />
=== The script ===<br />
You need a simple script called ref.gs that is in the WagonX asset. Alternatively you can easily create it yourself in any plain text editor. The contents are:<br />
<br />
include "locowagonx.gs"<br />
class eRef isclass WagonX {};<br />
<br />
=== The class and script-include table ===<br />
Include these tags in the config, where <kuid:661805:500008> is the WagonX library.<br />
<br />
class "eRef"<br />
script-include-table {<br />
0 <kuid:661805:500008><br />
}<br />
<br />
<br />
== Setting up the extensions container ==<br />
<br />
The extensions container contains sub containers for ACS, if used, and WagonX. So, the general format, with no tags yet, is:<br />
<br />
extensions {<br />
active-coupling-standard-60850 {<br />
<br />
}<br />
wagon-x {<br />
<br />
}<br />
}<br />
<br />
== The ACS container ==<br />
The ACS container is fully described at [[ACS_Coupling_System]], but for our purposes we will use the following as an example. Add/change/remove as required for your vehicle.<br />
<br />
active-coupling-standard-60850 {<br />
version-major "2"<br />
version-minor "0"<br />
brakes "vac"<br />
front {<br />
coupler "screwlink|hook"<br />
vacbrake "single"<br />
heating-type "steam"<br />
gangway "gangway" <br />
}<br />
back {<br />
coupler "screwlink|hook"<br />
vacbrake "single"<br />
heating-type "steam"<br />
gangway "gangway"<br />
}<br />
<br />
== The Wagon-X Container ==<br />
==== The WagonX ACS sub-container ====<br />
See the [[HowTo/WagonX_-_Technical_Reference#ACS\|WagonX ACS Technical Reference]] for details of tag usage.<br><br />
WagonX needs information about ACS that isn't defined in the ACS container so, within the wagon-x sub container include an acs sub container that has three tags: animate, use-jbv-animation, and duration.<br />
Animated and use-jbv-animation are self explanatory and duration is the fade time.<br />
extensions {<br />
active-coupling-standard-60850 {<br />
...<br />
}<br />
wagon-x<br />
{<br />
acs<br />
{<br />
animated 1 <br />
use-jbv-animation 0 <br />
duration 1.0 <br />
}<br />
}<br />
}<br />
<br />
==== The Misc sub-container ====<br />
See the [[HowTo/WagonX_-_Technical_Reference#Misc\|WagonX Misc Technical Reference]] for details of tag usage.<br> <br />
The Misc sub-container includes times, in seconds, for loads and unloads at industries. This can be useful for effects such as smoke or dust. Since this is a passenger vehicle we will just set all values to zero. <br />
<br />
extensions {<br />
active-coupling-standard-60850 {<br />
...<br />
}<br />
wagon-x<br />
{<br />
acs<br />
{<br />
...<br />
}<br />
misc {<br />
begin-load-time 0<br />
begin-unload-time 0<br />
end-load-time 0<br />
end-unload-time 0<br />
}<br />
}<br />
}<br />
<br />
==== Marker Lights ====<br />
See the [[HowTo/WagonX_-_Technical_Reference#Marker-Lights|WagonX Marker Lights Technical Reference]] for details of tag usage.<br><br />
The marker-lights sub container is required even if you are not using them. If you don't need it then just set enabled to 0 and the mesh values to null.<br><br />
The name "front" indicates the physical front of the vehicle. i.e. where a.limfront is located. "Back" is the physical back of the vehicle.<br />
"Head" is the direction of train travel, and "tail" is the direction from which the train has come. In other words the tail of the train. Note that Trainz always has a nominal train direction of travel even if it is stopped.<br><br />
If you don't need a lamp at a position then just use "null". There are some conditions on when lights are shown.<br><br />
The head and tail meshes are lamp meshes in the mesh-table.<br><br />
<br />
extensions {<br />
active-coupling-standard-60850 {<br />
...<br />
}<br />
wagon-x<br />
{<br />
acs<br />
{<br />
...<br />
}<br />
misc {<br />
...<br />
}<br />
marker-lights {<br />
enabled 1<br />
car-minimum-count 2<br />
require-locomotive 1<br />
night-only 0<br />
front {<br />
head {<br />
mesh "lamp-front-white"<br />
}<br />
tail {<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back {<br />
head {<br />
mesh "lamp-back-white"<br />
}<br />
tail {<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
==== Browser-Properties ====<br />
See the [[HowTo/WagonX_-_Technical_Reference#Browser-Properties|Browser Properties Technical Reference]] for details of tag usage.<br><br />
The example that follows is a relatively simple browser setup to control:<br />
*Texture swapping<br />
*Control of the marker lights<br />
*Control of an interior night mesh<br />
*Control of a "front" indicator<br />
<br />
Each property has a number of control tags that are located in a property container and each container has a simple number id. The number of tags in a container depends on the property type. Not all properties are subject to user control and can be triggered by other events, such as changing from day to night. Each property can be disabled, however this can only be done in the config.<br />
===== Texture Swapping =====<br />
Texture swapping is controlled in the Properties Browser and can be configured by the user. There are six possible textures including a blank which like an underpaint coat. The default livery is number 1 which is not the first in the list as the list starts with 0 (zero).<br />
Since the number of texture effects is 4, and the number of different textures is 6, then the values tag must contain 24 values that are indices to the actual textures in the relevant texture library.<br />
<br />
===== Marker Lights =====<br />
The marker lights is quite simple and just controls whether they are used only at night or also during the day as well.<br />
<br />
===== Front Indicator =====<br />
The front indicator is a simple tool provided by the original creator, Andi Smith, to show which end of the car is the physical front. The property is visible in the Properties Browser as a simple show or hide option.<br />
<br />
===== Interior Lighting =====<br />
This is an example of a property triggered by an external event. In this case changing from day to night, and night to day. WagonX intercepts the message posted on these events and that triggers a mesh swap using the event type and the values to show the correct mesh.<br />
<br />
extensions {<br />
active-coupling-standard-60850 {<br />
...<br />
}<br />
wagon-x<br />
{<br />
acs<br />
{<br />
...<br />
}<br />
misc {<br />
...<br />
}<br />
marker-lights {<br />
...<br />
}<br />
browser-properties {<br />
0 {<br />
consist-property-sync 1<br />
property-sync-id "GWRsynctexture"<br />
enabled 1<br />
property-visibility 1<br />
name "Current traincar livery: "<br />
property-id "p_livery"<br />
description "Sets the livery for the carriage"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "livery-main,livery-leftdoor,livery-rightdoor,livery-crest"<br />
asset "liveries"<br />
values "0;0;0;0,1;1;1;5,2;2;2;6,2;2;2;7,3;3;3;8,4;4;4;8"<br />
default-index 1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Blank,GWR 1922,GWR 1930,GWR 1934,Crimson Cream,Maroon"<br />
}<br />
1 {<br />
enabled 1<br />
property-visibility 1<br />
name "Night Only: "<br />
property-id "p_cfg"<br />
description "Sets the Day Night"<br />
kind "config-edit"<br />
paths "marker-lights/night-only"<br />
values "0,1"<br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "False,True"<br />
}<br />
2 {<br />
enabled 1<br />
property-visibility 1<br />
name "Front Indicator: "<br />
property-id "p_front"<br />
description "Large F character showing front of carriage"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "front"<br />
values "0,1"<br />
default-index 0<br />
duration 2<br />
trigger "user"<br />
display-type "link"<br />
display-values "Hidden, Visible"<br />
}<br />
3 {<br />
enabled 1<br />
property-visibility 0<br />
name "Interior lighting: "<br />
property-id "p_interior_lighting"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "day-interior,night-interior"<br />
values "1;0,0;1"<br />
default-index 0<br />
duration 2<br />
trigger "event"<br />
events "world-day,world-night"<br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
= Adding other effects =<br />
You can easily add other mesh effects using the front indicator in the example above as a template. For example, some versions of a traincar may have a real life structure for different versions of the same basic car. For that just copy the front indicator container and change the tag contents as necessary.<br />
<br />
<br />
= The final config.txt (relevant parts) =<br />
Here is the completed config.txt for those parts covered by the example including the mesh-table:<br />
<br />
script-include-table {<br />
0 <kuid:661805:500008><br />
}<br />
script "ref"<br />
class "eRef"<br />
extensions {<br />
active-coupling-standard-60850 {<br />
version-major "2"<br />
version-minor "0"<br />
brakes "vac"<br />
front {<br />
coupler "screwlink|hook"<br />
vacbrake "single"<br />
heating-type "steam"<br />
gangway "gangway"<br />
}<br />
back {<br />
coupler "screwlink|hook"<br />
vacbrake "single"<br />
heating-type "steam"<br />
gangway "gangway"<br />
}<br />
}<br />
wagon-x {<br />
acs {<br />
animated 1<br />
use-jbv-animation 0<br />
duration 5<br />
}<br />
marker-lights {<br />
enabled 1<br />
car-minimum-count 2<br />
require-locomotive 1<br />
night-only 0<br />
front {<br />
head {<br />
mesh "lamp-front-white"<br />
}<br />
tail {<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back {<br />
head {<br />
mesh "lamp-back-white"<br />
}<br />
tail {<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
misc {<br />
begin-load-time 0<br />
begin-unload-time 0<br />
end-load-time 0<br />
end-unload-time 0<br />
}<br />
browser-properties {<br />
0 {<br />
consist-property-sync 1<br />
property-sync-id "GWRsynctexture"<br />
enabled 1<br />
property-visibility 1<br />
name "Current traincar livery: "<br />
property-id "p_livery"<br />
description "Sets the livery for the carriage"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "livery-main,livery-leftdoor,livery-rightdoor,livery-crest"<br />
asset "liveries"<br />
values "0;0;0;0,1;1;1;5,2;2;2;6,2;2;2;7,3;3;3;8,4;4;4;8"<br />
default-index 1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Blank,GWR 1922,GWR 1930,GWR 1934,Crimson Cream,Maroon"<br />
}<br />
1 {<br />
enabled 1<br />
property-visibility 1<br />
name "Night Only: "<br />
property-id "p_cfg"<br />
description "Sets the Day Night"<br />
kind "config-edit"<br />
paths "marker-lights/night-only"<br />
values "0,1"<br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "False,True"<br />
}<br />
2 {<br />
enabled 1<br />
property-visibility 1<br />
name "Front Indicator: "<br />
property-id "p_front"<br />
description "Large F character showing front of carriage"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "front"<br />
values "0,1"<br />
default-index 0<br />
duration 2<br />
trigger "user"<br />
display-type "link"<br />
display-values "Hidden, Visible"<br />
}<br />
3 {<br />
enabled 1<br />
property-visibility 0<br />
name "Interior lightingr: "<br />
property-id "p_interior_lighting"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "day-interior,night-interior"<br />
values "1;0,0;1"<br />
default-index 0<br />
duration 2<br />
trigger "event"<br />
events "world-day,world-night"<br />
}<br />
}<br />
}<br />
}<br />
fonts 0<br />
mesh-table {<br />
default {<br />
mesh "default.lm"<br />
auto-create 1<br />
effects {<br />
livery-main {<br />
kind "texture-replacement"<br />
texture "livery.texture"<br />
}<br />
livery-crest {<br />
kind "texture-replacement"<br />
texture "crest-crest.texture"<br />
}<br />
}<br />
}<br />
day-interior {<br />
mesh "interior.lm"<br />
auto-create 1<br />
does-cast-shadows 0<br />
lod-level 0<br />
}<br />
night-interior {<br />
mesh "interior-night.lm"<br />
auto-create 0<br />
does-cast-shadows 0<br />
lod-level 0<br />
}<br />
coupler-front {<br />
mesh-asset <kuid:186372:900007><br />
mesh "screwlink.lm"<br />
anim "screwlink.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
coupler-back {<br />
mesh-asset <kuid:186372:900007><br />
mesh "screwlink.lm"<br />
anim "screwlink.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
vacbrake-front {<br />
mesh-asset <kuid:186372:900007><br />
mesh "vac_low_low.lm"<br />
anim "vac_low_low.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-back {<br />
mesh-asset <kuid:186372:900007><br />
mesh "vac_low_low.lm"<br />
anim "vac_low_low.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
heating-front {<br />
mesh-asset <kuid:186372:900007><br />
mesh "steamheat.lm"<br />
anim "steamheat.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
heating-back {<br />
mesh-asset <kuid:186372:900007><br />
mesh "steamheat.lm"<br />
anim "steamheat.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
gangway-front {<br />
mesh-asset <kuid:186372:900007><br />
mesh "gangway.lm"<br />
anim "gangway.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
gangway-back {<br />
mesh-asset <kuid:186372:900007><br />
mesh "gangway.lm"<br />
anim "gangway.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
lamp-front-red {<br />
mesh-asset <kuid:661805:500003><br />
mesh "oil_lamp_red.lm"<br />
auto-create 0<br />
att "a.taillamp0"<br />
att-parent "default"<br />
}<br />
lamp-front-white {<br />
mesh-asset <kuid:661805:500003><br />
mesh "oil_lamp_white.lm"<br />
auto-create 0<br />
att "a.taillamp0"<br />
att-parent "default"<br />
}<br />
lamp-back-red {<br />
mesh-asset <kuid:661805:500003><br />
mesh "oil_lamp_red.lm"<br />
auto-create 0<br />
att "a.taillamp1"<br />
att-parent "default"<br />
}<br />
lamp-back-white {<br />
auto-create 0<br />
mesh-asset <kuid:661805:500003><br />
mesh "oil_lamp_white.lm"<br />
att "a.taillamp1"<br />
att-parent "default"<br />
}<br />
front {<br />
att-parent "default"<br />
att "a.limfront"<br />
auto-create 1<br />
mesh "extra_meshes\front.lm"<br />
}<br />
}<br />
<br />
<br />
[[Category:How-to guides]]<br />
[[Category:Modeling]]<br />
[[Category:Content creation]]</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/Help:VE258Help:VE2582024-01-30T05:33:33Z<p>Pcas1986: Added link to FBX file format page</p>
<hr />
<div>'''Unable to determine vertex format'''<br />
<br />
Can be caused by multiple UV maps. Try removing additional maps. See [[FBX file format]]</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/Export_Blender_FBX_AnimationHowTo/Export Blender FBX Animation2024-01-10T05:09:19Z<p>Pcas1986: Updated to Blender 4. Example 2 still needs updating.</p>
<hr />
<div>=Overview=<br />
This page describes a process for exporting simple animated meshes from Blender to the [[FBX file format]]. It is intended for new content creators or those more experienced who need to migrate from older versions of Blender and Trainz animation.<br />
You should be familiar with Blender FBX export as described here [[HowTo/Export from Blender using FBX]]<br><br />
This tutorial is for Trainz Build 5.3 and Blender 4.n. However, it should work for Trainz Build 4.6 and up.<br />
==Trainz Animation==<br />
In Blender you can animate meshes but that animation is not recognised by Trainz. Trainz only recognises animation helper objects that it calls bones. A bone, for Trainz purposes, is an animated helper object using a "b.r." prefix.<br />
Meshes are attached to bones in a parent-child relationship where the child is the mesh. When the parent bone moves in 3D space, the child mesh moves with it. In Trainz you cannot see the animated bones but you can see the mesh.<br />
Animation helpers in Blender can be armatures or empties. Lattices cannot be used since the standard FBX exporter doesn't recognise them. <br />
=Examples=<br />
Here are a number of example animations. Each example is provided with source files but only the first example is fully explained.<br />
==Example 1 - A Revolving Sphere==<br />
This example is a very basic animation of a sphere using an empty as the animation helper. The Blender file consists of a sphere located at grid centre and at elevation 2 (metres). The sphere has a PBR material and a simple UV map.<br />
Your task is add the animation helper, add the rotation animation, export to FBX and import into Trainz.<br />
===Load Example 1===<br />
:* On your computer, create a project folder called "anim_example_1" or whatever name suits you.<br />
:* Download the source files from here: [[File:B4 Anim Ex1 Source.zip]]<br />
:* The source file is in zip format so extract it into the project folder. The source includes:<br />
example1_B4_start.blend;<br />
example1_B4_completed.blend;<br />
ex1_albedo.png<br />
ex1_albedo.texture.txt<br />
ex1_normal.png<br />
ex1_normal.texture.txt<br />
ex1_parameter.png<br />
ex1_parameter.texture.txt<br />
thumbnail_0.jpg<br />
config.txt<br />
:* The config.txt is complete except for the KUID where you add one of your own. The Trainz Build is set to 5.3. You can use 4.6 if required.<br />
:* Open the ex1_B4_example.blend Blender source file in Blender 4. It should look similar to the following. If the sphere is a pink/purple colour then that means Blender can't find the material textures. You should be able to correct that adding them to your Blender file location and reloading the textures withing Blender.<br />
:* Save the file as "ex1B4_working.blend".<br />
[[File:Ex1B4 start.jpg|1200px|thumb|left|The Start Layout]]<br />
<br />
<table bgcolor=#000000 width=1200 cellpadding=2><br />
<tr valign="top"><br />
<td><br />
<table bgcolor=#ffffb0 cellpadding=2><br />
<tr valign="top"><br />
<td>[[image:NotePad.PNG|link=]]</td><br />
<td>The model is a simple UV ball with a painted metal material the author created in Substance Painter. It looks like a planet, but not Earth, with a lot of shiny water and snow covered land. In game it will look like a metal ball with chipped paint. In the top right pane you can see the scene collection which has two Level of Detail (LOD) collections and an Animation collection. The mesh names with the LOD#n complies with the requirements for building a config.txt using the N3V utilities. In this instance the LOD1 meshes are hidden.<br />
At the bottom right you can see the material setup. You can also observe the material (PBRMetal) in the Shading Editor as a node setup.<br />
The image shows reflections of trees due to a background image. <br />
Blender has almost infinite permutations of layouts, colours, size, etc. Don't be concerned if yours isn't the same as the image.<br />
</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
===Add the Trainz Animation Helper===<br />
:* Position the Blender cursor at World Origin (0,0,0). Press Shift S to bring up the Snap menu and select Cursor to World Origin.<br />
:* Add an empty at the cursor location. Use menu Add->Empty->Arrows. Shift A should also work.<br />
:* Double click on the new Empty in the Properties Editor and rename it to "b.r.main". The name used is not important but the prefix "b.r." is important. The convention is to use b.r.main or b.r.base. <br />
:* Move the b.r.main helper into the Animation collection. You can either drag and drop it in the Properties Window or the menu Object->Collection->Move to Collection. Having a collection name Animation makes it easier to export different LOD meshes.<br />
===Animate the Trainz Helper===<br />
:* Change to the Animation Workspace and ensure the b.r.main object is selected. <br />
:* Open the SideBar (N key) in the 3D Editor, if not already open, and select the Item tab. This shows the location, rotation, and scale of the current object. In this case it should be the b.r.main empty.<br />
:* For this project the location and rotation values should be zero and the scale values should be 1.0. If the values are wrong then press Ctrl A and reset whatever needs changing.<br />
<br />
<table bgcolor=#000000 width=1200 cellpadding=2><br />
<tr valign="top"><br />
<td><br />
<table bgcolor=#ffffb0 cellpadding=2><br />
<tr valign="top"><br />
<td>[[image:NotePad.PNG|link=]]</td><br />
<td>As you develop more advanced animation models the location values will be different. Generally, at the start of an animation the Rotation values will also be zero but this isn't mandatory.<br />
The Scale values can cause all sorts of issues in animation and need to be checked at the start of the project. Scaling can be part of the animation although for most models in Trainz the scaling is mostly fixed. But you can animate scaling if that is a solution. Note scaling does affect material/texture mapping as the textures applied to a model will be stretched or shrunk with the scaling.<br />
If you run into problems with animation check that the scaling is correct at the start of the animation cycle.<br />
</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
:* For animation we use keyframes (aka frames) to manage our animation. Trainz operates animations at 30 frames per second (fps) and, as we want to run this animation for two seconds, the End Frame in Timeline should be 60. Make sure the Start Frame is 1 and the Current Keyframe is 1. See the following image.<br />
<br />
<table><tr><td>[[File:Blender402 anim example1 view1.jpg|1200px|thumb|left|B.R.Main]]</td></tr></table><br />
<br />
:* Select the b.r.main helper if not already selected.<br />
:* For the start of our animation we need to set the rotation of our helper to be at 0 (zero) degrees. For this example we can just leave the helper as Blender placed it..<br />
:* Press the I key and select Rotation. This creates a frame with just rotation data which, in this case, is 0. In the Animation Editor a number of changes will become visible.<br />
::: The Rotation fields in the Transform will change colour. In the image below they are yellow but the colour depends on the Blender theme in use.<br />
::: A keyframe indicator appears in the Timeline Window at the bottom of the Blender screen.<br />
::: Entries also appear in the Dope Sheet and Graph Editors. In simple animations you are unlikely to use those editors but be aware they exist.<br />
:* Change the Current frame in Timeline to the last keyframe (60). You can click on frame 60 in Timeline, manually change the current frame number or use the "Jump to end" icon in Timeline.<br />
:* At the end of our animation we want the helper to have completed one full rotation of 360 degrees so select the helper and, in the Properties Window->Context, change the Z Rotation value to 360, and press the I key and select Rotation againi. The result should look like the following:<br />
<table><tr><td>[[File:Setting the rotation to 360.jpg|600px|thumb|left|Setting the rotation]][[File:Rotation set to 360.jpg|600px|thumb|right|Rotation set to 360]]</td></tr></table><br />
:* Test out the animation by clicking on the Forward and Reverse icons in Timeline. When finished reset the animation by stopping it first and then selecting the Start Endpoint icon. Note that the sphere is not moving yet.<br />
===Review===<br />
So far we have created the helper with a name that Trainz will recognise for animation. We have set the animation to compete one full circle in the Z axis in 60 keyframes and, since we are using 30fps, the animation will run for 2 seconds.<br />
The use of the value 360 is somewhat of a trick to make sure that Blender animates the helper through 360 degrees. Although 360 is essentially the same as 0, if you left it at 0 then no animation would take place even though keyframes exist. Try a zero value and see what happens or rather what doesn't happen.<br />
Using the value of 360 means that the helper will rotate 360 degrees in the anti-clockwise direction. If you want clockwise motion then change the value to -360.<br />
===Smoothing the Animation===<br />
While watching the animation you may have noticed that the animation pauses briefly between the end and restart of the animation. There is no time gap but this indicates that the animation is not following a linear path but one using an "F curve". These pauses may be noticeable in game except for bogie animations where the animation is dynamically managed by the game engine.<br />
Within Blender this characteristic is known as the extrapolation mode of the animation channel. By default Blender uses an F curve that resembles a Bezier curve. For many Trainz animations you may want a continuous animation and that means the Linear Extrapolation. Note that there is a Constant Animation but that may not give the same result as it essentially freezes the animation between keyframes. <br />
:* Change the workspace to Animation if not there already.<br />
:* In the Graph Editor or the Dope Sheet Editor, select menu Channel>Extrapolation Mode>Linear Extrapolation.<br />
:* Run the animation again and there should be no pauses.<br />
<table><tr><td>[[File:Linear extrapolation.jpg|800px]]<br></td></tr></table><br />
For more information on Blender animation channel extrapolation see [https://docs.blender.org/manual/en/latest/editors/graph_editor/fcurves/introduction.html Introduction to FCurves]<br />
===Parenting the mesh objects===<br />
:* As stated earlier you cannot animate the meshes directly but you can make them follow the animation helper. We do this by making the mesh a child of the helper.<br />
:* There are two meshes to be animated: the LOD0 and LOD1 meshes.<br />
:* Enable viewing of both the LOD0 and LOD1 mesh by ticking the two collections.<br />
:* Select the objects sphere_lod0, sphere_lod1 and finally b.r.main. The helper bone (empty) must be selected last.<br />
:* In the 3D window, press Ctrl P>Object (Keep Transform).<br />
:* Test the animation by starting the animation and showing or hiding the two mesh objects.<br />
:* Save your work.<br />
<table><tr><td>[[File:Parenting the mesh.jpg|1200px|thumb|left|Parenting the mesh]]</td></tr></table><br />
<table bgcolor=#000000 width=1000 cellpadding=2><br />
<tr valign="top"><br />
<td><br />
<table bgcolor=#ffffb0 cellpadding=2><br />
<tr valign="top"><br />
<td>[[image:NotePad.PNG|link=]]</td><br />
<td>The picture above shows the action of parenting the two mesh objects (sphere_lod0n and sphere_lod1n) to the bone (b.r.main). The following image shows the result.<br />
The two meshes are still in their LOD collections but are also shown as children of b.r.main in the Animation collection but in a light grey. They are not actually part of the animation collection.<br />
</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<table><tr><td>[[File:After parenting.jpg|1000px|thumb|left|After parenting]]</td></tr></table><br />
===Exporting the Animation===<br />
The animation data for the helper(s) as well as the parent/child relationships are exported within the FBX file. The Trainz FBX importer will extract the animation data and store some of it in the Trainzmesh file but the actual animation data in a KIN file. Since we have two LOD meshes this means that the importer will create two KIN files but with slightly different names. As the animation is the same for both meshes you can just use one of the KIN files and delete the other.<br><br />
Blender's FBX exporter will export each animation channel it finds and this can result in multiple KIN files for each mesh. This doesn't work in Trainz. The solution is to use what is called a baked animation where all the channels and keyframes are "baked" together. Baking also causes every frame to be exported even though the source may only specify two keyframes, as in our example.<br />
<br />
====Exporting the LOD0 Animation====<br />
:* Disable viewing of the LOD1 meshes by unclicking the LOD1 collection.<br />
:* Enable both the LOD0 and Animation collections.<br />
:* In the 3D Editor select all objects using the A key. You may need to press it twice.<br />
<table><tr><td>[[File:Exporting lod0.jpg|800px|thumb|Exporting LOD0]]</td></tr></table><br />
:* Go to the File menu and select Export>FBX.<br />
:* The list of options for export is quite long so they are displayed here in two images.<br />
<table><tr><td>[[File:FBX export settings1.jpg|500px|thumb|left|Export settings 1]][[File:FBX export settings2.jpg|500px|thumb|right|Export settings 2]]</td></tr></table> <br />
:* The options shown in these images should work for most exports. Some comments:<br />
:* You can make presets of those settings you use most. The author has one for animation, one for mesh only, and one for mesh and empties. The last is used for meshes with attachments. Presets are very useful.<br />
:* The Path Mode and Batch Mode can be left with default values. They may be useful for exporting models with multiple LODs but the author hasn't tried that.<br />
:* Include: The Limit to section may be something you could consider changing depending on preferences. The author prefers Selected Objects but the other values may suit you better.<br />
:* Include: The Object Types is important. The author works with both empties and armatures for animation so the values are set as shown. You could disable armatures if not being used.<br />
:* Transform: The Scale value and the Apply Scalings are related. Some authors like to use different values to get the same result but the values shown will work.<br />
:* Transform: The Forward and Up are also related so if you change one then the other may change as well. Y Forward and Z up are correct for Trainz.<br />
:* Geometry: These values will work. Applying modifiers and Triangulating faces is something you may wish to change. This is the author's preferred set.<br />
:* Armature: The effect of changing these values has not been tested so just use the default values.<br />
:* Bake Animation: This must be ticked and the other values left unchecked. Leave the Sampling Rate and Simplify as 1.0.<br />
:* In the output filename space enter ex1_lod0.fbx and click on the Export FBX icon.<br />
<br />
====Exporting the LOD1 Animation====<br />
:* Uncheck the LOD0 collection.<br />
:* Check the LOD1 collection.<br />
:* Leave the Animation collection checked.<br />
:* Repeat the LOD0 process only changing the output name to ex1_lod1.fbx. You shouldn't need to change any of the export settings unless you restarted Blender.<br />
<br />
===Setting up the Asset in Trainz===<br />
:* The FBX file contains both the mesh and the b.r.main empty plus the animation data. When the FBX file is imported into Trainz, an animation file (KIN) is created in addition to the Trainzmesh file.<br />
:* The name of the kin file depends on the options chosen within the Export FBX->Animation panel. If you choose the Baked Animation option, then the kin filename will be the mesh name plus “_scene.kin”. In this instance, the kin filenames will be “ex1_lod0_scene.kin” and “ex1_lod1_scene.kin”. <br />
====Config.txt====<br />
:* Create your config.txt. You can either use the config.txt provided with this tutorial remembering to change the KUID to suit one of yours, or create a config.txt from scratch or maybe use the N3V utility program at [[https://contentcreation.trainzsimulator.com/trainz-content-utilities-1-0-2/|N3V Content Utilities]].<br />
:* For this asset the mesh table will look like this. Note that the kin file for LOD1 uses the LOD0 kin file.<br />
<br />
mesh-table {<br />
lod_0 {<br />
mesh "ex1_lod0.trainzmesh"<br />
auto-create 1<br />
lod-level 0<br />
anim "ex1_lod0_scene.kin"<br />
animation-loop-speed 1.00<br />
}<br />
lod_1 {<br />
mesh "ex1_lod0.trainzmesh"<br />
auto-create 1<br />
lod-level 1<br />
anim "ex1_lod0_scene.kin"<br />
animation-loop-speed 1.00<br />
}<br />
}<br />
<br />
<br />
====Committing and updating the asset====<br />
:* Getting the asset to work in game is often a two part process. The first commit will create the Trainzmesh and KIN files and a second pass may be needed to correct filenames in the config.txt.<br />
:* Commit the asset to Trainz.<br />
:* Open the asset for editing. If it failed the commit it will already be open.<br />
:* Check the names of the Trainzmesh and KIN files produced. If necessary, change the config.txt mesh-table to suit the correct names.<br />
:* If you intend to use the LOD0 KIN file then you can delete the LOD1 version.<br />
:* Commit the asset again. Hopefully, there should be no errors.<br />
<br />
====Warnings on commit====<br />
:* You may get these warnings on the first export/import into Trainz. They can be ignored.<br />
<table><tr><td>[[File:B4 anim ex1 export warnings.jpg|600px]]</td></tr></table><br />
===Asset in game===<br />
This is the asset in game. Remember that animation will only work in Driver mode.<br><br />
The ball revolves at a constant rate. You can change the rotation speed in the config.txt using the animation-loop-speed tag.<br />
<table><tr><td>[[File:Ex1 in game.jpg|600px]]</td></tr></table><br />
<br><br />
===Adding the animation as an animation effect===<br />
<br />
====Original author's comments====<br />
This tutorial was altered by another user to use an animated effect in an effects container. While this is useful, it is a bit more advanced than the intent of this tutorial so the orignal author has moved the changes here and the original tutorial structure restored.<br />
<br />
====Animated Effects====<br />
An animated effect can be useful if using script to control the animation as there are more options for animation control. Instead of being located in the main mesh-table, the animated object is located in an Effects container as described here: [[Animation_Effect]].<br />
You can find the animation effect version of this tutorial at [[File:Tutorial_Rebuild_Blender_Rotatating_Earth.zip|Example 1: Tutorial Rebuild Blender Rotatating Earth]]<br />
<br />
<br />
==Example 2 - Four revolving cogs==<br />
(This example needs to be updated and validated)<br />
This example shows four meshed cogs rotating together. The rotation of the cogs is controlled by four armatures and an empty is used as a parent bone.<br />
Each cog has its own armature and two rotate clockwise and the other two rotate anticlockwise.<br /><br />
There are two Blender files provided: one incomplete and one complete. <br /><br />
The starting file has the four cogs UV mapped and linked to a Trainz PBR material. An armature is positioned at the centre of each cog. The four cogs are grouped into a LOD0 collection and the four armatures are grouped into an Animation collection. There is also a LOD1 collection but it is empty.<br /><br />
Your task is to add the animation, duplicate the meshes into LOD1 and export to Trainz. Not everything is explained in detail but if you have completed Example 1 then that will help.<br />
[[File:4 cogs in Blender.jpg|800px]]<br />
===Source Files===<br />
The source files can be downloaded here [[File:ex2_export.zip]]. The source includes:<br />
ex2_start.blend;<br />
ex2_complete.blend;<br />
cogs_albedo.png<br />
cogs_albedo.texture.txt<br />
cogs_normal.png<br />
cogs_normal.texture.txt<br />
cogs_parameter.png<br />
cogs_parameter.texture.txt<br />
$screenshot$.jpg<br />
config.txt<br />
<br />
Updated and rebuilded tutorial files: [[File:Tutorial_Rebuild_Blender_Four_Cogs.zip|Example 2: Tutorial Rebuild Blender Four Cogs]]<br />
Beside some adjustments the main update was to move, add and amend animation tags to a effects sub container.<br />
Informations about Blender 3.x fbx export settings as picture one will find in [[Prequel Blender to Trainz|Prequel for this tutorial series: Blender to Trainz (with the full script)]]<br />
<br />
===Things you need to do===<br />
====Saving====<br />
:* Save often. Animation can be tricky so always save when you have reached a critical point.<br />
====Animate the cogs====<br />
:* Set the animation range to 120 frames, start frame 1, and the current frame 1.<br />
:* Make the four cog armatures children of the root animation helper b.r.base.<br />
:* For each cog:<br />
:** Make the cog mesh a child of its armature. Blender 2.8 seems to be a bit unreliable for this action so make sure the correct parent is applied. You can see this in the Properties Editor, Context Panel->Relations. The parent type should be object.[[File:Checking the cog parent.jpg|800px]]<br />
:** Create five keyframes for each armature as detailed in the table below:<br />
::::{| class="wikitable"<br />
! width=15% | Armature<br />
! width=15% | Keyframe<br />1<br />
! width=15% | Keyframe<br />30<br />
! width=15% | Keyframe<br />60<br />
! width=15% | Keyframe<br />90<br />
! width=15% | Keyframe<br />90<br />
|-<br />
| <center>1</center><br />
| <center>0</center><br />
| <center>-90</center><br />
| <center>-180</center><br />
| <center>-270</center><br />
| <center>-360</center><br />
|-<br />
| <center>2</center><br />
| <center>0</center><br />
| <center>90</center><br />
| <center>180</center><br />
| <center>270</center><br />
| <center>360</center><br />
|-<br />
| <center>3</center><br />
| <center>0</center><br />
| <center>-90</center><br />
| <center>-180</center><br />
| <center>-270</center><br />
| <center>-360</center><br />
|-<br />
| <center>4</center><br />
| <center>0</center><br />
| <center>90</center><br />
| <center>180</center><br />
| <center>270</center><br />
| <center>360</center><br />
|}<br />
:* Run the animation and check that the cogs rotate in the correct direction and mesh with each other. If this doesn't look right then you may have to fall back to a saved version or even the starting version.<br />
:* For each cog:<br />
:**Make a copy. (Shift D)<br />
:**Move the copy to the LOD1 collection. (M key)<br />
:**Rename the copy to "gearx-lod1" where "x" is the gear number.<br />
:**Add a Decimate modifier. The Planar option with an angle of 10 will reduce the number of polys to a usable number. There is no need to apply the modifier since the exporter will do that on export.<br />
:*Hide the LOD1 collection and run the animation again. This will show the LOD1 meshes animating.<br />
<br />
====Export====<br />
:*Select each LOD collection in turn and, together with the Animation collection, export to files called "cogs_lod0.fbx" and "cogs_lod1.fbx". For this export you must select Empty, Armature, and Mesh.<br />
===Asset in Game===<br />
[[file:cogs_in_game.jpg]]<br />
<br />
<br />
==Example 3 - coming soon(ish)==<br />
<br />
=Animation warnings and errors=<br />
<br />
{| style="border:1px solid gray;border-collapse:collapse;background:white;font-weight:bold; " cellpadding=5px align=left width=70% <br />
|- style="font-weight:bold; text-align:center;"<br />
! width=40% style=" border:1px solid gray;"|Warning/Error<br />
! width=60% style=" border:1px solid gray;"|Help/Explanation<br />
|-<br />
| style="border:1px solid gray;font-weight:normal;"|! ... T14120: Simplified dummy tracks with just one key.<br />
| style="border:1px solid gray;font-weight:normal;"| Not sure what this warning is about but the animation is OK.<br />
|-<br />
| style="border:1px solid gray;font-weight:normal;"|! ... Skipping one or more lines with the same contents<br />
| style="border:1px solid gray;font-weight:normal;"|This is an ASSIMP message and can be ignored.<br />
|-<br />
| style="border:1px solid gray;font-weight:normal;"|! ... T2776: FBX: animation is applied to multiple targets<br />
| style="border:1px solid gray;font-weight:normal;"| Might be caused by armatures, where the bones does not have names starting with "b.r.". The armature object itself does not need to have a "b.r." prefix in its name, however.<br />
|}<br />
<br />
<br />
<br />
<br />
<br />
=Return to Index=<br />
<br />
[[HowToGuides|<< How To Guides]]<br />
[[Category:How-to guides]]<br />
[[Category:Modeling]]<br />
[[Category:Content creation]]</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Linear_extrapolation.jpgFile:Linear extrapolation.jpg2024-01-10T05:07:51Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:Linear extrapolation.jpg&quot;: Reverted to version as of 05:05, 10 January 2024</p>
<hr />
<div>Used in Blender 2.80 FBX animation tutorial</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Linear_extrapolation.jpgFile:Linear extrapolation.jpg2024-01-10T05:05:57Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:Linear extrapolation.jpg&quot;: Reverted to version as of 05:04, 10 January 2024</p>
<hr />
<div>Used in Blender 2.80 FBX animation tutorial</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Linear_extrapolation.jpgFile:Linear extrapolation.jpg2024-01-10T05:05:36Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:Linear extrapolation.jpg&quot;: Reverted to version as of 05:21, 9 January 2024</p>
<hr />
<div>Used in Blender 2.80 FBX animation tutorial</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Linear_extrapolation.jpgFile:Linear extrapolation.jpg2024-01-10T05:04:20Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:Linear extrapolation.jpg&quot;: Update to Blender 4</p>
<hr />
<div>Used in Blender 2.80 FBX animation tutorial</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Setting_the_rotation_to_360.jpgFile:Setting the rotation to 360.jpg2024-01-10T04:29:36Z<p>Pcas1986: Setting the rotation of a bone in Blender</p>
<hr />
<div>Setting the rotation of a bone in Blender</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Setting_the_rotation.jpgFile:Setting the rotation.jpg2024-01-10T04:24:58Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:Setting the rotation.jpg&quot;: Reverted to version as of 04:09, 10 January 2024</p>
<hr />
<div>Used in Blender 2.80 FBX animation tutorial</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Setting_the_rotation.jpgFile:Setting the rotation.jpg2024-01-10T04:24:18Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:Setting the rotation.jpg&quot;: Reverted to version as of 05:19, 9 January 2024</p>
<hr />
<div>Used in Blender 2.80 FBX animation tutorial</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Setting_the_rotation.jpgFile:Setting the rotation.jpg2024-01-10T04:09:21Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:Setting the rotation.jpg&quot;: Updated to Blender 4.0</p>
<hr />
<div>Used in Blender 2.80 FBX animation tutorial</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Rotation_set_to_360.jpgFile:Rotation set to 360.jpg2024-01-10T04:05:13Z<p>Pcas1986: Shows result of setting a rotation keyframe</p>
<hr />
<div>Shows result of setting a rotation keyframe</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:B4_Anim_Ex1_Source.zipFile:B4 Anim Ex1 Source.zip2024-01-10T03:50:55Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:B4 Anim Ex1 Source.zip&quot;: Reverted to version as of 03:50, 10 January 2024</p>
<hr />
<div>Source files for Blender 4 animation exercise 1.<br />
File includes two Blender files, config.txt, thumbnail, material textures, and texture.txt files.</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:B4_Anim_Ex1_Source.zipFile:B4 Anim Ex1 Source.zip2024-01-10T03:50:54Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:B4 Anim Ex1 Source.zip&quot;: Reverted to version as of 03:50, 10 January 2024</p>
<hr />
<div>Source files for Blender 4 animation exercise 1.<br />
File includes two Blender files, config.txt, thumbnail, material textures, and texture.txt files.</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:B4_Anim_Ex1_Source.zipFile:B4 Anim Ex1 Source.zip2024-01-10T03:50:33Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:B4 Anim Ex1 Source.zip&quot;: Source files for Blender 4 animation exercise 1.
File includes two Blender files, config.txt, thumbnail, material textures, and texture.txt files.</p>
<hr />
<div>Source files for Blender 4 animation exercise 1.<br />
File includes two Blender files, config.txt, thumbnail, material textures, and texture.txt files.</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:B4_Anim_Ex1_Source.zipFile:B4 Anim Ex1 Source.zip2024-01-10T03:50:12Z<p>Pcas1986: Source files for Blender 4 animation exercise 1.
File includes two Blender files, config.txt, thumbnail, material textures, and texture.txt files.</p>
<hr />
<div>Source files for Blender 4 animation exercise 1.<br />
File includes two Blender files, config.txt, thumbnail, material textures, and texture.txt files.</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Ex1_in_game.jpgFile:Ex1 in game.jpg2024-01-10T03:37:29Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:Ex1 in game.jpg&quot;: Blender 4 animated asset ex1 in game - updated.</p>
<hr />
<div>Used in Blender 2.80 FBX animation tutorial</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:B4_anim_ex1_export_warnings.jpgFile:B4 anim ex1 export warnings.jpg2024-01-10T03:31:07Z<p>Pcas1986: Shows Blender 4 animation ex1 Trainz import warnings.</p>
<hr />
<div>Shows Blender 4 animation ex1 Trainz import warnings.</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:FBX_export_settings2.jpgFile:FBX export settings2.jpg2024-01-10T02:48:42Z<p>Pcas1986: Shows second part of Blender FBX animation export settings.</p>
<hr />
<div>Shows second part of Blender FBX animation export settings.</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:FBX_export_settings1.jpgFile:FBX export settings1.jpg2024-01-10T02:46:49Z<p>Pcas1986: Shows first part of Blender FBX animation export settings.</p>
<hr />
<div>Shows first part of Blender FBX animation export settings.</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Exporting_lod0.jpgFile:Exporting lod0.jpg2024-01-10T02:26:48Z<p>Pcas1986: Shows exporting a bone and mesh in Blender</p>
<hr />
<div>Shows exporting a bone and mesh in Blender</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:After_parenting.jpgFile:After parenting.jpg2024-01-10T02:04:45Z<p>Pcas1986: Show the result of parenting two LOD mesh objects to an animated empty (bone).</p>
<hr />
<div>Show the result of parenting two LOD mesh objects to an animated empty (bone).</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Parenting_the_mesh.jpgFile:Parenting the mesh.jpg2024-01-09T07:09:00Z<p>Pcas1986: Shows parenting meshes to a bone in Blender</p>
<hr />
<div>Shows parenting meshes to a bone in Blender</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Linear_extrapolation.jpgFile:Linear extrapolation.jpg2024-01-09T05:21:51Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:Linear extrapolation.jpg&quot;: Updated for Blender 4.02</p>
<hr />
<div>Used in Blender 2.80 FBX animation tutorial</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Setting_the_rotation.jpgFile:Setting the rotation.jpg2024-01-09T05:19:55Z<p>Pcas1986: Pcas1986 uploaded a new version of &quot;File:Setting the rotation.jpg&quot;: Used in the Blender FBX animation page</p>
<hr />
<div>Used in Blender 2.80 FBX animation tutorial</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Blender402_anim_example1_view1.jpgFile:Blender402 anim example1 view1.jpg2024-01-09T05:16:31Z<p>Pcas1986: Used in Blender FBX animation page</p>
<hr />
<div>Used in Blender FBX animation page</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Ex1B4_start.jpgFile:Ex1B4 start.jpg2024-01-09T05:15:10Z<p>Pcas1986: Used in Blender FBX animation page</p>
<hr />
<div>Used in Blender FBX animation page</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Browser_Properties_Examples_and_Basic_TutorialsHowTo/WagonX - Browser Properties Examples and Basic Tutorials2023-10-01T06:25:46Z<p>Pcas1986: First major release. Probably still has some bugs, typos and formatting links.</p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/WagonX - Browser Properties Examples and Basic Tutorials--><br />
<span style="color: red; font-weight: 700; font-size: 15px;">Please note: Much of this page still needs some validation. If you find issues then please contact PCAS1986 in the Trainz Forums or in the Trainz Discord Server.</span><br />
<br />
= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several pages. This page contains some example WagonX config containers and basic guidance for setting up those containers. Other pages in the series are listed below:<br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Technical Reference]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
# [https://docs.google.com/document/d/1jd5nZNQJI_gKQp-X2GjNCBij9fZGAwgJy_BgBiXf3_8/edit#bookmark=id.kupvwsc34hnk| The asset author's documentation]<br />
<br />
<br />
__TOC__<br />
<br />
=Browser property tutorials=<br />
<!--start of Browser property example--><br />
This tutorial takes you each step of creating a simple mesh toggle example. It is for a handbrake mesh, including animation, that the user may want to show (make visible) or hide (make invisible). We will add each property tag and explain its purpose.<br />
It may be useful to have the [[HowTo/WagonX - Technical Reference|WagonX Technical Reference]] page open in a browser to examine details of the various tags.<br />
<table width=1200><tr><td> <br />
==Creating a basic mesh toggle==<br />
*Start with an empty browse-properties container like this:<br />
<br />
browser-properties<br />
{<br />
}<br />
<br />
*Add an empty property container and name it "0". The names are not used but should be unique. When we add more properties, you should name them “1”, “2”, “3”, etc.<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
}<br />
}<br />
<br />
*There is no order required for each property, but using a standard order makes it easier to follow. Each tag is hyperlinked to the browser-property, so you can see more information about it.<br />
The first tag to add is [[HowTo/WagonX - Technical Reference#enabled|enabled]]. This determines whether or not the property is activated. Set it to 1, since we want our property to work in-game.<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
}<br />
}<br />
<br />
*Set the visibility of the property using [[HowTo/WagonX - Technical Reference#property-visibility|property-visibility]] and make that 1. Note this value is an integer and doesn't require quotes around it. A value of 1 makes the property visible in both Surveyor and Driver. See the reference for other available values.<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
}<br />
}<br />
<br />
*Set the [[HowTo/WagonX - Technical Reference#name|name]] of our property. The name will appear before the [[HowTo/WagonX - Technical Reference#display-values|display-values]], which we will get to in a moment. You also will want to add a space at the end; otherwise, the property name and display-value will appear as one word.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
}<br />
}<br />
<br />
*Set the [[HowTo/WagonX - Technical Reference#property-id|property-id]], which can be anything as long as it is unique and doesn't contain [[HowTo/WagonX - Technical Reference#Restricted_Characters|restricted characters]]. Trainz will use this to identify this property.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_meshToggle"<br />
}<br />
}<br />
<br />
*Set the [[HowTo/WagonX - Technical Reference#description|description]]. This will appear as the tool-tip when you hover over a browser-property.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_meshToggle"<br />
description "Toggles the mesh"<br />
}<br />
}<br />
<br />
*Set the property [[HowTo/WagonX - Technical Reference#kind|kind]]. Since we want a mesh-attachment kind, we must also specify the [[HowTo/WagonX - Technical Reference#mesh-attachment-type|mesh-attachment-type]] which for this application is mesh-toggle.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_meshToggle"<br />
description "Toggles the mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
}<br />
}<br />
<br />
*Now add a [[HowTo/WagonX - Technical Reference#meshes|meshes]] tag to specify what mesh we want to toggle. The mesh name must exist in the config mesh-table. We will use the script author's prestwins handbrake lever for this demo.<br />
<br />
Here is part of the config mesh-table:<br />
handbrake-lever<br />
{<br />
mesh "mesh/handbrake.lm"<br />
anim "mesh/handbrake_scene.kin"<br />
auto-create 1<br />
att-parent "default"<br />
}<br />
<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
}<br />
}<br />
<br />
*Add the [[HowTo/WagonX - Technical Reference#values|values]] tag. This determines what the state of the object will be at each index. The values tag varies depending on the kind, but looking at the values tag page, we see that for kind mesh-toggle, we set it at 0 to hide the mesh, and 1 to show the mesh. Each index is comma separated, so we will set the first one at 1, and the seccond one at 0.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
}<br />
}<br />
<br />
*Add the [[HowTo/WagonX - Technical Reference#default-index|default-index]]. This is an integer value starting from 0 and which indicates the position in a list. 0 is the first in the list, 1 is the second, and so on. <i>(The reasons for this are somewhat historical but also based on how computers find things in memory.)</i> If we set it to 1, it will start at the second comma-separated values tag which is "0". If we set it at -1, it will pick a random index within the size of the values tag.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
}<br />
}<br />
<br />
*Add the [[HowTo/WagonX - Technical Reference#trigger|trigger]] tag. We want our property to activate when a user presses a button on the properties page, so we will set it to <b>user</b>. If we set it to <b>event</b>, however, we could make it activate based on an event within the train or in the world, such as handbrake apply, or enabling it when it gets dark, and disabling it when its daytime again, but for now, we will leave it at user.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
trigger "user"<br />
}<br />
}<br />
<br />
*Specify the [[HowTo/WagonX - Technical Reference#display-type|display-type]]. Looking at the options, we see that <b>link</b> is what we want.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
}<br />
}<br />
<br />
*Finally, the last tag we need is the display-values tag, which we talked about earlier. Since we have two states for our property (specified in the values tag), we will create two comma-separated values for each state. We will call the first “Enabled”, and the second “Hidden”, which corresponds with the numbers we set in the values tag.<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Toggle Mesh: "<br />
property-id "p_handbrakeMeshToggle"<br />
description "Toggles the handbrake mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "handbrake-lever"<br />
values "1,0"<br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "Enabled,Hidden"<br />
}<br />
}<br />
<br />
And that's it! Run the asset into trainz, and when you view the properties, you should see your property appear:<br><br />
<br />
<!--Insert pic of View Details with suitable property shown--><br />
[[File:Toggle_handbrake_mesh_in_View_Details.jpg]]<br />
<br />
And when you click on the underlined part of your property, the property should change to “Hidden”, as we specified, and the handbrake on the underframe should disappear.<br><br />
[[File:Handbrake_mesh_show_%26_hide.jpg]]<br />
<br />
</td></tr></table><br />
= Browser-Property Examples =<br />
== User-Triggered Properties ==<br />
Here are a number of examples for user triggering - i.e. in the View Details property browser. Detailed information on the property browser tags can be found on the [[HowTo/WagonX - Reference|WagonX Reference]] page.<br />
<!--start of mesh toggle property example--><br />
<table width=1200><tr><td><br />
===Mesh-toggle property===<br />
This property allows you to show or hide a mesh that is in the config mesh-table.<br />
<br />
{<br />
enabled 1 <br />
property-visibility 1<br />
name "Toggle: "<br />
property-id "p_toggle"<br />
description "Hide or display the roof mesh"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-toggle"<br />
meshes "roof"<br />
values "0,1"<br />
duration 3 <br />
default-index 0<br />
trigger "user"<br />
display-type "link"<br />
display-values "Hidden,Visible"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of texture-replacement property example--><br />
<table width=1200><tr><td><br />
===texture-replacement property===<br />
This allows the choice of a texture from either local texture files (i.e. contained within the asset), or from a texture group asset, to retexture or reskin a mesh. You could use it for swapping between clean, dirty or weathered textures, logos and also entire liveries. <br />
</td></tr></table><br />
<br><br />
<br />
<!--start of texture replacement using local texture files example--><br />
<table width=1200><tr><td> <br />
====Texture replacement using local texture files====<br />
<br />
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. The values tag will contain a list of texture(.txt) files including a folder name if used. This is an example of three textures.<br />
<br />
values "images/congleton.texture,images/burntisland.texture,images/buxton.texture,images/none.texture"<br />
<br />
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. See the files-path and values usage below. Note that the display-values tag contains similar information but that is for the user to see.<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Workflow Text: "<br />
property-id "p_workflow"<br />
description "Sets the Workflow"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
consist-property-sync 1<br />
meshes "null"<br />
effects "texture-extra"<br />
asset "null"<br />
files-path "images/,.texture"<br />
values "congleton,burntisland,buxton,none"<br />
default-index 0<br />
trigger "user"<br />
display-type "list"<br />
display-values "Congleton,Burntisland,Buxton,None"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of texture replacement using a texture-group example--><br />
<table width=1200><tr><td> <br />
====Texture replacement using a texture-group library asset====<br />
You will need to specify the texture group asset in the kuid-table and give it a name such as "texturelib" or "gwrtexturelib", The name should not have any spaces or other special characters.<br />
This property container is set up to allow for three different variations of the the material used for the asset. They are named in the "display-values" tag as Skin 1, Skin 2, and Skin 3. <br />
Since it is a PBR material there are three textures used in the materail: the albedo, parameters, and normal. The normal texture is common to all three versions so it need not be changed.<br />
The "values" tag contains six numbers which are the numbers of the textures in the texture-group asset. For Skin 1 the "12" refers to the albedo texture, and the "15" refers to the parameter texture. "13" and "16" are the pair for Skin2, and "14" and "17" are the pair for Skin 3.<br />
The "effects" tag contains the texture effect names for meshes in the mesh-table.<br />
<br><br />
<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Weathering: "<br />
property-id "p_skin"<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
effects "texture-albedo,texture-parameter"<br />
asset "texturelib"<br />
files-path "null"<br />
values "12;15,13;16,14;17"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin 1,Skin 2,Skin 3"<br />
}<br />
</td></tr></table><br />
<br />
<br />
<br />
== Event-Triggered Properties ==<br />
<!--start of loading-doors property example--><br />
<table width=1200><tr><td><br />
===loading-doorsProperty ===<br />
The ‘meshes’ tag references a mesh-table asset named ‘loading-doors’, and sets the frame to 30 when begin-load is called (to open the doors), and 0 when end-load is called (to close the door). The default index is 0 (the animation frame will be at 0), and the animation duration is 1.5 seconds.<br />
{<br />
enabled 0<br />
property-visibility 0<br />
property-id "p_doors"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "loading-doors"<br />
values "0,30"<br />
trigger "event"<br />
events "end-load,begin-load"<br />
duration 1.5<br />
default-index 0<br />
}<br />
<br />
An alternate way to do it is use mesh-attachment-type "mesh-animation-state", and set a bool int (0 or 1) for the values tag.<br />
{<br />
enabled 0<br />
property-visibility 0<br />
property-id "p_doors"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-state"<br />
meshes "loading-doors"<br />
values "0,1"<br />
trigger "event"<br />
events "end-load,begin-load"<br />
default-index 0<br />
}<br />
<br />
If you want two doors to open at the same time, instead of creating another property, you can use a semicolon split in the values tag to change two in a single property:<br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "door-1,door-2"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.0<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of Weather-Based property example--><br />
<table width=1200><tr><td> <br />
===Weather-Based Texture Replacement===<br />
The texture effect will change based on the weather. It will display a snowy texture when the weather type is 6 (medium snow), a wet, rainy texture when the weather type is 3 (rain), and a dry texture when the weather type is 0.<br />
{<br />
enabled 1<br />
property-visibility 0<br />
property-id "p_weather_skin"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
effects "texture-weather"<br />
files-path "images/,.texture"<br />
values "texture-snow,texture-rain,texture-dry"<br />
default-index 0<br />
trigger "event"<br />
events "weather-6,weather-3,weather-0"<br />
}<br />
</td></tr></table><br />
<br />
<!--start of discussion about use of semicolons--><br />
<table width=1200><tr><td> <br />
== Using semicolons to set multiple values in one property ==<br />
When assigning values for a certain property, you will specify the mesh/effect/sound, etc that needs to be edited, and specify how you want to manipulate it (fx-replacement-type, mesh-attachment-type, etc), and set the value for a certain index. For example, In a texture replacement where a texture is being replaced by an external texture-group asset, the property would look something like this.<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin_parameter"<br />
description "Sets The Texture"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "texture-albedo"<br />
asset "texturelib"<br />
values "1,2,3,4"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin1,Skin2,Skin3,Skin"<br />
}<br />
<br />
As you can see, the comma-separated numbers in the “values” tag indicate the index in the texture-group asset to find the texture; here are the first few lines for that. Texture indexes 0, 1, 2, and 3 are referenced for the albedo texture types, since we have 4 weathering types.<br />
<br />
kuid <kuid2:661805:500009:0><br />
username "BR GrainHop Texture Group"<br />
kind "texture-group"<br />
trainz-build 5.0<br />
category-class "JO"<br />
author "dundun92"<br />
contact-email "jbvector93@outlook.com"<br />
description "A texture group for my GrainHop wagons"<br />
textures<br />
{<br />
0 "270cgo/0albedo.texture"<br />
1 "270cgo/1albedo.texture"<br />
2 "270cgo/2albedo.texture"<br />
3 "270cgo/2albedo.texture"<br />
4 "270cgo/0parameter.texture"<br />
5 "270cgo/1parameter.texture"<br />
6 "270cgo/2parameter.texture"<br />
.........<br />
}<br />
<br />
We specified the texture-group library in the kuid table, and referenced it in the “asset” tag.<br />
kuid-table<br />
{<br />
acslib <kuid2:60850:89100><br />
meshlib <kuid2:661805:500002><br />
texturelib <kuid2:661805:500009><br />
lamp <kuid2:661805:500003><br />
enginespec <kuid2:368699:50064><br />
bogie <kuid2:661805:400003><br />
}<br />
<br />
And then we specified the effect we wanted to change, (currently just the texture-albedo), inside the “effects” tag (this is not the effects tag below in this mesh table asset, but rather the one in the browser-properties at the top of this section!).<br />
body<br />
{<br />
mesh "mesh/body.lm"<br />
auto-create 1<br />
att-parent "default"<br />
effects<br />
{<br />
texture-albedo<br />
{<br />
kind "texture-replacement"<br />
texture "covhopp-1_albedo.texture"<br />
}<br />
texture-normal<br />
{<br />
kind "texture-replacement"<br />
texture "covhopp-1_normal.texture"<br />
}<br />
texture-parameter<br />
{<br />
kind "texture-replacement"<br />
texture "covhopp-1_parameter.texture"<br />
}<br />
}<br />
}<br />
<br />
But say you want to replace the normal map as well. You would probably just create another browser property and specify the proper index for the normals.<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin_parameter"<br />
description "Sets The Paramenter Texture"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "texture-albedo"<br />
asset "texturelib"<br />
values "1,2,3,4"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin1,Skin2,Skin3,Skin4"<br />
}<br />
1<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin_normal"<br />
description "Sets The Normal Texture"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
effects "texture-normal"<br />
asset "texturelib"<br />
values "7,8,9,10"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Skin1,Skin2,Skin3,Skin4"<br />
}<br />
<br />
But we can't forget the parameter map… that will require a third property. What's worse, we will now have three different properties in the view details page that will each have to be clicked on to change each map! Assigning properties this way can get tedious and create extra clutter in the config. Thankfully, for properties that share the same kind and type, it can all be done in a single property using semicolons:<br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin"<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
<b>effects "texture-albedo,texture-parameter,texture-normal"</b><br />
asset "texturelib"<br />
files-path "null"<br />
<b>values "0;4;8,1;5;9,2;6;10,3;7;11"</b><br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
<b>display-values "Clean,Weathered,Dirty,Rusty"</b><br />
}<br />
<br />
Take note of the three tag entries above: the <b>effects</b>, <b>values</b> and <b>display-values</b> tags. The <b>display-values</b> tag is what the user sees and can choose from. Our interest is in the remaining two tags as shown below:<br />
<br />
effects "texture-albedo,texture-parameter,texture-normal"<br />
values "0;4;8,1;5;9,2;6;9,3;7;11" <br />
<br />
There are four user options and, since each option requires three textures, the total number of textures is 12. The <b>values</b> tag contains a string of four groups of texture numbers separated by a comma. Within each texture group the texture numbers are delimited by a semi colon.<br />
<br />
To clarify, we can list the three textures associated with each user choice:<br />
<br />
0;4;8 -> Clean<br />
1;5;9 -> Weathered<br />
2;6;10 -> Dirty<br />
3;7;11 -> Rusty<br />
<br />
The first column of 0,1,2,3 identify the albedo textures. The second column of 4,5,6,7 identify the parameters textures, The third column of 8,9,10,11 identify the normal textures. Note that the numbers do not need to be in sequence or even consecutive. All those numbers do is to identify the correct texture in the texture-group asset.<br />
<br />
<br />
This system works for other kinds of properties, too. In this case, we are setting the animation frame of both the handbrake-lever, and braking system at the same time using the same property (triggered by the same event).<br />
<br />
1 <br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "handbrake-lever,braking-system"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.2<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
<br />
</td></tr></table><br />
<br />
<!--start of discussion about Naming ACS mesh-table attachments--><br />
<table width=1200><tr><td> <br />
== Naming ACS mesh-table attachments ==<br />
Please refer to this page on the ACS coupling system for setting up the “active-coupling-standard-60850” extensions container (which will be required for the ACS coupling to work): [[ACS_Coupling_System|ACS Coupling System]]<br />
<br />
These are the mesh-table naming conventions you must use for the beginning of the name of each ACS attachment mesh. The others will vary depending on the “animated” property above. <b>You must spell them exactly as shown below</b>.<br />
<br />
*coupler<br />
*gangway<br />
*airbrake<br />
*vacbrake<br />
*multiworking<br />
*heating<br />
*rch<br />
<br />
If the “animated” tag in the acs container (see [[HowTo/WagonX_-_Technical_Reference#ACS|acs]]) is set to 1, then the naming is quite simple. It's one of the 7 callbacks above + a dash + “<i>front</i>” or “<i>back</i>”. The anim tag must be present to specify the animation for it. Frame 0 is the uncoupled state, and the last frame is the coupled state. This setup is shown below:<br />
<br />
coupler-front<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-animated.lm"<br />
anim "coupler-screwlink-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
coupler-back<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-animated.lm"<br />
anim "coupler-screwlink-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
vacbrake-front<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-animated.lm"<br />
anim "vacbrake-single-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-back<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-animated.lm"<br />
anim "vacbrake-single-animated_scene.kin"<br />
auto-create 1<br />
att "a.couple1"<br />
att-parent "default"<br />
}<br />
<br />
If, however, you do not want to use animations, but want to use separate meshes for each state (coupled and uncoupled), it gets a bit more complicated. The naming will follow the same as above at first, but you must add a third piece to it to specify the exact type of ACS attachment this is. The information on what to put there is originally from the [[ACS_Coupling_SystemACS Coupling System|ACS page]], but the 7 callbacks have been added plus the sub-callback here to make it easier (the third callback options are the ones with a delta symbol &Delta; ). And for the uncoupled state, the third callback is “non” (e.g. coupler-front-screwlink, and coupler-front-none).<br />
<br />
*coupler<br />
:*front/back<br />
::&Delta; "<b>hook</b>" -- connects to screwlink/instanter/3link/hst-emergency-bar.<br />
::&Delta; "<b>3link</b>" -- connects to hook.<br />
::&Delta; "<b>instanter</b>" -- connects to hook.<br />
::&Delta; "<b>screwlink</b>" -- connects to hook.<br />
::&Delta; "<b>hst-emergency-bar</b>" -- connects to hook.<br />
::&Delta; "<b>bar-full</b>" -- connects to "bar-none". Half of a handed pair for when one vehicle has the entire bar coupling.<br />
::&Delta; "<b>bar-none</b>" -- connected to by "bar-full". The other half of the handed pair.<br />
::&Delta; "<b>bar</b>" -- connects to self only. Used when both vehicles have half the bar coupling.<br />
::&Delta; "<b>knuckle</b>" - standard knuckle coupler.<br />
::&Delta; "<b>tightlock</b>" -- different from a standard knuckle, refers to a knuckle style coupler often fitted to multiple unit trains that also include electrical connections.<br />
::&Delta; "<b>wedgelock</b>" -- London Underground coupler.<br />
::&Delta; "<b>bsi</b>" -- Found on Sprinter DMUs and derived designs.<br />
::&Delta; "<b>dellner</b>" -- Also compatible with Scharfenberg coupling.<br />
::&Delta; "<b>scharfenberg</b>" -- Also compatible with dellner coupling.<br />
::&Delta; "(<b>other string identifier</b>)" -- Any string that is not recognized from the above list is assumed to be a symmetrical meet-in-the-middle type of coupler.<br />
::&Delta; “<b>none</b>”<br />
::Examples: <b>coupler-front-instanter</b>, coupler-back-none<br />
<br />
*gangway<br />
:*front/back<br />
::&Delta; <b>rubbing-plate</b><br />
::&Delta; <b>gangway</b><br />
::&Delta; <b>none</b><br />
::Example: <b>gangway-front-gangway</b><br />
<br />
*airbrake<br />
:*front/back<br />
::&Delta; <b>twin</b><br />
::&Delta; <b>single</b><br />
::&Delta; <b>none</b><br />
::Example: <b>airbrake-back-none</b><br />
<br />
*vacbrake<br />
:*front/back<br />
::&Delta; <b>twin</b><br />
::&Delta; <b>single</b><br />
::&Delta; <b>high</b><br />
::&Delta; <b>none</b><br />
::Example: <b>vacbrake-back-twin</b><br />
<br />
*multiworking<br />
::front/back<br />
::&Delta; "(color)-(shape)" -- e.g. "<b>blue-star</b>" or "<b>red-diamond</b>", etc<br />
::&Delta; "<b>AAR</b>" -- as used on GM locos<br />
::&Delta; "<b>SR27</b>" -- bagpipes<br />
::&Delta; "(other identifier string e.g. classname)"<br />
::Example: <b>multiworking-front-blue-square</b><br />
<br />
*heating<br />
::front/back<br />
::&Delta; "<b>none</b>"<br />
::&Delta; "<b>steam</b>"<br />
::&Delta; "<b>electric</b>"<br />
::&Delta; "<b>dual</b>"<br />
::&Delta; "<b>southern-electric</b>" <br />
::Example: <b>heating-back-steam</b><br />
<br />
*rch<br />
::front/back<br />
::&Delta; "<b>high</b>"<br />
::&Delta; "<b>low</b>"<br />
::&Delta; "<b>none</b>"<br />
::Example: <b>rch-back-high</b><br />
<br />
And an example how it would look inside a config.txt. The back attachments have been omitted for brevity. <br />
<br />
coupler-front-screwlink<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-coupled.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
coupler-front-none<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "coupler-screwlink-retracted.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-front-single<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-coupled.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
vacbrake-front-none<br />
{<br />
mesh-asset <kuid2:661805:500002><br />
mesh "vacbrake-single-retracted.lm"<br />
auto-create 1<br />
att "a.couple0"<br />
att-parent "default"<br />
}<br />
<br />
<table width=1200><br />
=Copyright Notice=<br />
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.<br />
</table></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Toggle_handbrake_mesh_in_View_Details.jpgFile:Toggle handbrake mesh in View Details.jpg2023-10-01T05:35:07Z<p>Pcas1986: Used in WagonX tutorials</p>
<hr />
<div>Used in WagonX tutorials</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:Handbrake_mesh_show_%26_hide.jpgFile:Handbrake mesh show & hide.jpg2023-10-01T05:32:02Z<p>Pcas1986: Used in WagonX tutorials</p>
<hr />
<div>Used in WagonX tutorials</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Browser_Properties_Examples_and_Basic_TutorialsHowTo/WagonX - Browser Properties Examples and Basic Tutorials2023-09-27T05:13:53Z<p>Pcas1986: </p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/WagonX - Browser Properties Examples and Basic Tutorials--><br />
<span style="color: red; font-weight: 700; font-size: 30px;">Draft Only</span><br />
<br />
= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several pages. This page contains some example WagonX config containers and basic guidance for setting up those containers. Other pages in the series are listed below:<br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Technical Reference]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
<br />
__TOC__<br />
<br />
<span style="color: red; font-weight: 700; font-size: 30px;">Placeholder only</span><br />
= Browser-Property Examples =<br />
<br />
== User-Triggered Properties ==<br />
=== Mesh Toggle Property ===<br />
=== Texture Replacement from Texture Group ===<br />
== Event-Triggered Properties ==<br />
=== Door Loading Property ===<br />
=== Weather-Based Texture Replacement ===<br />
<br />
== Browser property tutorials ==<br />
=== Creating a basic mesh toggle ===<br />
== Using semicolons to set multiple values in one property ==<br />
== Naming ACS mesh-table attachments ==</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/Use_the_WagonX_LibraryHowTo/Use the WagonX Library2023-09-27T05:13:04Z<p>Pcas1986: </p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/Use the WagonX Library--><br />
<span style="color: red; font-weight: 700; font-size: 30px;">Draft Only</span><br />
= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several TrainzWiKi pages. This page is an introduction to WagonX and its capabilties. Other pages in the series are:<br />
</table> <br />
# [[HowTo/WagonX - Technical Reference]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
<br><br />
<br />
__TOC__<br />
<br />
= Introduction =<br />
== A discussion about "properties" ==<br />
<table width=1200><br />
<tr valign="top"><br />
<td>So what is a "property" and what is its purpose in Trainz?<br />
A Google search will reveal that a property in this context is a value or attribute of an object. In Trainz we generally call such objects <b>assets</b>. An example might be a traincar (wagon/car/carriage) and that traincar has some standard properties such as weight, cargo or passengers.<br />
<br />
But the standard properties are rather limited and, if a content creator wanted to add extra properties such as texture replacement, then a Trainz script is required. Creating such scripts is not easy even for experienced programmers. Maintaining scripts can create a huge amount of work if common scripts are replicated across many assets.<br />
<br />
This is where WagonX can help.<br />
</td><br />
</tr><br />
</table><br />
<br><br />
== WagonX and Properties ==<br />
<table width=1200><br />
<tr valign="top"><br />
<td>WagonX is a universal script library that simplifies adding properties and scripted features to your traincar assets.<br />
You can create an asset with all the perks of scripted assets without touching any TrainzScript (GS) files, or having much knowledge of trainzscript. You can set up a number of asset options, as identified in the following list, in the config.txt file. All the details are then automatically presented to the user in the View Details (property browser) dialog, making it easy to edit as needed.<br />
</td><br />
</tr><br />
</table><br />
<br><br />
== The WagonX Asset ==<br />
<table width=1200><br />
<tr valign="top"><br />
<td><br />
*The '''JBV WagonX Script Library - <kuid:661805:500008>''' is available on the Download Station.<br />
*It is suitable for asset with Trainz Builds 5.0 or higher. The library uses script functions only available from that version.<br />
</td><br />
</tr><br />
</table><br />
<br><br />
<br />
<table><br />
<tr valign="top"><br />
<td> <br />
<table width=1200 bgcolor=#000000 cellpadding=1><br />
<tr valign="top"><br />
<td><br />
<table width=1196 bgcolor=#ffffff cellpadding=2><br />
<tr valign="top"><br />
<td>The '''The WagonX Library''' can be used to set:-<br />
<table><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''animations''' - stop or start</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''texture replacements''' - loaded from a textures library asset</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''head codes''' - for UK vehicles</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''lamps''' - for UK vehicles</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''ACS controlled couplers and hoses''' - loaded from a suitable couplers/hoses mesh library</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''sounds'''</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''PFX effects''' - such as smoke or dust</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''triggered effects'''</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''consist synchronisation''' - such as texture swapping for vehicles also using WagonX in a consist</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''...and much more.'''</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
</table><br />
<br><br />
<table width=1200><br />
<td><br />
This picture demonstrates entries in the config and the result in the Properties Browser in game. The asset is the library author's Prestwin 1/277 EXP (<kuid2:661805:1:1>).<br />
</td><br />
</table><br />
<table width=1500><br />
<tr valign="center"><br />
<td><br />
[[File:WagonX Documentation2.jpg|left]]<br />
</td> <br />
</tr><br />
</table><br />
<br />
<br />
<br />
= Implementation =<br />
== Basic configuration for the config.txt and asset script ==<br />
=== Background ===<br />
<table width=1200><br />
<td><br />
The library implementation for WagonX is a bit different from other library assets (such as Bloodnoks ACS lib or superscript) and utilizes a new script referencing technique from David Pistelak’s scripted assets. The traincar’s config.txt does not directly reference the wagon.gs file. It instead must reference a (mostly) blank gs file that will hold the information for the WagonX gs file. In this case, this special file is named ref.gs and the class to used is eRef.<br />
</td><br />
</table><br />
<br />
=== The asset script ===<br />
<table width=1200><br />
<td>You will need to create a Trainzscript file called "ref.gs" and include it with your asset files. <b>Do not add any other code to ref.gs as future updates to the WagonX library may break your asset.</b> The content of ref.gs should be:<br />
</td><br />
</table><br />
<br />
include "WagonX.gs"<br />
class eRef isclass WagonX{};<br />
<br />
<br />
=== Config.txt - first steps ===<br />
<table width=1200><br />
<td>Let's start with the basic tags needed to make WagonX work. You will need to include script and class tags, a script-include-table, and a kuid-table reference if you are using ACSLib to control couplers and coupled hoses. <b>The spelling and capitisation of the class name is important.</b> The config entries should look like this:<br />
</td><br />
</table><br />
<br />
<!--indent this bit so a block is created--><br />
script-include-table<br />
{<br />
0 <kuid:661805:500008><br />
}<br />
script "ref.gs"<br />
class "eRef" <br />
kuid-table<br />
{<br />
acslib <kuid2:60850:89100><br />
}<br />
<br />
<table width=1200><br />
<td>That's it for the initial referencing of the script into your asset. The rest of the information for the script library goes inside the extensions container, under a sub-container that must be named “wagon-x”, all of which will be explained in the next sections. The following is a general example of how an extensions container using ACS and WagonX might appear. It may not be suitable for your application.<br />
</td><br />
</table><br />
<br />
extensions<br />
{<br />
max_permitted_speed-60850 "50mph"<br />
active-coupling-standard-60850<br />
{<br />
version-major "2"<br />
version-minor "0"<br />
brakes "vac"<br />
front<br />
{<br />
coupler "instanter|hook"<br />
vacbrake "twin"<br />
}<br />
back<br />
{<br />
coupler "instanter|hook"<br />
vacbrake "twin"<br />
}<br />
}<br />
wagon-x<br />
{<br />
acs<br />
{<br />
animated 1<br />
use-jbv-animation 1<br />
duration 1.5<br />
}<br />
misc<br />
{<br />
begin-load-time 15<br />
begin-unload-time 5<br />
end-load-time 1<br />
end-unload-time 1<br />
}<br />
marker-lights<br />
{<br />
enabled 1<br />
car-minimum-count 1<br />
require-locomotive 1<br />
front<br />
{<br />
head<br />
{<br />
mesh "null"<br />
}<br />
tail<br />
{<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back<br />
{<br />
head<br />
{<br />
mesh "lamp-back-white"<br />
}<br />
tail<br />
{<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin"<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
effects "texture-albedo,texture-parameter"<br />
asset "texturelib"<br />
files-path "null"<br />
values "0;3,1;4,2;5"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Clean,Weathered,Dirty"<br />
} <br />
1<br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "handbrake-lever,braking-system"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.2<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
}<br />
}<br />
}<br />
<br><br />
<br />
= Next Steps =<br />
<table width=1200><br />
<td>This page has been a basic introduction to WagonX. Some basic tutorials to setup some WagonX properties can be found at the [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials|<span style="color: #0080ff">Basic Tutorials</span>]] page.<br><br />
You can find a locomotive tutorial at the [[HowTo/WagonX - Locomotive Tutorial|<span style="color: #0080ff">Locomotive Tutorial</span>]] page and a traincar tutorial at the [[HowTo/WagonX - Traincar Tutorial|<span style="color: #0080ff">Traincar Tutorial</span>]] page.<br><br />
These tutorials are supported by a detailed WagonX reference at the [[HowTo/WagonX - Reference|<span style="color: #0080ff">WagonX Reference</span>]] page.<br />
</td><br />
</table><br />
<br />
<table width=1200><br />
=Copyright Notice=<br />
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.<br />
</table><br />
<br />
<!--=Return to Index=<br />
<br />
[[HowToGuides|<< How To Guides]]<br />
[[Category:How-to guides]]<br />
[[Category:Modeling]]<br />
[[Category:Content creation]]<br />
[[Category:WagonX]]--></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Locomotive_TutorialHowTo/WagonX - Locomotive Tutorial2023-09-27T05:11:01Z<p>Pcas1986: An empty version to sort out links etc.</p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/WagonX - Locomotive Tutorial--><br />
<span style="color: red; font-weight: 700; font-size: 30px;">Draft Only</span><br />
<br />
= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several pages. This page is a tutorial for adding WagonX capability to a locomotive. Other pages in the series are listed below:<br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Technical Reference]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
<br />
= Tutorials =<br />
== Setting up the WagonX soup ==<br />
<span style="color: red; font-weight: 700; font-size: 30px;">Placeholder Only</span></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Traincar_TutorialHowTo/WagonX - Traincar Tutorial2023-09-27T05:05:37Z<p>Pcas1986: An empty version to sort out links etc.</p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/WagonX - Traincar Tutorial--><br />
<span style="color: red; font-weight: 700; font-size: 30px;">Draft Only</span><br />
<br />
= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several pages. This page is a tutorial for adding WagonX capability to a traincar (not a loco). Other pages in the series are listed below:<br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Technical Reference]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
<br />
__TOC__<br />
<br />
= Tutorials =<br />
== Setting up the WagonX soup ==<br />
<span style="color: red; font-weight: 700; font-size: 30px;">Placeholder Only</span></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Browser_Properties_Examples_and_Basic_TutorialsHowTo/WagonX - Browser Properties Examples and Basic Tutorials2023-09-27T05:01:27Z<p>Pcas1986: An empty version to sort out links etc.</p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/WagonX - Browser Properties Examples and Basic Tutorials--><br />
<span style="color: red; font-weight: 700; font-size: 30px;">Draft Only</span><br />
<br />
= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several pages. This page contains some example WagonX config containers and basic guidance for setting up those containers. Other pages in the series are listed below:<br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Reference]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
<br />
__TOC__<br />
<br />
<span style="color: red; font-weight: 700; font-size: 30px;">Placeholder only</span><br />
= Browser-Property Examples =<br />
<br />
== User-Triggered Properties ==<br />
=== Mesh Toggle Property ===<br />
=== Texture Replacement from Texture Group ===<br />
== Event-Triggered Properties ==<br />
=== Door Loading Property ===<br />
=== Weather-Based Texture Replacement ===<br />
<br />
== Browser property tutorials ==<br />
=== Creating a basic mesh toggle ===<br />
== Using semicolons to set multiple values in one property ==<br />
== Naming ACS mesh-table attachments ==</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/WagonX_-_Technical_ReferenceHowTo/WagonX - Technical Reference2023-09-27T04:57:41Z<p>Pcas1986: Draft version - checking for links,etc.</p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/WagonX - Technical Reference--><br />
<span style="color: red; font-weight: 700; font-size: 30px;">Draft Only</span><br />
= Document Structure =<br />
<table width=1200><br />
<tr><td>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:<br />
</td></tr><br />
</table> <br />
# [[HowTo/Use the WagonX Library]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
<br><br />
<br />
__TOC__<br />
<br />
= The WagonX Reference =<br />
<table width=1200><br />
<tr><td>This page contains details of the WagonX extension container and sub-containers. Practical examples of usage can be found in the tutorials listed above.<br />
</td></tr><br />
</table> <br />
<br><br />
= Restricted Characters =<br />
<table width=1200><br />
<tr valign="top"><br />
<td>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 [[HowTo/WagonX - Technical Reference#display-values|display-values]].<br />
</td><br />
</tr><br />
<br />
<tr><br />
<td><br />
*Comma ( , )<br />
*Semicolon ( ; )<br />
*Backtick ( ` )<br />
*Colon ( : ) <br />
</td><br />
</tr><br />
</table><br />
<br><br />
= General Layout =<br />
<table width=1200><br />
<tr valign="top"><br />
<td>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:<br />
</td><br />
</tr><br />
<tr><td><br />
extensions<br />
{<br />
max_permitted_speed-60850 "50mph"<br />
active-coupling-standard-60850<br />
{<br />
...<br />
}<br />
wagon-x<br />
{<br />
...<br />
}<br />
}<br />
</td></tr><br />
</table><br />
<br><br />
<br />
= WagonX Properties =<br />
<table width=1200><br />
<tr valign="top"><br />
<td>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.<br />
</td><br />
</tr><br />
</table><br />
== ACS ==<br />
<!--start of ACS table--><br />
<table width=1200><br />
For help on creating the acs extensions and setting up the acs mesh-table objects, see [[HowTo/WagonX - Wagon Tutorial#Naming ACS mesh-table attachments]] and [[HowTo/WagonX - Wagon Tutorial#Setting up the WagonX soup]].<br />
<br><br />
Each tag is shown here with sample values. There are no default values.<br />
<tr><td><br />
acs<br />
{<br />
animated 1<br />
use-jbv-animation 1<br />
duration 1.0<br />
}<br />
<br />
*<b>animated (1 = true, 0=false)</b><br />
:This determines whether to use animations to move between the coupled and uncoupled state, or use individual static assets for each state.<br />
*<b>use-jbv-animation (1 = true, 0=false)</b><br />
: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.<br />
*<b>duration (a floating point value)</b><br />
: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)<br />
</td></tr><br />
</table> <!--end of ACS table--><br />
<br><br />
<br />
== Misc ==<br />
<!--start of Misc table--><br />
<table width=1200><br />
<!--Note for page author - is this for proper industries such as cargo or is it used for passengers at stations as well?--><br />
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. See also [[HowTo/WagonX - Wagon Tutorial#Setting up the WagonX soup]].<br />
<br />
Each available tag is shown here with sample values. There are no defaults.<br />
<tr><td><br />
misc<br />
{<br />
begin-load-time 5.0<br />
begin-unload-time 5.0<br />
end-load-time 1.0<br />
end-unload-time 1.0<br />
}<br />
<br />
*<b>begin-load-time (a floating point value)</b><br />
:The time it takes for the wagon to load at an industry<br />
*<b>begin-unload-time (a floating point value)</b><br />
:The time it takes for the wagon to unloading at an industry<br />
*<b>end-load-time (a floating point value)</b><br />
:The time it takes for the wagon end loading at an industry<br />
*<b>end-unload-time (a floating point value)</b><br />
:The time it takes for the wagon to end unloading at an industry<br />
</td></tr><br />
</table><br />
<!--end of misc table--><br />
<br />
== Marker-Lights ==<br />
<!--start of Marker-Lights table--><br />
<table width=1200><br />
The Marker-Lights container is used to show or hide light meshes that are identied by entries in the config mesh-table.<br />
<br />
Each tag is shown here with sample values. There are no defaults. See also [[HowTo/WagonX - Wagon Tutorial#Setting up the WagonX soup]]<br />
<tr><td><br />
marker-lights<br />
{<br />
enabled 1<br />
car-minimum-count 1<br />
require-locomotive 1<br />
night-only 0<br />
front<br />
{<br />
head<br />
{<br />
mesh "null"<br />
}<br />
tail<br />
{<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back<br />
{<br />
head<br />
{<br />
mesh "lamp-back-white"<br />
}<br />
tail<br />
{<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
<br />
<br />
*<b>enabled (1 = true, 0=false)</b><br />
:Whether or not the marker lights are active on this asset.<br />
*<b>car-minimum-count (an integer number)</b><br />
:The minimum number of cars that must be present in the consist for the marker-lights to activate.<br />
*<b>require-locomotive (1 = true, 0=false)</b><br />
:If set to 1, a traincar of Class locomotive will need to be present in the consist for the marker-lights to activate.<br />
*<b>night-only (1 = true, 0=false)</b><br />
:If set to 1, the lamps will only be visible at night, otherwise they will be displayed 24/7.<br />
*<b>Front/back head/tail containers</b><br />
:These containers identify the mesh to use for the front, back, head, and tail lamps. These meshes must be in the config mesh-table. See setting up the (LINK NEEDED) wagonx soup for examples.<br />
</td></tr></table><br />
<!--end of Marker-Lights table--><br />
<br />
== Browser-Properties ==<br />
<!--start of Browser-Properties container table--><br />
<table width=1200><br />
<tr><td><br />
*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.<br />
*A property can have sub properties that are activated with their parent.<br />
*A property container has a number of tags with values. Many are common to different property types but some are unique to a property.<br />
*A container need not contain all available tags.<br />
*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,<br />
</td></tr><br />
<br />
<tr><td><br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin"<br />
consist-property-sync 1<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
effects "texture-albedo,texture-parameter"<br />
asset "texturelib"<br />
files-path "null"<br />
values "0;3,1;4,2;5"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Clean,Weathered,Dirty"<br />
}<br />
1<br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "handbrake-lever,braking-system"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.2<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
}<br />
</td></tr><br />
</table><br />
<br />
<table width=1200><tr><td> <br />
===Supported Tags===<br />
Tag explanations. Some examples are included in the definition and, for others, see above for sample of usage.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====enabled====<br />
:Type: Boolean (1 = true, 0=false)<br />
:Compulsory: No<br />
:Default: No default.<br />
:Desc: Whether or not this property is active. This is useful for debugging, or if you want to disable it without removing everything.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====property-visibility====<br />
:Type: Integer - (0 = Hidden, 1 = Visible, 2 = Surveyor Only, 3 = Driver Only) <br />
:Compulsory: No<br />
:Default: 0 (hidden)<br />
:Desc: Indicates whether the property will be visible in the Properties Browser and in what mode. <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====name====<br />
:Type: String<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: The display name of this property, as will appear on the properties page.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td> <br />
====child-properties====<br />
:Type: A string of numbers separated by commas.<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: child-properties "2,4,5"<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====property-id====<br />
:Type: String<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: The formal name (ID) of this property, used to identify and change this property. For example, If the name is <b>Workflow</b>, it might be a good idea to call this <b>p_workflow</b>. <div style="color: #ff0080">This must be unique for each browser-property</div>.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====consist-property-sync====<br />
:Type: Integer - (0 off, 1 on (button), 2 on (automatic)<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====property-sync-id====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: property-sync-id "soundBell"<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====description====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The description of this attachment as it will appear in the Properties Browser.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
====kind====<br />
:Type: String<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: The type of property this will be. Can be one of the options below. Most of these are derived from [[Class MeshObject|Class_MeshObject]]. For more info on implementing these, see [[HowTo/WagonX - Technical Reference#values]].<br />
::*mesh-attachment<br />
:::Manipulate the mesh’s animation, position, visibility, etc. See mesh-attachment-type.<br />
::*fx-replacement<br />
:::Change an effect in the mesh. See [[HowTo/WagonX - Technical Reference#fx-replacement-type]].<br />
::*particle-effect<br />
:::Activate/Deactivate/Edit a particle effect (smoke0, smoke1, etc). See [[HowTo/WagonX - Technical Reference#particle-effects]] and [[HowTo/WagonX - Technical Reference#particle-effect-type]].<br />
::*sound-script<br />
:::Used to play a sound-script sound within this asset. See [[HowTo/WagonX - Technical Reference#sound-triggers]].<br />
::*config-edit<br />
:::Used to edit a tag in the wagon-x config soup. See paths.<br />
<!--need to come back and check this as I don't understand how this works--><br />
====particle-effect-type====<br />
:Type: String (kind mesh-attachment only)<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
:Example: kind "particle-effect"<br />
: particle-effect-type "pfx-message"<br />
::*[[pfx_Message|<span style="color: #0080ff">pfx-message</span>]]<br />
:::Send a message to enable/disable a particle effect.<br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start mesh-attachment--><br />
====mesh-attachment-type====<br />
:Type: String - (kind mesh-attachment only)<br />
:Example: kind "mesh-attachment"<br />
:: mesh-attachment-type "mesh-animation-frame"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
::*[[Class_MeshObject#SetMeshVisible|<span style="color: #0080ff">mesh-toggle</span>]]<br />
:::Toggle between the mesh(s) being visible or hidden.<br />
::*[[Class_MeshObject#SetMeshOrientation|<span style="color: #0080ff">mesh-translation-orientation</span>]]<br />
:::Sets the translation and orientation of the mesh(es)<br />
::*[[Class_MeshObject#SetMeshAnimationFrame|<span style="color: #0080ff">mesh-animation-frame</span>]]<br />
:::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.<br />
::*[[Class_MeshObject#StartMeshAnimationLoop|<span style="color: #0080ff">mesh-animation-loop</span>]]<br />
:::Start or stop an animation-loop on the mesh.<br />
::*[[Class_MeshObject#SetMeshAnimationState|<span style="color: #0080ff">mesh-animation-state</span>]]<br />
:::Sets the state of the mesh(s) animation.<br />
::*[[Class_MeshObject#SetMeshAnimationSpeed|<span style="color: #0080ff">mesh-animation-speed</span>]]<br />
:::Changes the speed of the meshes animation.<br />
<!--end mesh-attachment--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start fx-replacement-type--><br />
====fx-replacement-type====<br />
:Type: String)(kind fx-replacement only)<br />
:Example: kind "fx-replacement"<br />
:::fx-replacement-type "texture-replacement"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
::*[[Class_MeshObject#SetFXTextureReplacement|<span style="color: #0080ff">texture-replacement</span>]]<br />
:::Replaces a texture effect in this asset to one within a texture-group asset.<br />
::*[[Class_MeshObject#SetFXTextureReplacementTexture|<span style="color: #0080ff">texture-replacement-texture</span>]]<br />
:::Replaces a texture effect in this asset to one located within this asset.<br />
::*[[Class_MeshObject#SetFXCoronaTexture|<span style="color: #0080ff">corona</span>]]<br />
:::Replaces a corona effect in the asset.<br />
::*[[Class_MeshObject#SetFXNameText|<span style="color: #0080ff">name</span>]]<br />
:::Replaces a name effect in the asset.<br />
::*[[Class_MeshObject#SetFXAttachment|<span style="color: #0080ff">attachment</span>]]<br />
:::Replaces an attachment effect in the asset.<br />
::*[[Class_MeshObject#SetFXAnimationState|<span style="color: #0080ff">animation</span>]]<br />
:::Plays/Stops an animation effect in the asset.<br />
<!--end fx-replacement-type--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start duration--><br />
====duration====<br />
:Type: Float<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>(There may be issues with using this tag with mesh-toggle.)</b><br />
:Example: duration 3.2<br />
<!--end duration--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start meshes--><br />
====meshes====<br />
:Type: String - (a list of mesh names from the mesh-table separated by commas)<br />
:Example: meshes "handbrake-lever,braking-system"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end meshes--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start of effects (textures)--><br />
====effects====<br />
:Type: String - (a list of texture names (i.e. texture.txt names without the .txt) each separated by a comma)<br />
:Example: effects "texture-albedo,texture-parameter"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end of effects--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start of particle-effects--><br />
====particle-effects====<br />
:Type: String - (a list of integer numbers as a string)<br />
:Example: particle-effects "0,1"<br />
:Compulsory: No<br />
:Default: None<br />
:Desc: For kind particle-effect. The comma-separated list of PFX effects to be modified by the property. See kind for help on implementation. <b>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.</b><br />
<!--end particle-effects--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start target-asset tag--><br />
====target-asset====<br />
:Type: String<br />
:Example: target-asset "bogey-0"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>Only properties of kind “mesh-attachment” or “fx-replacement” can be used for properties that use this tag.</b><br />
<!--end target-asset tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start asset tag--><br />
====asset====<br />
:Type: String<br />
:Example: asset "texturelib"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end asset tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start files-path tag--><br />
====files-path====<br />
:Type: String - (a list of two strings)<br />
:Example: files-path "images/,.texture"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>files-path “images/left/.texture”</b>), where images/left is the path, and .texture is the extension for all the files.<br />
<!--end files-path tag--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start paths tag--><br />
<!--THIS DOESN'T LOOK RIGHT - CHECK--><br />
====paths====<br />
:Type: String - (a list of two strings)<br />
:Example: paths "marker-lights/night-only""<br />
:Compulsory: Yes<br />
:Default: None<br />
:Desc: For kind config-edit. A comma-separated list of paths that point to the tag in the wagon-x config to edit.<br />
<!--end paths tag--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start values tag--><br />
====values====<br />
:Type: String - (a string list separated by special characters)<br />
:Example1 values "0,15,30"<br />
:Compulsory: No<br />
:Default: None<br />
: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]].<br />
:<b>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.</b><br />
<!--mesh-attachment--><br />
:::*For kind mesh-attachment:<br />
::::*For mesh-attachment-type mesh-toggle, the value must be either 0 or 1 (visible/hidden) ???<br />
::::*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).<br />
::::Example: values "(0`2`4):(1.2`2`2),(0`0`0):(0`0`0)"<br />
<!--mesh-attachment-type--><br />
:::*For mesh-attachment-type mesh-animation-speed, the value is the speed of the animation for that index<br />
:::*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.<br />
:::*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 [[Class_MeshObject#GetMeshAnimationFrameCount|<span style="color: #0080ff">GetMeshAnimationFrameCount</span>]]).<br />
::::Example: values "0,30"<br />
:::*For mesh-attachment-type mesh-animation-loop, the value can be 0 or 1, to start/stop the loop<br />
<!--sound-script--><br />
:::*For kind sound-script, the value can be 0 or 1, to start/stop the soundscript event<br />
<!--config-edit--><br />
:::*For kind config-edit, the value is a string indicating the string value to assign to the config tag.<br />
<!--particle-effect--><br />
:::*For kind particle-effect:<br />
:::*For particle-effect-type pfx-message, the value follows the same rules for [[pfx message|<span style="color: #0080ff">pfx messages</span>]].<br />
::::*particle-effect-type "pfx-message"<br />
::::Example: values "+0+1,-1-0"<br />
<!--fx-replacement--><br />
:::*For kind fx-replacement:<br />
::::*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:<br />
::::Values “0,2,1” will reference the textures in the texture container at indexes 0, 2, and 1, in that order when cycled through.<br />
::::Example: values “0,2,1”<br />
<br />
kuid <kuid:1234:123456><br />
username "test texture group asset"<br />
trainz-build 4.6<br />
description "test texture group"<br />
textures<br />
{<br />
0 "textures\0albedo.texture"<br />
1 "textures\1albedo.texture"<br />
2 "textures\2albedo.texture"<br />
3 "textures\0parameter.texture"<br />
4 "textures\1parameter.texture"<br />
5 "textures\2parameter.texture" <br />
6 "textures\0normal.texture"<br />
7 "textures\1normal.texture"<br />
8 "textures\2normal.texture" <br />
}<br />
<br />
<br />
::::*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. <br />
::::Example: values "images/congleton.texture,images/burntisland.texture,images/buxton.texture,images/none.texture"<br />
::::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:<br />
::::Example: values "congleton,burntisland,buxton,none" <br />
<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Workflow Text: "<br />
property-id "p_workflow"<br />
description "Sets the Workflow"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement-texture"<br />
consist-property-sync 1<br />
meshes "null"<br />
effects "texture-extra"<br />
asset "null"<br />
files-path "images/,.texture"<br />
values "congleton,burntisland,buxton,none"<br />
default-index 0<br />
trigger "user"<br />
display-type "list"<br />
display-values "Congleton,Burntisland,Buxton,None"<br />
}<br />
<br />
::::*For fx-replacement-type attachment, the values are the names of the attachment effects to be replaced by the specified [[HowTo/WagonX - Technical Reference#asset]].<br />
::::*For fx-replacement-type corona, the values are the names of the corona effects to be replaced by the specified [[HowTo/WagonX - Technical Reference#asset]].<br />
::::*For fx-replacement-type animation, the values are the names of the animation effects to be replaced by the specified [[HowTo/WagonX - Technical Reference#asset]].<br />
::::*For fx-replacement-type name, the values are the names that will replace the current name of the specified name effect.. <br />
<!--end values tag--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start default-index--><br />
====default-index====<br />
:Type: Integer (-1 = random)<br />
:Example: default-index 0<br />
:Compulsory: No<br />
:Default: 0<br />
: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.<br />
<!--end default-index--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start sound-triggers--><br />
====sound-triggers====<br />
:Type: String - (a list of strings)<br />
:Example: sound-triggers "bell_1,bell_2"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end sound-triggers--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start trigger--><br />
====trigger====<br />
:Type: String<br />
:Example: trigger "user"<br />
:Compulsory: No<br />
:Default: Null (ignored)<br />
: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:<br />
:::*user<br />
:::*event<br />
:::*both<br />
:::*none <br />
<!--end trigger--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start events--><br />
====events====<br />
:Type: String - (a list of strings)<br />
:Example: events "handbrake-release,handbrake-apply"<br />
:Compulsory: No<br />
:Default: None<br />
: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). <br />
:::*begin-load/end-load/begin-unload/end-unload<br />
:::*handbrake-apply/handbrake-release<br />
:::*trainbrake-apply/trainbrake-release<br />
:::*headlight-on, headlight-off<br />
:::*horn<br />
:::*bell<br />
:::*sanding<br />
:::*pantograph-state-0/1/2/3 (see [[Class_Train#GetPantographState|<span style="color: #0080ff">GetPantographState</span>]])<br />
:::*weather-0/1/2/3/4/5/6/7 (see [[Class_World#GetWeatherType|<span style="color: #0080ff">GetWeatherType</span>]])<br />
:::*world-day/world-night<br />
:::*queue-(0 - ?)- loaded/empty (e.g. <b>queue-0-loaded, queue-1-empty</b>)<br />
<!--end events--> <br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start display-type--><br />
:Type: String<br />
:Example: display-type "link"<br />
:Compulsory: No<br />
:Default: None<br />
: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. <b>For trainzbuild 5.1 and 5.0, only link is supported for the View Details page.</b> Omitting this tag in combination with property-visibility set to 0 is useful for non-user triggers, such as world or train events.<br />
:::*string<br />
:::*int<br />
:::*float<br />
:::*list<br />
:::*link <br />
<!--end display-type--><br />
</td></tr></table><br />
<br />
<table width=1200><tr><td><br />
<!--start display-values--><br />
====display-values====<br />
:Type: String - (a list of strings)<br />
:Example: display-values "Clean,Weathered,Dirty"<br />
:Compulsory: No<br />
:Default: None<br />
: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.<br />
<!--end display-values--> <br />
</td></tr></table><br />
<br />
<br />
<table width=1200><br />
=Copyright Notice=<br />
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.<br />
</table></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/Use_the_WagonX_LibraryHowTo/Use the WagonX Library2023-09-27T04:52:45Z<p>Pcas1986: Draft version - checking for links,etc.</p>
<hr />
<div><!--the next line is the page title--><br />
<!--HowTo/Use the WagonX Library--><br />
<span style="color: red; font-weight: 700; font-size: 30px;">Draft Only</span><br />
= Document Structure =<br />
<table width=1200><br />
The WagonX Tutorial set is written over several TrainzWiKi pages. This page is an introduction to WagonX and its capabilties. Other pages in the series are:<br />
</table> <br />
# [[HowTo/WagonX - Reference]]<br><br />
# [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials]]<br><br />
# [[HowTo/WagonX - Traincar Tutorial]]<br><br />
# [[HowTo/WagonX - Locomotive Tutorial]]<br><br />
<br><br />
<br />
__TOC__<br />
<br />
= Introduction =<br />
== A discussion about "properties" ==<br />
<table width=1200><br />
<tr valign="top"><br />
<td>So what is a "property" and what is its purpose in Trainz?<br />
A Google search will reveal that a property in this context is a value or attribute of an object. In Trainz we generally call such objects <b>assets</b>. An example might be a traincar (wagon/car/carriage) and that traincar has some standard properties such as weight, cargo or passengers.<br />
<br />
But the standard properties are rather limited and, if a content creator wanted to add extra properties such as texture replacement, then a Trainz script is required. Creating such scripts is not easy even for experienced programmers. Maintaining scripts can create a huge amount of work if common scripts are replicated across many assets.<br />
<br />
This is where WagonX can help.<br />
</td><br />
</tr><br />
</table><br />
<br><br />
== WagonX and Properties ==<br />
<table width=1200><br />
<tr valign="top"><br />
<td>WagonX is a universal script library that simplifies adding properties and scripted features to your traincar assets.<br />
You can create an asset with all the perks of scripted assets without touching any TrainzScript (GS) files, or having much knowledge of trainzscript. You can set up a number of asset options, as identified in the following list, in the config.txt file. All the details are then automatically presented to the user in the View Details (property browser) dialog, making it easy to edit as needed.<br />
</td><br />
</tr><br />
</table><br />
<br><br />
== The WagonX Asset ==<br />
<table width=1200><br />
<tr valign="top"><br />
<td><br />
*The '''JBV WagonX Script Library - <kuid:661805:500008>''' is available on the Download Station.<br />
*It is suitable for asset with Trainz Builds 5.0 or higher. The library uses script functions only available from that version.<br />
</td><br />
</tr><br />
</table><br />
<br><br />
<br />
<table><br />
<tr valign="top"><br />
<td> <br />
<table width=1200 bgcolor=#000000 cellpadding=1><br />
<tr valign="top"><br />
<td><br />
<table width=1196 bgcolor=#ffffff cellpadding=2><br />
<tr valign="top"><br />
<td>The '''The WagonX Library''' can be used to set:-<br />
<table><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''animations''' - stop or start</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''texture replacements''' - loaded from a textures library asset</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''head codes''' - for UK vehicles</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''lamps''' - for UK vehicles</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''ACS controlled couplers and hoses''' - loaded from a suitable couplers/hoses mesh library</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''sounds'''</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''PFX effects''' - such as smoke or dust</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''triggered effects'''</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''consist synchronisation''' - such as texture swapping for vehicles also using WagonX in a consist</td><br />
</tr><br />
<tr valign="top"><br />
<td>[[image:DotPoint.JPG|10px|link=]]</td><br />
<td>'''...and much more.'''</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
</table><br />
<br><br />
<table width=1200><br />
<td><br />
This picture demonstrates entries in the config and the result in the Properties Browser in game. The asset is the library author's Prestwin 1/277 EXP (<kuid2:661805:1:1>).<br />
</td><br />
</table><br />
<table width=1500><br />
<tr valign="center"><br />
<td><br />
[[File:WagonX Documentation2.jpg|left]]<br />
</td> <br />
</tr><br />
</table><br />
<br />
<br />
<br />
= Implementation =<br />
== Basic configuration for the config.txt and asset script ==<br />
=== Background ===<br />
<table width=1200><br />
<td><br />
The library implementation for WagonX is a bit different from other library assets (such as Bloodnoks ACS lib or superscript) and utilizes a new script referencing technique from David Pistelak’s scripted assets. The traincar’s config.txt does not directly reference the wagon.gs file. It instead must reference a (mostly) blank gs file that will hold the information for the WagonX gs file. In this case, this special file is named ref.gs and the class to used is eRef.<br />
</td><br />
</table><br />
<br />
=== The asset script ===<br />
<table width=1200><br />
<td>You will need to create a Trainzscript file called "ref.gs" and include it with your asset files. <b>Do not add any other code to ref.gs as future updates to the WagonX library may break your asset.</b> The content of ref.gs should be:<br />
</td><br />
</table><br />
<br />
include "WagonX.gs"<br />
class eRef isclass WagonX{};<br />
<br />
<br />
=== Config.txt - first steps ===<br />
<table width=1200><br />
<td>Let's start with the basic tags needed to make WagonX work. You will need to include script and class tags, a script-include-table, and a kuid-table reference if you are using ACSLib to control couplers and coupled hoses. <b>The spelling and capitisation of the class name is important.</b> The config entries should look like this:<br />
</td><br />
</table><br />
<br />
<!--indent this bit so a block is created--><br />
script-include-table<br />
{<br />
0 <kuid:661805:500008><br />
}<br />
script "ref.gs"<br />
class "eRef" <br />
kuid-table<br />
{<br />
acslib <kuid2:60850:89100><br />
}<br />
<br />
<table width=1200><br />
<td>That's it for the initial referencing of the script into your asset. The rest of the information for the script library goes inside the extensions container, under a sub-container that must be named “wagon-x”, all of which will be explained in the next sections. The following is a general example of how an extensions container using ACS and WagonX might appear. It may not be suitable for your application.<br />
</td><br />
</table><br />
<br />
extensions<br />
{<br />
max_permitted_speed-60850 "50mph"<br />
active-coupling-standard-60850<br />
{<br />
version-major "2"<br />
version-minor "0"<br />
brakes "vac"<br />
front<br />
{<br />
coupler "instanter|hook"<br />
vacbrake "twin"<br />
}<br />
back<br />
{<br />
coupler "instanter|hook"<br />
vacbrake "twin"<br />
}<br />
}<br />
wagon-x<br />
{<br />
acs<br />
{<br />
animated 1<br />
use-jbv-animation 1<br />
duration 1.5<br />
}<br />
misc<br />
{<br />
begin-load-time 15<br />
begin-unload-time 5<br />
end-load-time 1<br />
end-unload-time 1<br />
}<br />
marker-lights<br />
{<br />
enabled 1<br />
car-minimum-count 1<br />
require-locomotive 1<br />
front<br />
{<br />
head<br />
{<br />
mesh "null"<br />
}<br />
tail<br />
{<br />
mesh "lamp-front-red"<br />
}<br />
}<br />
back<br />
{<br />
head<br />
{<br />
mesh "lamp-back-white"<br />
}<br />
tail<br />
{<br />
mesh "lamp-back-red"<br />
}<br />
}<br />
}<br />
browser-properties<br />
{<br />
0<br />
{<br />
enabled 1<br />
property-visibility 1<br />
name "Skin: "<br />
property-id "p_skin"<br />
description "Sets the weathering type"<br />
kind "fx-replacement"<br />
fx-replacement-type "texture-replacement"<br />
meshes "null"<br />
effects "texture-albedo,texture-parameter"<br />
asset "texturelib"<br />
files-path "null"<br />
values "0;3,1;4,2;5"<br />
default-index -1<br />
trigger "user"<br />
display-type "link"<br />
display-values "Clean,Weathered,Dirty"<br />
} <br />
1<br />
{<br />
enabled 1<br />
property-visibility 0<br />
name "Handbrake State: "<br />
property-id "p_handbrake"<br />
description "Toggle the handbrake"<br />
kind "mesh-attachment"<br />
mesh-attachment-type "mesh-animation-frame"<br />
meshes "handbrake-lever,braking-system"<br />
values "0;0,30;30"<br />
events "handbrake-release,handbrake-apply"<br />
duration 3.2<br />
default-index 0<br />
trigger "both"<br />
display-type "link"<br />
display-values "release,apply"<br />
}<br />
}<br />
}<br />
}<br />
<br><br />
<br />
= Next Steps =<br />
<table width=1200><br />
<td>This page has been a basic introduction to WagonX. Some basic tutorials to setup some WagonX properties can be found at the [[HowTo/WagonX - Browser Properties Examples and Basic Tutorials|<span style="color: #0080ff">Basic Tutorials</span>]] page.<br><br />
You can find a locomotive tutorial at the [[HowTo/WagonX - Locomotive Tutorial|<span style="color: #0080ff">Locomotive Tutorial</span>]] page and a traincar tutorial at the [[HowTo/WagonX - Traincar Tutorial|<span style="color: #0080ff">Traincar Tutorial</span>]] page.<br><br />
These tutorials are supported by a detailed WagonX reference at the [[HowTo/WagonX - Reference|<span style="color: #0080ff">WagonX Reference</span>]] page.<br />
</td><br />
</table><br />
<br />
<table width=1200><br />
=Copyright Notice=<br />
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.<br />
</table><br />
<br />
<!--=Return to Index=<br />
<br />
[[HowToGuides|<< How To Guides]]<br />
[[Category:How-to guides]]<br />
[[Category:Modeling]]<br />
[[Category:Content creation]]<br />
[[Category:WagonX]]--></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/File:WagonX_Documentation2.jpgFile:WagonX Documentation2.jpg2023-09-16T04:57:48Z<p>Pcas1986: Image for WagonX doco page</p>
<hr />
<div>Image for WagonX doco page</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/Getting_Started_in_TrainzScriptGetting Started in TrainzScript2023-08-05T23:27:59Z<p>Pcas1986: A note to say the Andi06 tutorials need rewriting.</p>
<hr />
<div>==Script Usage==<br />
<br />
* In [[Trainz SP3]], script support was added to allow the creation of scripted [[KIND Activity|scenarios]] (interactive activities.) While existing scenarios are still usable in [[TS2010]], creation of these assets has not been supported by [[N3V]] since [[TRS2006]] and future versions of Trainz will drop support for this asset kind entirely.<br />
* Scripts are used to make objects perform operations in reaction to events. For example a level crossing (grade crossing) can be made to operate as a train approaches it.<br />
* [[KIND Behavior|Rules]] are written as scripts, and these rules can be included in Driver sessions, effectively as the session's program elements.<br />
* [[KIND Drivercommand|Driver commands]] are written as scripts, and these can also be included in Driver sessions so as to give train drivers a series of operations to perform.<br />
<br />
<br />
==Creating and Editing Scripts, Tools to Use==<br />
<br />
* Trainz scripts need to be included in your asset folder as plain text files with a *.gs file extension.<br />
* Compile-time errors in the script, including spelling or syntax errors, cause the parent asset to be flagged as erroneous by [[Content Manager]].<br />
* Runtime errors won't be flagged up until you load a map which uses your asset or when you first place your asset on a map.<br />
* Although you can use Notepad to create and edit files and commit them directly to the game, it will quickly become frustrating having to run TRS to find that you have missed out a semicolon or closing quote.<br />
* Trainz also includes command-line error checking support through [[TrainzUtil]] for situations where the [[Content Manager]] GUI is inappropriate.<br />
* Editors which will help you to ensure that your scripts are correctly formatted are freely available, one such is Context and details of how to obtain it and set it up for Trainz are included at this page: [[Using Context with Trainzscript]]. Another such program is TextPad (http://www.textpad.com).<br />
<br />
==Tutorials==<br />
The following are links to various tutorial pages available for TrainzScript. (Temporary notes: These were last updated to reflect TS12 standards and the base script libraries have changed significantly since mid TS19 versions. Do not assume they will work in TS22. They will be rewritten.)<br />
<br />
'''For Beginners:'''<br><br />
A set of tutorials by Andi Smith which will take you through the steps involved in setting up a simple script on a scenery asset, starting with the traditional 'Hello World' and ending with the use of a Property Interface to deal with basic effects, including animation, sounds and texture replacement. The tutorials largely avoid object-oriented terms such as encapulation, inheritance and polymorphism, and instead try to concentrate on getting your scripts working as quickly and painlessly as possible.<br />
<br />
# [[Hello World, Setting Up An Asset Script.]]<br><br />
# [[Getting Information From the Game, Writing Your Own Methods.]]<br><br />
# [[Talking to Yourself, Sending Messages.]]<br><br />
# [[Saving and Restoring Data, Using Properties.]]<br><br />
# [[Setting Up the Asset.]]<br><br />
# [[Automating Animations.]]<br><br />
# [[Handling Corona Effects.]]<br><br />
# [[Playing Sounds.]]<br><br />
# [[Hiding Meshes.]]<br><br />
# [[Handling Name Effects.]]<br><br />
# [[Texture Replacement.]]<br><br />
<br />
==Script Compilation Errors==<br />
The follow is a list of compilation errors and possible causes:<br><br><br />
Error: ''Unable to link compiled script class''.<br><br />
Possible cause: The class name in the config.txt class tag is not found in the script identified in the script tag. Generally this is a misspelling.<br><br><br />
Error: ''...parse error...in line xxx''<br><br />
Possible cause: Perhaps the most common error found during compilation. This means that the compiler was unable to continue because of format errors. Usually the error will be on Trainzscript lines preceding the line number in the error. Look for missing closing curly brackets ( } ), or invalid constructs. The compiler always stops at the first error and errors later in the source file will not be identified. This is why it is always best to add small amounts of code and then check for errors.<br><br></div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/M.pbrmetalmaskedM.pbrmetalmasked2023-07-28T05:42:27Z<p>Pcas1986: Added notes about AlphaHint tag in texture.txt file, and blend-mode tag in metadata file.</p>
<hr />
<div>[[m.pbrmetalmasked]] is a minor variation on the [[m.pbrmetal]] material. It adds a [[masked alpha]] channel to allow a complex outline to be created without the use of large numbers of [[polygon]]s. All PBR materials are defined using a multitude of texture channels (not just a simple RGB image) which define various aspects of the material on a per-texel basis. One major advantage of this approach is that a single in-game material can be used to display various different real-world materials, rather than requiring multiple separate in-game materials with different parameters. Trainz uses a Metallic/Roughness style PBR workflow.<br />
<br />
It should be noted that the "metal" in the name of this material refers to the physical property used in the lighting equations; it does not mean that the material is only appropriate for metallic surfaces.<br />
<br />
On some hardware, [[masked alpha]] materials may perform substantially worse than an opaque material. This cost is per-[[fragment]], meaning that it may be suitable to use a masked material on low-[[Level of Detail|LOD]] meshes where polygon count must remain low and where fragment count is naturally low. On higher-LOD meshes, especially where the material is expected to fill a reasonable percentage of the screen, masked materials should be avoided in favor of higher polygon detail, or should be used in conjunction with true opaque materials such that the majority of opaque fragments are filled by the opaque materials and only the complex edge detail is filled by the masked material.<br />
<br />
This page describes content format v4.6 and assumes that the FBX file format is used as a data source for any meshes.<br />
<br />
=Texture Slots=<br />
The following texture slots are used for this material. All textures should typically have the same dimensions unless they represent a uniform color, however this is not strictly enforced.<br />
<br />
==Albedo==<br />
RGB: The [[albedo map]] defines the base color of each texel. The sRGB color space is used.<br />
<br />
A: The alpha channel provides a "black and white" [[masked alpha]] channel. Black indicates full transparency, meaning that the [[fragment]] is discarded. White indicates full opacity, meaning that rendering proceeds as per [[m.pbrmetal]]. If the alpha channel is omitted, this material acts exactly as [[m.pbrmetal]] except with lower performance. Note that unlike legacy Trainz materials, PBR materials do not autodetect opacity mode based on the texture in use. The content creator must select the appropriate material for their desired outcome. Runtime texture replacement should not expect to replace an opaque texture with a blended or masked texture and have the material update automatically.<br />
<br />
You may need to include an alpha-hint tag in your albedo texture.txt file. See [[.texture.txt_Files]]. If creating a double sided material using metadata you should also consider using a blend-mode tag. See [[Mesh_metadata_file]].<br />
<br />
<br />
'''Albedo Texture Example'''<br />
<br />
[[File:PortalAlbedowAlpha.png|500px]]<br />
<br />
Color Channel Separated<br />
<br />
[[File:PortalAlbedo.png|500px]]<br />
<br />
Alpha Channel Separated<br />
<br />
[[File:PortalAlpha.png|500px]]<br />
<br />
==Normal==<br />
RGB: Surface [[normal map]]. This defines which way the surface is facing, relative to the interpolated vertex normals. Since this is an XYZ format rather than color data, it should never be modified in Photoshop. Using Photoshop to add a fourth channel or copy/paste smaller textures into a [[texture atlas]] is acceptable. Per-pixel manipulation or use of filters on the "RGB" channels is not acceptable.<br />
<br />
A: [[Parallax Occlusion Map|Displacement height]]. 0.0 represents the deepest possible value, while 1.0 represents the shallowest possible value. While it is possible to paint this data in Photoshop, a linear color space must be used, and far superior results will be available through other data sources. The parallax height and the surface normal must be kept in sync, which means that a third-party tool must be used to generate the surface normal from the parallax height if you are painting this map manually.<br />
<br />
'''Normal Texture Example with no Alpha Channel (Parallax)'''<br />
<br />
[[File:pbrnormalmap1.jpg|border|middle|x200px]]<br />
<br />
<br />
'''Normal Texture Example with Alpha Channel (Parallax)'''<br />
<br />
[[File:pbrnormalwithalpha.jpg|border|middle|x200px]]<br />
<br />
==Parameter==<br />
This texture is comprised of four separate channels which each form a separate data element. Linear color space (not sRGB) is used for these channels.<br />
<br />
[[File:pbrparametersall.jpg|border|middle|x200px]]<br />
<br />
<br />
R: Emissive. This causes the texture to have an internal glow, even when no external light is present. Used for phosphors, permanently-lit markings, etc. The glow color is based on the albedo. Note that this glow does not cast light upon surrounding surfaces except via the Bloom post-processing effect.<br />
<br />
<br />
'''Parameters (Emissive - Red Channel) Texture Example'''<br />
<br />
[[File:pbrparametersemissivemap1.jpg|border|middle|x200px]]<br />
<br />
G: Roughness. Defines whether the surface reflections are shiny (0.0) or matte (1.0). See the [[Physically Based Rendering|PBR metal workflow]] for details.<br />
<br />
<br />
'''Parameters (Roughness - Green Channel) Texture Example'''<br />
<br />
[[File:pbrparametersroughnessmap1.jpg|border|middle|x200px]]<br />
<br />
B: Ambient Occlusion. Defines whether the surface is exposed to ambient lighting conditions (1.0) or affected only by direct lighting (0.0).<br />
<br />
<br />
'''Parameters (Ambient Occlusion - Blue Channel) Texture Example'''<br />
<br />
[[File:pbrparametersambientocclusionmap1.jpg|border|middle|x200px]]<br />
<br />
A: Metallicity. Defines whether the surface is metallic (1.0) with the albedo used to colorize reflected light, or dielectric (0.0) with the albedo used to colorize the surface. While intermediate values are not physically accurate, they may be used to emulate subsurfaces which are partially metallic. See the [[Physically Based Rendering|PBR metal workflow]] for details.<br />
<br />
<br />
'''Parameters (Metallic - Alpha Channel) Texture Example'''<br />
<br />
[[File:pbrparametersmetallicmap1.jpg|border|middle|x200px]]<br />
<br />
=Examples=<br />
<br />
[[File:trainz_material_pbrmetalmasked.jpg|border|middle|x512px]]<br />
<br />
Example asset download:<br />
<br />
[http://download.trainzportal.com/tutorials/Trainz_Material_-_pbrmetalmasked.cdp Trainz Material - pbrmetalmasked + emissive]<br />
<br />
=3ds Max Material Configuration=<br />
<br />
'''Texture Assignment'''<br />
<br />
[[File:kosl.png]]<br />
<br />
=Blender Material Configuration (2.7x)=<br />
You must use the Blender Render option in Blender as the Cycles Render doesn't export the texture names associated with the material. The cycles option is still being investigated.<br />
<br />
The albedo must have the "Use Alpha" and Influence->Diffuse->Alpha tag ticked. The normal does not require any special settings. The parameters texture must use the Influence->Specular->Hardness tag (checkbox). The value of the hardness is not exported by the Blender FBX exporter. Sample settings are shown below. All textures except the albedo are using png in this example because they do not require an Alpha channel.<br />
<br />
[[File:BlenderFBXmglassAlbedo.png|border|middle|x700px]] [[File:BlenderFBXmglassNormal.png|border|middle|x700px]] [[File:BlenderFBXmglassparameter.png|border|middle|x700px]]<br />
<br />
=Blender Material Configuration (2.8+)=<br />
<br />
The shader node is a Principled BSDF shader and the FBX exporter supports the export of some texture names but not all. The following connections should be made:<br />
<br />
Albedo texture to the Base Color input.<br />
<br />
Parameter texture to the Roughness input.<br />
<br />
The normal texture, via a normal converter set to Tangent, to the Normal input.<br />
<br />
The 3D view of the mesh does not show a true PBR render.<br />
<br />
You will need to update the texture.txt files created by the Trainz FBX importer.<br />
<br />
<br />
[[File:Blender 2.80 shader export nodes.jpg|border|middle|x700px]]<br />
<br />
=Using masked material meshes close to other meshes=<br />
<br />
Masked material meshes, including logos, names or numbers such as those on the side of a traincar, should match the roughness and metallicity of the adjacent material to mimic the same reflection. This can be an issue when the masked mesh is in shadow.<br />
<br />
<br />
[[Category:Material types| ]]<br />
[[Category:Modeling]]<br />
[[Category:Content creation]]</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/Outputs_containerOutputs container2022-12-04T02:13:52Z<p>Pcas1986: Note about the amount value.</p>
<hr />
<div>The [[Outputs container]] is a top-level [[config.txt file]] entry used within [[Processes_container|processes]] containers (for [[KIND Industry]] and [[KIND Buildable]]).<br />
<br />
== Supported Tags ==<br />
The outputs subcontainer is a list of subcontainers with no standalone tags. Each outputs subcontainer supports the following tags (shown here with its default value).<br />
<br />
amount N/A<br />
queue N/A<br />
<br />
==== amount ====<br />
:Type: int<br />
:Desc: Specifies the amount of this output to produce for the parent process. If this is zero then the output container information will not appear in the View Details dialog box.<br />
<br />
==== queue ====<br />
:Type: string<br />
:Desc: Specifies the product to produce, via it's name in the [["Queues"_container|queues container]]<br />
<br />
== Example controls container ==<br />
See [[KIND_Industry#Example_Config.txt|KIND Industry]]<br />
<br />
== Categories ==<br />
[[Category:Config Container]]</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/Inputs_containerInputs container2022-12-04T02:03:43Z<p>Pcas1986: Note about using a zero amount.</p>
<hr />
<div>The [[Inputs container]] is a top-level [[config.txt file]] entry used within [[Processes_container|processes]] containers (for [[KIND Industry]] and [[KIND Buildable]]).<br />
<br />
== Supported Tags ==<br />
The inputs subcontainer is a list of subcontainers with no standalone tags. Each inputs subcontainer shall have a unique identifier that can be a simple number such as 0 or 1. Inputs subcontainers support the following tags (shown here with its default value).<br />
<br />
amount N/A<br />
queue N/A<br />
<br />
==== amount ====<br />
:Type: int<br />
:Desc: Specifies the amount of this input to consume for the parent process. If this is zero then the input container information will not appear in the View Details dialog box. For example, if you are constructing a transfer station for the same product, such as coal, as both input and output, then put some token value here.<br />
<br />
==== queue ====<br />
:Type: string<br />
:Desc: Specifies the product to consume, via it's name in the [["Queues"_container|queues container]]<br />
<br />
== Example controls container ==<br />
See [[KIND_Industry#Example_Config.txt|KIND Industry]]<br />
<br />
== Categories ==<br />
[[Category:Config Container]]</div>Pcas1986https://online.ts2009.com/mediaWiki/index.php/HowTo/Upgrade_obsolete_script_functions_-_simple_examplesHowTo/Upgrade obsolete script functions - simple examples2022-09-13T05:41:48Z<p>Pcas1986: </p>
<hr />
<div>These are examples of solutions for common and simple obsolete Trainzscript functions. This is not an exhaustive list. Solutions for more complex obsolete functions can be found (TBD).<br />
<br />
'''Under Development''' The contents and the layout of this page is under development.<br />
<br />
<br />
<br />
=class Crossing=<br />
<br />
==SetCrossingAutomatic()==<br />
==SetCrossingState()==<br />
<br />
Error: VE197: Syntax error in script 'somescript.gs' for asset <kuid:0000:0000> "Asset Name".<br><br />
Error: VE267: somescript.gs(48) : function SetCrossingAutomatic is obsolete in object Crossing.<br><br />
Error: VE267: somescript.gs(48) : function SetCrossingState is obsolete in object Crossing.<br />
<br />
This method now requires a SecurityToken as a parameter to the function call<br />
<br />
'''Repair'''<br />
<br />
You need to initialize a SecurityToken, then add it as a parameter to your function calls.<br />
<br />
'''Usage example:'''<br />
<br />
In your header add<br />
<br />
SecurityToken stoken;<br />
<br />
Then in your function calls add your token.<br />
<br />
SetCrossingAutomatic(stoken, false);<br />
SetCrossingState(stoken, 1);<br />
<br />
More information on [[Class Crossing]]<br />
<br />
<br />
=class HTMLWindow=<br />
<br />
==GetCompleteIndustryViewDetailsHTMLCode()==<br />
<br />
VE267: somescript.gs(linenumber) : function GetCompleteIndustryViewDetailsHTMLCode is obsolete in object HTMLWindow.<br><br />
<br />
This error occurs when trying to use this method with an obsolete class. In this case, class GenericIndustry has been obsoleted and replaced with BaseIndustry.<br />
<br />
'''Repair'''<br />
<br />
Change all instances of 'GenericIndustry' in the code to 'BaseIndustry'.<br />
<br />
'''Usage example:'''<br />
<br />
include "BaseIndustry.gs"<br />
class <myclass> isclass BaseIndustry><br />
<br />
=class IndustryProductInfoCollection=<br />
<br />
==GetProductIndexFromAsset()==<br />
<br />
<kuid2:00000:00000:1> : VE267: multipleindustryplus.gs(711) : function GetProductIndexFromAsset is obsolete in object IndustryProductInfoCollection.<br><br />
<br />
'''Repair'''<br />
<br />
Replace with GetProductIndex(Asset product) from the same class. The returned value (int) is the same.<br />
<br />
==GetProcessIndexFromName()==<br />
<br />
<kuid2:00000:00000:1> : VE267: multipleindustryplus.gs(2024) : function GetProcessIndexFromName is obsolete in object IndustryProductInfoCollection.<br />
<br />
'''Repair'''<br />
Replace with GetProcessIndex(int productIndex, string processName) from the same class. The returned value (int) is the same.<br />
<br />
==AddProduct()==<br />
<br />
<kuid2:00000:00000:1> : VE267: somescript.gs(999) : function AddProduct(string, string) is obsolete in object IndustryProductInfoCollection.<br />
<br />
'''Repair'''<br />
Replace with AddProduct(Asset product, Vehicle vehicle) from the same class. Instead of using strings for product and vehicle names, you will need to provide a product asset and a vehicle of type Vehicle.<br />
<br />
'''Usage example:'''<br />
TBD<br />
<br />
=class Train=<br />
<br />
==GetVelocity()==<br />
<br />
GetVelocity obsolete error or warning: <kuid:0000:0000> : VE267: somescript.gs(299) : function GetVelocity is obsolete in object Train.<br />
<br />
<br />
'''Repair'''<br />
<br />
You have two replacement options in the Train class (train.gs):<br />
<br />
<br />
''float GetSmoothedVelocity(void);''<br />
<br />
This function return the train's velocity in metres per second and is suitable for human viewing such as a cab display.<br />
<br />
<br />
''float GetTrainVelocity(void);'' <br />
<br />
This function provides the instantaneous velocity for vehicles in this train, which is good for physics calculations but not good for human-readable display.<br><br><br />
<br />
'''Usage example:''' <br />
<br />
float mySpeed;<br />
mySpeed = GetSmoothedVelocity(); // this is the more likely option but depends on what the overall script is trying to do.<br />
<br />
// or the more accurate version<br />
mySpeed = GetTrainVelocity();<br />
<br />
<br />
=class Vehicle=<br />
<br />
==GetFacingRelativeToTrain()==<br />
<br />
???GetFacingRelativeToTrain obsolete error or warning: <kuid:0000:0000> : VE267: somescript.gs(450) : function GetFacingRelativeToTrain is obsolete in object Vehicle.<br />
<br />
<br />
'''Repair'''<br />
<br />
You have one replacement option in the Vehicle class (vehicle.gs):<br />
<br />
<br />
''bool GetDirectionRelativeToTrain(void);''<br />
<br />
This function returns true if the vehicle faces the same way as the Train, false otherwise. This function is a bit tricky to understand and especially when a vehicle, such as a coach/carriage, is involved.<br />
<br />
'''Usage example1:''' <br />
<br />
Vehicle myVehicle;<br />
bool sameDirectionAsTrain;<br />
<br />
sameDirectionAsTrain = GetDirectionRelativeToTrain(); <br />
<br />
'''Usage example2:''' <br />
<br />
Vehicle[] trainVehicles;<br />
Vehicle myVehicle;<br />
bool sameDirectionAsTrain;<br />
int i;<br />
<br />
trainVehicles = GetMyTrain().GetVehicles();<br />
<br />
if (trainVehicles) { //unlikely to be null but ...<br />
<br />
for (i = 0; i < trainVehicles.size(); ++i) {<br />
//get direction of this vehicle in the train<br />
sameDirectionAsTrain = trainVehicles[i].GetDirectionRelativeToTrain();<br />
if (sameDirectionAsTrain) {<br />
// do what is necessary here<br />
Interface.Print("Vehicle "+ (i+1) + " is facing forward"); // add 1 so that the first vehicle is number 1 and not 0 (zero)<br />
} else {<br />
Interface.Print("Vehicle "+ (i+1) + " is facing backwards"); <br />
}<br />
}<br />
<br />
}</div>Pcas1986