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

Automatically Clearing Text Input on Roll

1459025202

Edited 1459038864
Carl T
Sheet Author
I'd like to automatically clear a certain text input containing roll modifiers every time ANY roll is made on the character sheet. This modifier would be used to modify rolls, but ideally it clears after a roll to prevent any inadvertent subsequent rolls being accidentally modified. I can't seem to find a way to do this. I can think of two possible ways, but both don't seem to be supported: 1. Capturing an event for roll button presses and setting the modifier input to zero. I don't think there's a way to do this with sheet workers, templates, or any other method. But it never hurts to check. 2. The straight forward way to do this should be to use input modifiers. The reason I can't in this case is that I need to be able to reference the modifier that a player enters and I don't think there's a way to reference the modifier because what the player enters isn't stored as a named variable. Any ideas?
1459028200
Lithl
Pro
Sheet Author
API Scripter
The only way I can think of to do this would be to add an API command to each roll button and clear the attribute via an API script. If it's just a modifier to a roll, and gets cleared after every roll, why exactly can't you use Roll Queries? I'm not understanding the reason you've given.
1459083710
Carl T
Sheet Author
Brian: Is there a way to reference the value input by the player in a roll query? I need to be able to take that value and display it in a roll template and use it in math operations (division & modulus) in other parts of the template. Basically the modifier adds to a dice pool and I want to show the average of the roll result (dice pool / 2) in the template. There's also the issue that having a dialog popup on every single roll is distasteful, but that's a separate issue. :)
1459090833
Lithl
Pro
Sheet Author
API Scripter
Sure: &{template:default} {{name=Example}} {{Pool=[[@{pool} + ?{Bonus dice|0}]]}} {{Average=[[(@{pool} + ?{Bonus dice}) / 2]]}} {{Roll=[[(@{pool} + ?{Bonus dice})d10]]}} Every time you put a query with the same label in a macro (or roll button text), the system copies the same value to every one. The default value is ignored on all but the first one.
1459098563
Carl T
Sheet Author
Hmmm interesting...I guess I tried it with @{Bonus dice} and that didn't work. Something to ponder. Thanks!