Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

How do I change a value on the character sheet when using a macro?

March 08 (7 years ago)
I am trying to set up a macro that will change a field on the character sheet like spell used.  The one I am trying to do is Starfinder resolve points that when I use the ability I spend one resolve.  The sheet for resolve is @{resolve} so I would like to set up @{resolve}=@{resolve}-1 at the end of the macro.  Is this something that can be done?
This is only possible by utilizing the API, which requires that the game's creator have the PRO subscription.

Without access to the API, macros are read-only and cannot write values.
March 08 (7 years ago)
you can have it run the math for you and have it output the remaining number (to change it to) into the chat though, this can be done using the Template Function as well, which would be something along the lines of:
As Token Action:
/ooc &{template:default} {{name=@{selected|token_name}'s Resolve}} {{Initial Resolve=[[(@{selected|Resolve})]]/[[(@{selected|Resolve|Max})]]}} {{Resolve Spent=-[[?{Resolve Spent|(@{selected|Resolve})|0|1|2|3|4|5|6|7|8|9|10}]]}} {{Resolve Remaining=[[((?{Resolve Spent})-(@{selected|Resolve}))]]/[[(@{selected|Resolve|Max})]]}}

and yes, that needs to all be on 1 Line as far as I'm aware. I have no idea how to insert Line Breaks into it short of using an HTML Code (is that the only way?)

Using it as a Token Action allows you to use it on Any character, as it will look up the "Resolve" & "Resolve|Max" (this works for HP & HP|Max as well btw) for the Character Sheet linked to the Token which is Selected, and it will be available at the press of a button. They'll still need to go in and manually adjust their Resolve to the "Resolve Remaining" result, but it sure makes things easier. I also wasn't sure of the scaling of the Resolve expenditure, so I set the options for it's Drop Down Box to Spend
  1. Everything
  2. 0
  3. 1
  4. 2
  5. 3
  6. 4
  7. 5
  8. 6
  9. 7
  10. 8
  11. 9
  12. 10
if you wish to set it to an edit box instead, just delete the "|0|1|2|3|4|5|^|7|8|9|10" portion, like so:
/ooc &{template:default} {{name=@{selected|token_name}'s Resolve}} {{Initial Resolve=[[(@{selected|Resolve})]]/[[(@{selected|Resolve|Max})]]}} {{Resolve Spent=-[[?{Resolve Spent|(@{selected|Resolve})}]]}} {{Resolve Remaining=[[((?{Resolve Spent})-(@{selected|Resolve}))]]/[[(@{selected|Resolve|Max})]]}}

The default will still be everything, but they'll at least be able to type in their expenditure instead of being forced to use a pre-designed Drop Down menu.

I also have no idea how to use ?{variable} in a way that doesn't use a pop-up, such as in a conditional statement.