AssetX Scripts
(→Add TrainzUtil to your AssetX Menu: AssetX v 2.2) |
(→Script Code for Sharing) |
||
Line 54: | Line 54: | ||
-delete|config.txt\name | -delete|config.txt\name | ||
-EndIf | -EndIf | ||
+ | |||
+ | =Corrected Version of Install Superscript.axm= | ||
+ | This corrects some typos in the file provided with the AssetX installation. Copy and paste the following and save in the scripts folder as 'Install Superscript.axm' | ||
+ | |||
+ | ;install library and asset stub script | ||
+ | -If|kind!traincar | ||
+ | -Info|Script can only be used with kind traincar assets | ||
+ | -Exit | ||
+ | -EndIf | ||
+ | |||
+ | -IfAsset|<kuid2:122285:508:14> | ||
+ | -Else | ||
+ | -Info|Script requires that Superscript Library <kuid2:122285:508:14> or later must be open in AssetX. | ||
+ | -Exit | ||
+ | -EndIf | ||
+ | |||
+ | -If|engine= | ||
+ | -Info|Asset has no engine tag, please correct and re-run script | ||
+ | -Exit | ||
+ | -EndIf | ||
+ | |||
+ | -Update|script-include-table\superscript|<kuid2:122285:508:14> | ||
+ | -Update|kuid-table\codelib|<kuid2:122285:508:14> | ||
+ | -If|engine=1 | ||
+ | -IfAsset|<kuid2:122285:508:14> | ||
+ | -CopyFromAsset|lstub.gs | ||
+ | -EndIf | ||
+ | -Update|script|LStub | ||
+ | -Update|class|LStub | ||
+ | -Else | ||
+ | -IfAsset|<kuid2:122285:508:14> | ||
+ | -CopyFromAsset|vstub.gs | ||
+ | -EndIf | ||
+ | -Update|script|VStub | ||
+ | -Update|class|VStub | ||
+ | -EndIf | ||
+ | |||
+ | ;extensions container options | ||
+ | -IfQuery||Run in Debug Mode? | ||
+ | -Update|extensions\debug-122285|1 | ||
+ | -EndIf | ||
+ | -IfQuery||Change Train Heading via View-Details in Driver? | ||
+ | -Update|extensions\heading-122285|1 | ||
+ | -EndIf | ||
+ | |||
+ | ;front mesh | ||
+ | -IfQuery||Add Front of Car Marker (used when debugging attachments)? | ||
+ | -Update|mesh-table\front\mesh-asset|<kuid:122285:508> | ||
+ | -Update|mesh-table\front\mesh|front.im | ||
+ | -Update|mesh-table\front\att|a.limfront | ||
+ | -Update|mesh-table\front\att-parent|default | ||
+ | -Update|mesh-table\front\auto-create|0 | ||
+ | -EndIf | ||
+ | |||
+ | ;mesh-table front headlight | ||
+ | -IfQuery||Add Headlight at Front of Car? | ||
+ | -Update|mesh-table\default\effects\headlight-0\kind|corona | ||
+ | -Update|mesh-table\default\effects\headlight-0\att|a.headlight-0 | ||
+ | -Update|mesh-table\default\effects\headlight-0\texture-kuid|<kuid:104722:100> | ||
+ | -Update|mesh-table\default\effects\headlight-0\object-size|0.12 | ||
+ | -EndIf | ||
+ | |||
+ | ;mesh-table rear headlight | ||
+ | -IfQuery||Add Headlight at Rear of Car? | ||
+ | -Update|mesh-table\default\effects\headlight-1\kind|corona | ||
+ | -Update|mesh-table\default\effects\headlight-1\att|a.headlight-1 | ||
+ | -Update|mesh-table\default\effects\headlight-1\texture-kuid|<kuid:104722:100> | ||
+ | -Update|mesh-table\default\effects\headlight-1\object-size|0.12 | ||
+ | -EndIf | ||
+ | |||
+ | ;mesh-table front taillamp | ||
+ | -IfQuery||Add Tail Light at Front of Car? | ||
+ | -Update|mesh-table\default\effects\taillight-0\kind|corona | ||
+ | -Update|mesh-table\default\effects\taillight-0\att|a.taillight-0 | ||
+ | -Update|mesh-table\default\effects\taillight-0\texture-kuid|<kuid:104722:200> | ||
+ | -Update|mesh-table\default\effects\taillight-0\object-size|0.12 | ||
+ | -EndIf | ||
+ | |||
+ | ;mesh-table rear taillamp | ||
+ | -IfQuery||Add Tail Light at Rear of Car? | ||
+ | -Update|mesh-table\default\effects\taillight-1\kind|corona | ||
+ | -Update|mesh-table\default\effects\taillight-1\att|a.taillight-1 | ||
+ | -Update|mesh-table\default\effects\taillight-1\texture-kuid|<kuid:104722:200> | ||
+ | -Update|mesh-table\default\effects\taillight-1\object-size|0.12 | ||
+ | -EndIf | ||
+ | |||
+ | ;lamp bodies | ||
+ | -IfQuery||Add Lamp Bodies? | ||
+ | -If|mesh-table\default\effects\headlight-0\kind$ | ||
+ | -Update|mesh-table\headlight-0-body\mesh-asset|<kuid:122285:508> | ||
+ | -Update|mesh-table\headlight-0-body\mesh|lamp.im | ||
+ | -Update|mesh-table\headlight-0-body\att|a.headlight-0 | ||
+ | -Update|mesh-table\headlight-0-body\att-parent|default | ||
+ | -EndIf | ||
+ | -If|mesh-table\default\effects\headlight-1\kind$ | ||
+ | -Update|mesh-table\headlight-1-body\mesh-asset|<kuid:122285:508> | ||
+ | -Update|mesh-table\headlight-1-body\mesh|lamp.im | ||
+ | -Update|mesh-table\headlight-1-body\att|a.headlight-1 | ||
+ | -Update|mesh-table\headlight-1-body\att-parent|default | ||
+ | -EndIf | ||
+ | -If|mesh-table\default\effects\taillight-0\kind$ | ||
+ | -Update|mesh-table\taillight-0-body\mesh-asset|<kuid:122285:508> | ||
+ | -Update|mesh-table\taillight-0-body\mesh|lamp.im | ||
+ | -Update|mesh-table\taillight-0-body\att|a.taillight-0 | ||
+ | -Update|mesh-table\taillight-0-body\att-parent|default | ||
+ | -EndIf | ||
+ | -If|mesh-table\default\effects\taillight-1\kind$ | ||
+ | -Update|mesh-table\taillight-1-body\mesh-asset|<kuid:122285:508> | ||
+ | -Update|mesh-table\taillight-1-body\mesh|lamp.im | ||
+ | -Update|mesh-table\taillight-1-body\att|a.taillight-1 | ||
+ | -Update|mesh-table\taillight-1-body\att-parent|default | ||
+ | -EndIf | ||
+ | -EndIf | ||
+ | |||
+ | ;corridors | ||
+ | -IfQuery||Add Corridor at Front of Car? | ||
+ | -Update|extensions\corridor-0-122285|1 | ||
+ | -Update|mesh-table\corridor-0\mesh-asset|<kuid:122285:508> | ||
+ | -Update|mesh-table\corridor-0\mesh|corridor.im | ||
+ | -Update|mesh-table\corridor-0\anim|corridor.kin | ||
+ | -Update|mesh-table\corridor-0\auto-create|1 | ||
+ | -Update|mesh-table\corridor-0\att|a.couple0 | ||
+ | -Update|mesh-table\corridor-0\att-parent|default | ||
+ | -EndIf | ||
+ | |||
+ | -IfQuery||Add Corridor at Rear of Car? | ||
+ | -Update|extensions\corridor-1-122285|1 | ||
+ | -Update|mesh-table\corridor-1\mesh-asset|<kuid:122285:508> | ||
+ | -Update|mesh-table\corridor-1\mesh|corridor.im | ||
+ | -Update|mesh-table\corridor-1\anim|corridor.kin | ||
+ | -Update|mesh-table\corridor-1\auto-create|1 | ||
+ | -Update|mesh-table\corridor-1\att|a.couple1 | ||
+ | -Update|mesh-table\corridor-1\att-parent|default | ||
+ | -EndIf | ||
+ | |||
+ | ;front driver | ||
+ | -IfQuery||Add Driver Mesh at Front of Car? | ||
+ | -Update|mesh-table\driver-0\mesh-asset|<kuid:122285:508> | ||
+ | -Update|mesh-table\driver-0\mesh|driver.im | ||
+ | -Update|mesh-table\driver-0\att|a.driver-0 | ||
+ | -Update|mesh-table\driver-0\att-parent|default | ||
+ | -Update|mesh-table\driver-0\auto-create|1 | ||
+ | -EndIf | ||
+ | |||
+ | ;rear driver | ||
+ | -IfQuery||Add Driver Mesh at Rear of Car? | ||
+ | -Update|mesh-table\driver-1\mesh-asset|<kuid:122285:508> | ||
+ | -Update|mesh-table\driver-1\mesh|driver.im | ||
+ | -Update|mesh-table\driver-1\att|a.driver-1 | ||
+ | -Update|mesh-table\driver-1\att-parent|default | ||
+ | -Update|mesh-table\driver-1\auto-create|1 | ||
+ | -EndIf | ||
+ | |||
+ | -IfQuery||Save Changes to config.txt? | ||
+ | -Sort | ||
+ | -SaveConfig | ||
+ | -MessageBox|Config.txt entries have been made for the options selected. You can amend attachment point names, corona kuid references etc to suit your model. Please ensure that the attachment points specified are present within your traincar mesh. | ||
+ | -EndIf |
Revision as of 02:28, 10 May 2013
Contents |
AssetX Script Libraries
As well as being a Help Page, this page is intended to be a source for scripts written for AssetX.
Please Note: Any installers on this page must be executed separately, and AssetX opened immediately afterwards.
Ian Woodmore's TARDIS 2.0 Scripts
During the development of AssetX, Ian Woodmore wrote an extensive set of repair and update upgrade scripts to test the scripting language.
These TARDIS scripts, in conjunction with Asset X, can perform automated repair. upgrade and up-version of legacy assets to any asset trainz-build TB 2.7 or greater.
The scripts cover a wide range of common config.txt tags and containers. They work fine for the bulk of early version assets. Any remaining errors must be fixed manually using CM2 or CM3 as a guide.
The script installer is available from HERE and will automatically load the scripts into your AssetX installation.
PEV's Version Upgrade Scripts
Also during the development of AssetX, PEV wrote a simple set of version upgrade scripts to test the scripting language.
These are a set of four AssetX scripts that, together, can perform asset version upgrades to TC1/2 (trainzbuild 2.7) or TS2009 (trainzbuild 2.9).
These simple scripts do no error checking, and only cover the common config.txt tags. They work fine for the bulk of early version assets. Those errors that remain must be fixed manually using CM2 or CM3 as a guide.
The script installer is available from HERE and will automatically load the scripts into your AssetX installation.
Add TrainzUtil to your AssetX Menu
AssetX can use TrainzUtil to verify assets and commit or revert them into the Trainz database.
Please be aware that this process can be slow, and it requires the Trainz Version setting in Options/Paths be set for the target Trainz version (if you have more than one Trainz installation).
The menu installer is available from HERE and will automatically load into your AssetX installation. This installer loads a "RunOnce" script that will execute automatically when you open AssetX and then the RunOnce will delete itself when finished. You need to close and re-open AssetX to see the new TrainzUtil menu.
Note that this TrainzUtil menu is designed to run with Version 2.2 of AssetX and may cause earlier versions to stall on a pointer over-run.
If you wish to remove the TrainzUtil Menu use this LINK
This is an example of an AssetX Custom Menu. Three of these are provided, Custom A, Custom B and Custom C. In this case we have used Custom A. You can check out how it works by clicking on Options/Configure Tools on the AssetX Main Menu. Select Custom A in the drop-down box labelled Menu. The program help gives a detailed description of this process.
Script Code for Sharing
If you have written an AssetX script that you think may be useful for the community you can copy and paste it into this section. To get the text to appear in a code box, all of the lines must start with a space character. Here is a simple example:-
FileName "Username.axm" -If|config.txt\name!"" -Save|0|config.txt\name -Update|config.txt\username|"*** NEW TAG ***" -Restore|0|config.txt\username -delete|config.txt\name -EndIf
Corrected Version of Install Superscript.axm
This corrects some typos in the file provided with the AssetX installation. Copy and paste the following and save in the scripts folder as 'Install Superscript.axm'
;install library and asset stub script -If|kind!traincar -Info|Script can only be used with kind traincar assets -Exit -EndIf -IfAsset|<kuid2:122285:508:14> -Else -Info|Script requires that Superscript Library <kuid2:122285:508:14> or later must be open in AssetX. -Exit -EndIf -If|engine= -Info|Asset has no engine tag, please correct and re-run script -Exit -EndIf -Update|script-include-table\superscript|<kuid2:122285:508:14> -Update|kuid-table\codelib|<kuid2:122285:508:14> -If|engine=1 -IfAsset|<kuid2:122285:508:14> -CopyFromAsset|lstub.gs -EndIf -Update|script|LStub -Update|class|LStub -Else -IfAsset|<kuid2:122285:508:14> -CopyFromAsset|vstub.gs -EndIf -Update|script|VStub -Update|class|VStub -EndIf ;extensions container options -IfQuery||Run in Debug Mode? -Update|extensions\debug-122285|1 -EndIf -IfQuery||Change Train Heading via View-Details in Driver? -Update|extensions\heading-122285|1 -EndIf ;front mesh -IfQuery||Add Front of Car Marker (used when debugging attachments)? -Update|mesh-table\front\mesh-asset|<kuid:122285:508> -Update|mesh-table\front\mesh|front.im -Update|mesh-table\front\att|a.limfront -Update|mesh-table\front\att-parent|default -Update|mesh-table\front\auto-create|0 -EndIf ;mesh-table front headlight -IfQuery||Add Headlight at Front of Car? -Update|mesh-table\default\effects\headlight-0\kind|corona -Update|mesh-table\default\effects\headlight-0\att|a.headlight-0 -Update|mesh-table\default\effects\headlight-0\texture-kuid|<kuid:104722:100> -Update|mesh-table\default\effects\headlight-0\object-size|0.12 -EndIf ;mesh-table rear headlight -IfQuery||Add Headlight at Rear of Car? -Update|mesh-table\default\effects\headlight-1\kind|corona -Update|mesh-table\default\effects\headlight-1\att|a.headlight-1 -Update|mesh-table\default\effects\headlight-1\texture-kuid|<kuid:104722:100> -Update|mesh-table\default\effects\headlight-1\object-size|0.12 -EndIf ;mesh-table front taillamp -IfQuery||Add Tail Light at Front of Car? -Update|mesh-table\default\effects\taillight-0\kind|corona -Update|mesh-table\default\effects\taillight-0\att|a.taillight-0 -Update|mesh-table\default\effects\taillight-0\texture-kuid|<kuid:104722:200> -Update|mesh-table\default\effects\taillight-0\object-size|0.12 -EndIf ;mesh-table rear taillamp -IfQuery||Add Tail Light at Rear of Car? -Update|mesh-table\default\effects\taillight-1\kind|corona -Update|mesh-table\default\effects\taillight-1\att|a.taillight-1 -Update|mesh-table\default\effects\taillight-1\texture-kuid|<kuid:104722:200> -Update|mesh-table\default\effects\taillight-1\object-size|0.12 -EndIf ;lamp bodies -IfQuery||Add Lamp Bodies? -If|mesh-table\default\effects\headlight-0\kind$ -Update|mesh-table\headlight-0-body\mesh-asset|<kuid:122285:508> -Update|mesh-table\headlight-0-body\mesh|lamp.im -Update|mesh-table\headlight-0-body\att|a.headlight-0 -Update|mesh-table\headlight-0-body\att-parent|default -EndIf -If|mesh-table\default\effects\headlight-1\kind$ -Update|mesh-table\headlight-1-body\mesh-asset|<kuid:122285:508> -Update|mesh-table\headlight-1-body\mesh|lamp.im -Update|mesh-table\headlight-1-body\att|a.headlight-1 -Update|mesh-table\headlight-1-body\att-parent|default -EndIf -If|mesh-table\default\effects\taillight-0\kind$ -Update|mesh-table\taillight-0-body\mesh-asset|<kuid:122285:508> -Update|mesh-table\taillight-0-body\mesh|lamp.im -Update|mesh-table\taillight-0-body\att|a.taillight-0 -Update|mesh-table\taillight-0-body\att-parent|default -EndIf -If|mesh-table\default\effects\taillight-1\kind$ -Update|mesh-table\taillight-1-body\mesh-asset|<kuid:122285:508> -Update|mesh-table\taillight-1-body\mesh|lamp.im -Update|mesh-table\taillight-1-body\att|a.taillight-1 -Update|mesh-table\taillight-1-body\att-parent|default -EndIf -EndIf ;corridors -IfQuery||Add Corridor at Front of Car? -Update|extensions\corridor-0-122285|1 -Update|mesh-table\corridor-0\mesh-asset|<kuid:122285:508> -Update|mesh-table\corridor-0\mesh|corridor.im -Update|mesh-table\corridor-0\anim|corridor.kin -Update|mesh-table\corridor-0\auto-create|1 -Update|mesh-table\corridor-0\att|a.couple0 -Update|mesh-table\corridor-0\att-parent|default -EndIf -IfQuery||Add Corridor at Rear of Car? -Update|extensions\corridor-1-122285|1 -Update|mesh-table\corridor-1\mesh-asset|<kuid:122285:508> -Update|mesh-table\corridor-1\mesh|corridor.im -Update|mesh-table\corridor-1\anim|corridor.kin -Update|mesh-table\corridor-1\auto-create|1 -Update|mesh-table\corridor-1\att|a.couple1 -Update|mesh-table\corridor-1\att-parent|default -EndIf ;front driver -IfQuery||Add Driver Mesh at Front of Car? -Update|mesh-table\driver-0\mesh-asset|<kuid:122285:508> -Update|mesh-table\driver-0\mesh|driver.im -Update|mesh-table\driver-0\att|a.driver-0 -Update|mesh-table\driver-0\att-parent|default -Update|mesh-table\driver-0\auto-create|1 -EndIf ;rear driver -IfQuery||Add Driver Mesh at Rear of Car? -Update|mesh-table\driver-1\mesh-asset|<kuid:122285:508> -Update|mesh-table\driver-1\mesh|driver.im -Update|mesh-table\driver-1\att|a.driver-1 -Update|mesh-table\driver-1\att-parent|default -Update|mesh-table\driver-1\auto-create|1 -EndIf -IfQuery||Save Changes to config.txt? -Sort -SaveConfig -MessageBox|Config.txt entries have been made for the options selected. You can amend attachment point names, corona kuid references etc to suit your model. Please ensure that the attachment points specified are present within your traincar mesh. -EndIf