getTerrainModifier: Difference between revisions
m (Conversion script moved page GetTerrainModifier to getTerrainModifier: Converting page titles to lowercase) |
m (Text replacement - "source>" to "syntaxhighlight>") |
||
Line 14: | Line 14: | ||
getTerrainModifier(type, token) | getTerrainModifier(type, token) | ||
getTerrainModifier(type, token, map) | getTerrainModifier(type, token, map) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|token|Optional token name or return type.}} | {{param|token|Optional token name or return type.}} | ||
Line 25: | Line 25: | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[r: tmod = getTerrainModifier("Sticky Floor Tile")] | [r: tmod = getTerrainModifier("Sticky Floor Tile")] | ||
</ | </syntaxhighlight> | ||
'''Output:''' | '''Output:''' | ||
<source lang="mtmacro"> | <source lang="mtmacro"> | ||
2.0 | 2.0 | ||
</ | </syntaxhighlight> | ||
Get terrain modifiers as a JSON Object on the Wizard's Keep map. | Get terrain modifiers as a JSON Object on the Wizard's Keep map. | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[r: tmod = getTerrainModifier("JSON", "Sticky Floor Tile", "Wizard's Keep")] | [r: tmod = getTerrainModifier("JSON", "Sticky Floor Tile", "Wizard's Keep")] | ||
</ | </syntaxhighlight> | ||
'''Output:''' | '''Output:''' | ||
Line 44: | Line 44: | ||
"terrainModifiersIgnored": ["NONE"] | "terrainModifiersIgnored": ["NONE"] | ||
} | } | ||
</ | </syntaxhighlight> | ||
Get terrain modifiers for the named token that ignores ADD & MULTIPLY mod types. | Get terrain modifiers for the named token that ignores ADD & MULTIPLY mod types. | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[r: tmod = getTerrainModifier("Elf with Fancy Feet")] | [r: tmod = getTerrainModifier("Elf with Fancy Feet")] | ||
</ | </syntaxhighlight> | ||
'''Output:''' | '''Output:''' | ||
Line 58: | Line 58: | ||
"terrainModifiersIgnored": ["ADD","MULTIPLY"] | "terrainModifiersIgnored": ["ADD","MULTIPLY"] | ||
} | } | ||
</ | </syntaxhighlight> | ||
Revision as of 19:33, 14 March 2023
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.