getTerrainModifier
getTerrainModifier() Function
Note: This function can only be used in a Trusted Macro
"JSON"
then a JSON Object is returned with the Terrain Modifier, Terrain Modifier Type and an array of Ignored Terrain Modifier Types.Usage
<source lang="mtmacro" line> getTerrainModifier() getTerrainModifier(token) getTerrainModifier(token, map) getTerrainModifier(type) getTerrainModifier(type, token) getTerrainModifier(type, token, map) </syntaxhighlight> Parameters
token
- Optional token name or return type.type
- First parameter can be the string "JSON" to get a JSON Object back.map
- Optional map name to find the token on. Current map is used if not supplied.
Example
<source lang="mtmacro" line> [r: tmod = getTerrainModifier("Sticky Floor Tile")] </syntaxhighlight>
Output: <source lang="mtmacro"> 2.0 </syntaxhighlight>
Get terrain modifiers as a JSON Object on the Wizard's Keep map. <source lang="mtmacro" line> [r: tmod = getTerrainModifier("JSON", "Sticky Floor Tile", "Wizard's Keep")] </syntaxhighlight>
Output: <source lang="javascript"> {
"terrainModifier": 2.0, "terrainModifierOperation": "ADD", "terrainModifiersIgnored": ["NONE"]
} </syntaxhighlight>
Get terrain modifiers for the named token that ignores ADD & MULTIPLY mod types. <source lang="mtmacro" line> [r: tmod = getTerrainModifier("Elf with Fancy Feet")] </syntaxhighlight>
Output: <source lang="javascript"> {
"terrainModifier": 0.0, "terrainModifierOperation": "NONE", "terrainModifiersIgnored": ["ADD","MULTIPLY"]
}
</syntaxhighlight>See Also
Version Changes
- 1.5.11 - Added support for new terrain modifier types.