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 you force a result in a query?

1649443663
G.M. Joe
Pro
Sheet Author
So, I'm playing with some universal macros that call on player sheet abilities (running PF2E). For example, I have a macro for Treat Wounds that looks like %{player1|medicine} %{player2|medicine} etc... %{GM|medicinebutton} %{Macros|treatwounds} &{noerror} where players 1 and 2 are the abilities built into the character's sheet, GM is a character sheet where I keep my GM macros, "medicinebutton" is a macro that replaces the die roll with a chat button they can click to roll the medicine check, Macro is my macro mule character sheet, and "treatwounds" is a macro that includes a description of the treat wounds action plus the HP restored. So whenever a player calls the macro, they get their medicine check and all the rules for the treat wounds action in one roll-template (and bcs of permissions, the other player's abilities get ignored). When I call the macro, it gives all the details of the action, but replaces the die roll with a chat button to click... and here's where I get a problem. TLDR: when I call this macro, if any player has "bonus to roll" selected on their sheet, I get the query even though I'm not rolling dice. I would love to be able to get rid of the extra click of dealing with this query, so it got me thinking if there might be a way to force an outcome before-hand...I know this is very specific to my use, but the broader question might have other applications. Thanks! 
1649484257

Edited 1649484349
Oosh
Sheet Author
API Scripter
There are three ways I can think of: 1) The easy option - get rid of the Query by removing the option from the sheets and ask the players not to turn it on. 2) The middling option - find a way of fooling the sheet into corrupting or skipping that roll bonus query, maybe with escape characters or a fake API call (dunno, not familiar with the sheet) 3) The hard option - write a reactive browser script or extension. Probably needs a mutation observer, nothing gets posted to chat until the Query is resolved, so the API won't help here. Move this from "hard" to "very extremely hard" if you don't know what a mutation observer is :) A Query is a user-facing construct that is purpose built to grab human input. There's no way to force a value into it since that functionality is already covered by the "just using a normal value instead of a query" method.
1649516579
G.M. Joe
Pro
Sheet Author
Thanks Oosh, that's what I was afraid of. 1) I hate to ask them to turn the option off, since bonuses are fast and furious in PF2 2) The toggle on the sheet changes the character attribute from "0" to the query "?{bonus to roll....etc" and inserts that into the d20 roll. I was hoping for a way to trick it, the way I used the macro order to replace the die roll with a button by putting it at the end. But I guess since it hits the query first, it wants the input before it replaces the roll.  3) Yeah, no idea about mutation observers. 😝 Ultimately, I guess the inconvenience of an extra click is easier than any of the work around.  Thanks again.