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

Setting/Changing Pathfinder Character sheet variables from Macro

1471925419

Edited 1471925613
I have been tampering with the macro function and character sheet only for a weekend. I have messed with coding in other languages but my work with this site has lead to the most I have every dipped into Javascript. My objective is to be able to edit  a variable (an attribute value, a buff toggle Boolean, etc) from a macro. The idea is to use something to the effect of @{selected|variable}=#/Equation (ex. @{selected|repeating_buff_$0_buff-enable_toggle} = 1). Due to my lack of experience with Java, I'm uncertain what the syntax for editing the value of said variable. Currently, the example macro outputs "0=1" into the chat log if toggled off, "1=1" if on, standard for a Boolean with the string "=1" added to the end. After toying with the Codecademy link in the Wiki's API: Intro  page for a few hours, I am still no closer to a solution. My main questions are: A.) Is this able to be done without having to gain an external API? B.) What is the proper syntax for changing said variables, API or not? Background for this situation: I'm playing a Barbarian and have the Rage class feature set up as a buff. I would like to toggle this using one or more macros, even if it was with 2 separate macros with one turning it on and the other turning it off. I have several friends in this campaign who would benefit with this macro capability, one of which being a Hunter who has access to 12 different buffs from the Animal Focus class ability, making referring to the sheet to toggle them manually cumbersome. After mostly resigning my fate to shift between sheet and map, I was attempting to add a macro for said Hunter to make the standard bow attack that would follow up by reducing the value of the attribute listed to count her arrows by 1. Same problem, but same solution at least. Ideally, I'd like not to work with external API, but if it must be so, then so be it.
1471926952

Edited 1471926969
vÍnce
Pro
Sheet Author
AFAIK, you cannot use a macro to change attribute values.  You either edit the an attribute directly(character journal attributes tab) or via the character sheet. One exception outside of API; changing a token's linked bar will change linked attributes.  Too bad we only have three linkable bars.  I haven't done it, but I believe an API script like Ammo or ChatSetAttr can be used to change attribute values.  Not sure if you would need to customize the character sheet to get this to work properly...  Another issue is that sheet worker js on character sheets cannot detect when an API script makes a change to an attribute, so you might have to open/close a sheet anyway just to trigger other sheet calculations.  I believe you'll have to continue to shuffle between map and sheet toggling buffs.  You could always add another monitor to your setup.  ;-)
1471928104

Edited 1471928162
Vince said: ... I believe an API script like Ammo or ChatSetAttr can be used to change attribute values... I have read bits and pieces of those threads before I knew that they were external pieces of code and they seem to have high reviews, though I just didn't understand why the sheet needed an API in order to do things like that. From what I've read, the author made many improvements and tweaks to add usage for daily spells, daily rage turns, etc and they have gotten good marks so far. Thank you for the response though! Vince said: ... One exception outside of API; changing a token's linked bar will change linked attributes... From what I have messed with, I noticed this. Is there perhaps a way to edit the bar value from a macro? We are using bar 2 for her ammo anyways, so it wouldn't be a problem if we could do that instead. Vince said: ... You could always add another monitor to your setup. ;-) As for the second monitor, unless I set up a docking station at my house, which I would love to, but it's sooooo expensive in relation to my current take home pay, I think the laptop screen is fine for now. XD I'll do what I have been for now and just alt tab to the other open window of Firefox as needed. I had hoped for this more for the Hunter who is still rather new and often forgets that she has access to all of these powerful effects. Thank you again for the response!
1471932798
vÍnce
Pro
Sheet Author
DJ Dust said: Vince said: ... One exception outside of API; changing a token's linked bar will change linked attributes... From what I have messed with, I noticed this. Is there perhaps a way to edit the bar value from a macro? We are using bar 2 for her ammo anyways, so it wouldn't be a problem if we could do that instead. Another API-only solution unfortunately ;-(...  The TokenMod script is the gold-standard for tweaking all aspects of a token.  There are others as well.  
1471954906
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Alternatively to the second screen is to pip out the char sheet and then it's just a simple matter of alt-tab to get to it.
1471970085

Edited 1471970227
Scott C. said: Alternatively to the second screen is to pip out the char sheet and then it's just a simple matter of alt-tab to get to it. Already done. That's been my topical solution for the matter, but I was hoping for something more than a band-aid solution for other characters and abilities. Fortunately, I have the simplest character for this campaign (I am playing a goblin barbarian and I bite things, that's more or less it) so I will live and let them deal with their problems on the matter. This solution however is much more effective if the two windows (the map and the character sheet) are the only ones open on my laptop, which is rarely the case but I will not let that hamper my enjoyment of the campaign.