Updated Token Action (markdown)

Material Foundry
2023-05-24 16:24:38 +02:00
parent f4da708c36
commit 27f5d081e1

@@ -114,6 +114,7 @@ Most should be self-explanatory, but some are described below.
<br> <br>
By selecting 'Custom', you can modify a value in the token or actor object. When you select 'Custom' you will get a new 'Formula' input box.<br> By selecting 'Custom', you can modify a value in the token or actor object. When you select 'Custom' you will get a new 'Formula' input box.<br>
In 'Formula' you can fill in the desired formula. You can use the following: In 'Formula' you can fill in the desired formula. You can use the following:
* Numbers - Any number you want * Numbers - Any number you want
* Token and actor data - see below * Token and actor data - see below
* Macros - see below * Macros - see below
@@ -134,22 +135,22 @@ In 'Formula' you can fill in the desired formula. You can use the following:
Forget about the proper order of operations, any operation is performed from left to right. Each operation must be separated by an empty space. A properly formatted formula has a 'target' in the form of token or actor data, followed by a '=', followed by either a value or a function.<br> Forget about the proper order of operations, any operation is performed from left to right. Each operation must be separated by an empty space. A properly formatted formula has a 'target' in the form of token or actor data, followed by a '=', followed by either a value or a function.<br>
<br> <br>
Token and actor data is the path the the desired data (from the token object).<br> Token and actor data is the path the the desired data (from the token object).<br>
For example, to get the hit points in dnd5e, you'd use the path `actor.data.data.attributes.hp.value`.<br> For example, to get the hit points in dnd5e, you'd use the path `actor.system.attributes.hp.value`.<br>
Any path you want needs to be prefixed by '@', and surrounded by square brackets '[' and ']'.<br> Any path you want needs to be prefixed by '@', and surrounded by square brackets '[' and ']'.<br>
So in for the hp you'd fill in `[@actor.data.data.attributes.hp.value]`<br> So in for the hp you'd fill in `[@actor.system.attributes.hp.value]`<br>
<br> <br>
`[@this]` is a shorthand for whatever data path you have to the left of the '=' sign.<br> `[@this]` is a shorthand for whatever data path you have to the left of the '=' sign.<br>
<br> <br>
Here are some examples:<br> Here are some examples:<br>
Set the walking speed to 25 feet: `[@actor.data.data.attributes.movement.walk] = 25`<br> Set the walking speed to 25 feet: `[@actor.system.attributes.movement.walk] = 25`<br>
Increment the HP by 1: `[@actor.data.data.attributes.hp.value] = [@this] ++`<br> Increment the HP by 1: `[@actor.system.attributes.hp.value] = [@this] ++`<br>
Increment the HP by 1 but limit to the max hp: `[@actor.data.data.attributes.hp.value] = [@this] ++ <= [@actor.data.data.attributes.hp.max]`<br> Increment the HP by 1 but limit to the max hp: `[@actor.system.attributes.hp.value] = [@this] ++ <= [@actor.system.attributes.hp.max]`<br>
Set the AC to 10 plus the DEX modifier: `[@actor.data.data.attributes.ac.value] = 10 + [@actor.data.data.abilities.dex.mod]`<br> Set the AC to 10 plus the DEX modifier: `[@actor.system.attributes.ac.value] = 10 + [@actor.system.abilities.dex.mod]`<br>
<br> <br>
Currently you cannot use shorthand notation such as `[@actor.data.data.attributes.hp.value] ++` or `[@actor.data.data.attributes.hp.value] += 1`. Instead you will need to use one of the following methods:<br> Currently you cannot use shorthand notation such as `[@actor.system.attributes.hp.value] ++` or `[@actor.system.attributes.hp.value] += 1`. Instead you will need to use one of the following methods:<br>
`[@actor.data.data.attributes.hp.value] = [@actor.data.data.attributes.hp.value] ++`<br> `[@actor.system.attributes.hp.value] = [@actor.system.attributes.hp.value] ++`<br>
`[@actor.data.data.attributes.hp.value] = [@actor.data.data.attributes.hp.value] + 1`<br> `[@actor.system.attributes.hp.value] = [@actor.system.attributes.hp.value] + 1`<br>
`[@actor.data.data.attributes.hp.value] = [@this] ++`<br> `[@actor.system.attributes.hp.value] = [@this] ++`<br>
<br> <br>
If you want to modify string data, such as a token name, any part to the right of '=' should not contain any maths, or you might get unexpected results. If you want to modify string data, such as a token name, any part to the right of '=' should not contain any maths, or you might get unexpected results.
If the string contains any empty spaces, you must surround the string with square brackets '[' and ']'.<br> If the string contains any empty spaces, you must surround the string with square brackets '[' and ']'.<br>
@@ -169,15 +170,20 @@ You would use, for example: `@macro moveToken 1 0` to move the token 1 gridspace
If the name of you macro or any of the arguments has spaces in it, you have to surround the name with square brackets '[' and ']'. For example, if you macro is named `Test Macro`, you use `@macro [Test Macro]`.<br> If the name of you macro or any of the arguments has spaces in it, you have to surround the name with square brackets '[' and ']'. For example, if you macro is named `Test Macro`, you use `@macro [Test Macro]`.<br>
<br> <br>
You can set multiple formulas or multiple macros to the same button by separating them with ';'. So you can increment the HP by 1 and set the walking speed to 25 feet with:<br> You can set multiple formulas or multiple macros to the same button by separating them with ';'. So you can increment the HP by 1 and set the walking speed to 25 feet with:<br>
`[@actor.data.data.attributes.movement.walk] = 25 ; [@actor.data.data.attributes.hp.value] = [@this] ++`<br> `[@actor.system.attributes.movement.walk] = 25 ; [@actor.system.attributes.hp.value] = [@this] ++`<br>
Or increment the HP by 1 and call the macro 'moveToken':<br> Or increment the HP by 1 and call the macro 'moveToken':<br>
`[@actor.data.data.attributes.hp.value] = [@this] ++ ; @macro moveToken 1 0` `[@actor.system.attributes.hp.value] = [@this] ++ ; @macro moveToken 1 0`
<h4>Move Token</h4> <h4>Move Token</h4>
Select a direction for the token to move to. The token will move 1 grid space in that direction when the button is pressed. Select a direction for the token to move to. The token will move 1 grid space in that direction when the button is pressed.
<h4>Rotate Token</h4>
You can rotate the token in one of two ways:
<b>Rotate to Value</b>: Set a value in degrees in the 'Value' field and the token will rotate to that value. For example, 0 is the normal orientation, 90 is rotated 90 degrees.
<b>Rotate by Value</b>: Set a value in degrees in the 'Value' field and the token will rotate that value relative to it's current rotation. For example, if it is currently rotated 90 degrees, setting the value to -10 will rotate it to 80 degrees.
<h4>Set Vision & Light</h4> <h4>Set Vision & Light</h4>
If 'Set Vision' was selected at 'On Click', a lot of vision settings appear. They behave identical to the settings in the Vision tab the Token Configuration screen in Foundry.<br> If 'Set Vision' was selected at 'On Click', a lot of vision settings appear. They behave identical to the settings in the Vision tab the Token Configuration screen in Foundry. Refer to the Token Configuration to find out what each setting does.<br>
<h5>Selection Boxes</h5> <h5>Selection Boxes</h5>
The selection boxes all have a 'No Change' option. Selecting this will prevent that setting from being updated when pressing the button. Setting it to anything else will perform a change. The selection boxes all have a 'No Change' option. Selecting this will prevent that setting from being updated when pressing the button. Setting it to anything else will perform a change.