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

Can I trigger a call to a Roll Template from within a sheet worker?

What I would like to do is save some calculations via a sheet worker into a hidden field then preferably from within the sheet worker call the roll template.  If that is not possible could I trigger a button press on the char sheet within the sheet worker and have that call the roll template?
1589678140
GiGs
Pro
Sheet Author
API Scripter
Sheet workers cant send text to chat, and they cant trigger button presses. They can only save attribute values.  The best you can do is save the calculation or rolltemplate text to a hidden input, and have your button value include the name of the hidden input, e.g. value="@{hidden_input_name}" or value="/roll d20+@{hidden_input_name}" or whatever. Then the player would have to click the button to have it send to chat. You can do this with an API script, but obviously that's not usable by free users.
I am doing this for a character sheet, so no APIs unfortunately. OK.  So that means two button presses, on to do the roll to get the calcs via the sheetworker, then one to send it to chat?  Yuck. 
1589685497
GiGs
Pro
Sheet Author
API Scripter
Yes, unfortunately. Its possible the calcs part might be automated completely, not requiring a button press (it depends what exact calculations are being done), but the send to chat part will always require a unique button press,
K.  Thanks.  I guess I could rewrite the macro on the fly as the player enters their choices.  Ideally, it would still need to do 2nd and even third order calculations based off the magnitude of the attack roll.  So with the random roll being the precursor to all later output, unless I am missing something, it would need to be two button presses, I think. So from a higher level, any reason why we can't generate a button press event from a sheet worker.  I understand that we don't want to go all will nilly, and throw the doors open, but is this something one might request from the dev team as low hanging fruit?  Or is there something larger I am missing?  maybe to do with async calls?
1589771556

Edited 1589771844
GiGs
Pro
Sheet Author
API Scripter
You could request it. I think a lot of us would agree it would be nice to have. I think the reason we cant to do it is simply they didnt think about that functionality. Roll buttons were around for a long time.Action buttons (that can change attributes) are a fairly recent innovation, and were introduced to solve a specific problem: making it easier to trigger sheet workers without needing extra attributes on the sheet just for that purpose. So from the outset, they were designed purely as a sheet worker function, something internal to character sheets. Having roll button and action button functionality in the same button might be difficult for reasons we cant see - they are very different functions, after all. But I'm sure it would be possible if they agreed its worthwhile.