setTerrainModifier: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 72: Line 72:
{{func|getTerrainModifier}}
{{func|getTerrainModifier}}


|changes=
* '''1.5.11''' - New Terrain Modifier options.
}}
}}
[[Category:Token Function]]
[[Category:Token Function]]

Revision as of 18:15, 17 January 2020

setTerrainModifier() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.5.2
Set the Terrain Modifier for the named Token or for the Current Token if no name is given. To set the type of Terrain Modifier, pass a JSON Object containing the correct key:value pairs.

Usage

setTerrainModifier(mod)
setTerrainModifier(mod, token)
setTerrainModifier(mod, token, map)
setTerrainModifier(jobj)
setTerrainModifier(jobj, token)
setTerrainModifier(jobj, token, map)

Parameters

  • mod - A floating point number.
  • token - Optional token name.
  • map - Optional map name.
  • jobj - A JSON object with .

Example

Set the Terrain Modifier to 2.0 for the current token.
[r: tmod = setTerrainModifier(2.0)]

Returns:

2.0

Set the Terrain Modifier and Type for the current token.

[h: jobj = '{"terrainModifier": 3.0, "terrainModifierOperation": "ADD"}']
[r: tmod = setTerrainModifier(jobj)]<br>
<pre>[r: json.indent(getTerrainModifier("JSON"),2)]</pre>

Returns:

3.0
{
  "terrainModifier": 3,
  "terrainModifierOperation": "ADD",
  "terrainModifiersIgnored": ["NONE"]
}

Set a token to ignore terrain modifier types: ADD, MULTIPLY

[h: jobj = '{"terrainModifiersIgnored": ["ADD","MULTIPLY"]}']
[h: setTerrainModifier(jobj)]
<pre>[r: json.indent(getTerrainModifier("JSON"),2)]</pre>

Returns:

{
  "terrainModifier": 0,
  "terrainModifierOperation": "NONE",
  "terrainModifiersIgnored": [
    "MULTIPLY", 
    "ADD"
  ]
}

See Also

Version Changes

  • 1.5.11 - New Terrain Modifier options.