getLibProperty
getLibProperty() Function
Usage
getLibProperty(name)
getLibProperty(name, lib)
Needs Clarification:
This block and its example seem to be outdated. Testing is required and this page corrected, if necessary.
For example, suppose a property named Weapons
has a default value of "Shotgun, Pistol
".
If you leave the value on the library token unchanged, it will appear to contain the value "Shotgun, Pistol
" in places like the stat sheet, but this function will return an empty string.
< syntaxhighlight lang="mtmacro" line>
[getLibProperty("Weapons", "lib:Compendium")]
</syntaxhighlight >
Returns an empty string.
It may help to review some relevant functions that apply to regular token properties, getProperty(), getPropertyDefault(), and resetProperty().
Examples
< syntaxhighlight lang="mtmacro" line> [getLibProperty("init")] </syntaxhighlight >
To get the "init" token property from the library token if the library token has such a property. If not, use a default value of "default
".
< syntaxhighlight lang="mtmacro" line>
[result = getLibProperty("init")]
[if(result == ""): result = "default" ]
</syntaxhighlight >
To get the "init" token property from a library token called lib:Attacks
use
< syntaxhighlight lang="mtmacro" line>
[getLibProperty("init", "lib:Attacks")]
Version Changes
Updated in 1.11:
MTscript functions for acting on library tokens have been modified to also work on Add-on libraries.
This modification allows the namespace of the add-on library to be used where the Lib:
token name would normally appear. For example,
< syntaxhighlight lang="mtmacro" line> [h: getLibProperty("defaultStrength", "com.myname.mt.my-first-addon")] </syntaxhighlight >