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

Trigger Sheet Action button with API?

So I am running a Pathfinder 2e game with the Roll20 sheet. Equipment that can be worn has a button next to it that can be clicked to equip/unequip it.Doing so changes the necessary values like armor class or other attributes. However, there doesn't seem to be an actual attribute in the repeating attribute that corresponds with this button. I've tried timmaugh's Xray and and Rdump from Scriptcards to find it. Is it because it is a sheet button? Is there a way to trigger this with a mod? Thanks!
1729390669
vÍnce
Pro
Sheet Author
AFAIK sheet buttons (action or roll) cannot be executed from the API.  You might be able to determine what the sheet is actually doing when those buttons are pressed and manipulate attributes similarly via API commands.  Official sheets do not make their code available to the community which makes it very difficult/impossible to know what a sheet is doing when an action button is pressed. ;-(
1729441703
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That button is weird. It holds a whole host of data mods as its value and shifts them back and forth when it is selected, and deselected. It's not a normal 1/0 toggle. I've taken a couple of pokes at it but can't seem to figure out the necessary command, or even the best way to approach this with ChatSetAttr. The API can set a token action button or macro that will trigger when pressed, and can run an action button by sending the appropriate command to chat when a particular event is triggered. I assume you are trying to set up something like this so you can press a token action button or macro buttons to toggle on and off your weapons/armor? It might help if you clarified what you are trying to do rather than how you want to do it.
1729450877
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Haven't played with this directly, but this is likely a straight roll or action button. These do not exist to the API, so it can't find them. It can still execute them though by using sendChat to send the ability call corresponding to the button. If I remember correctly, the of 2 sheet doesn't give you the ability calls easily. You'll probably need to right click on that button and select inspect. This will bring up the dev console and code inspector in your browser. The button will be highlighted in the html code. You want to find the name of the button which will look like name="roll_somename" or name="act_somename". To assemble the button call, you're going to remove the roll_ or act_ prepend, add the name of the repeating section, and then in your API code you'll need to insert the id of the row that needs to be worked on. Altogether that call will look like: %{charname|releating_equipment_-idhere_somename}
OMG Scott, that worked beautifully! %{Essam, The Bulwark|repeating_items-readied_-o6dr5oqdqoo36lkfm4k_process} was the command I needed and it equipped and unequipped perfectly. PF2e requires you to use an action to ready a shield to get the AC bonus so I was looking to automate it. Now, to try to see if I can use it in a Scriptcard or if I have to write a mod for it. Thanks for all the help!