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

Quick question about Action buttons and macro's....

    Is there a way to reference an action button to a Token macro? Or if not, how would you use roll buttons to achieve the same thing. I am wanting to put an action button on my character sheets that will reset multiple fields (both regular attributes and repeating field attributes) with a sheet worker, but if I then can't utilize a macro it may not be worth it? Just curious. Thank you for your time.
1593111694

Edited 1593111710
GiGs
Pro
Sheet Author
API Scripter
Thats a good question. I dont think you can trigger an action button from a macro, at least I dont know how to. I dont think there's a way to do what you need without using a script. Instead of using an action button, set up an attribute (maybe hidden), as a checkbox with a value of 1. Have you sheet worker run whenever the checkbox value is set to 1, and as part of the run, reset the checkbox to 0 so its ready to be clicked again. Then you can use a script like chatSetAttr to change the value to 1, you can also have an cation button on the sheet that also sets the attribute to 1 for sheet-based triggering. If you want this feature to be available to free users, I don't know of any way it can be done. (maybe someone else does?)
As always GiGs, Thank you for your response. I am trying to piecemeal together sheet workers from examples you have given to other people. Performing 5e dnd short and long rest mechanics and looking at classaction's and classresources on the Community Contributed sheet to determine to reset to 0 (for "used field attributes") or to max (for "current field attributes") I am finding it hard to conceptually figure out how to build my "getAttr" function Id separate from my "getAttr" repeating fields attributes  (I was working last night on it and unfortunately my window crashed before I could save so can't post code yet gotta redo :P.  But I appreciate your suggestion and i'll try the hidden checkbox technique. just having the on(`onclick:<actionbutton>  change: <maybe hidden attribute action>`, function () {...} for the same sheetworker may be the best work around. Thanks again :)
1593114894
GiGs
Pro
Sheet Author
API Scripter
You're welcome :) I think there are three D&D rest scripts floating around at the moment, which might be worth checking out for figuring out what you need to adapt to a sheet worker - or if you're only doing it for your own campaign's use, using one of those might be better than modifying the sheet.