I am trying to make a macro for "Long Rest" and need to get the players maximum number of hit dice from the token saved as "HitDice" like 5d8+9
I couldn't find any examples that matched what I'm trying to do. And didn't see anything under the functions to get the value of X in XdYZ
Can someone please tell me what would be the best way to pull the X value?
Macro newb question
Moderators: dorpond, trevor, Azhrei
Re: Macro newb question
There may be an easier, or better way, but I believe I'd use listGet(), using the "d" as a delimiter.
So, assuming you have a property called "HitDice" on the token, set the macro to "Apply to Selected Tokens" on the Details tab, and uncheck "Allow Players to Edit Macro" on the Options tab, and it would look like this:
The string is the first part, the 0 means "the first part of the string", the "d" is what delimits the different parts of the string. That gives you whatever is in front of the "d".
https://wiki.rptools.info/index.php/listGet
So, assuming you have a property called "HitDice" on the token, set the macro to "Apply to Selected Tokens" on the Details tab, and uncheck "Allow Players to Edit Macro" on the Options tab, and it would look like this:
Code: Select all
[r:listGet(getProperty("HitDice"),0,"d")]
https://wiki.rptools.info/index.php/listGet
Re: Macro newb question
Thanks! Perfect