Macro newb question

Talk about whatever topic you'd like, RPG related or not. (But please discuss things related to our software in the Tools section, below.)

Moderators: dorpond, trevor, Azhrei

Post Reply
dantarith
Cave Troll
Posts: 66
Joined: Wed Jun 01, 2011 6:09 am

Macro newb question

Post by dantarith »

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?

taustinoc
Dragon
Posts: 525
Joined: Mon Aug 03, 2015 6:30 pm

Re: Macro newb question

Post by taustinoc »

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:

Code: Select all

[r:listGet(getProperty("HitDice"),0,"d")]
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

dantarith
Cave Troll
Posts: 66
Joined: Wed Jun 01, 2011 6:09 am

Re: Macro newb question

Post by dantarith »

Thanks! Perfect

Post Reply

Return to “General Discussion”