From 56b12c21543d80a7556006172486f32cddcdc7a0 Mon Sep 17 00:00:00 2001 From: CDeenen <68693756+CDeenen@users.noreply.github.com> Date: Tue, 2 Feb 2021 03:42:41 +0100 Subject: [PATCH] Updated Token Action (markdown) --- Token-Action.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Token-Action.md b/Token-Action.md index 9b5da57..3f759a5 100644 --- a/Token-Action.md +++ b/Token-Action.md @@ -74,8 +74,8 @@ By selecting 'Custom', you can modify a value in the token or actor object. When In 'Formula' you can fill in the desired formula. You can use the following: * Numbers - Any number you want * Token and actor data - see below -* `[@this]` - gets the value of 'Target'. In the above example this would return the hp -* '=' - sets the target on the left of '=' to the value on the right +* `[@this]` - gets the value of 'target', see below +* `=` - sets the target on the left of '=' to the value on the right * `++` - add 1 * `--` - subtract 1 * `+` - addition @@ -87,13 +87,14 @@ In 'Formula' you can fill in the desired formula. You can use the following: * `<`, `<=`, `>`, `>=` - limit the value * Strings - see below -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.
+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.

-Token and actor data can be any path the the desired data (from the token object).
+Token and actor data is the path the the desired data (from the token object).
For example, to get the hit points in dnd5e, you'd use the path `actor.data.data.attributes.hp.value`. Any stat you want needs to be prefixed by '@', and surrounded by square brackets '[' and ']'.
So in for the hp you'd fill in `[@actor.data.data.attributes.hp.value]`
- +
+`[@this]` is a shorthand for whatever data path you have to the left of the '=' sign.
+
Here are some examples:
Set the walking speed to 25 feet: `[@actor.data.data.attributes.movement.walk] = 25`
Increment the HP by 1: `[@actor.data.data.attributes.hp.value] = [@this] ++`
@@ -102,7 +103,12 @@ Set the AC to 10 plus the DEX modifier: `[@actor.data.data.attributes.ac.value]
You can set multiple formulas 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:
`[@actor.data.data.attributes.movement.walk] = 25 ; [@actor.data.data.attributes.hp.value] = [@this] ++`
- +
+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:
+`[@actor.data.data.attributes.hp.value] = [@actor.data.data.attributes.hp.value] ++`
+`[@actor.data.data.attributes.hp.value] = [@actor.data.data.attributes.hp.value] + 1`
+`[@actor.data.data.attributes.hp.value] = [@this] ++`
+
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 ']'.
So, for example, to set the token name: `[@actor.name] = John` or `[@actor.name] = [John Doe]`. Setting it to `[@actor.name] = John Doe` will not work.