Hello,
My custom charactersheet has a button to use a character's ability. When the button is pressed, I want it to perform 2 tasks:
- Decrease by 1 the amount of available uses for the ability.
- Roll the ability dice.
As far as I can see, we are allowed to use two types of buttons:
- type="roll"
- type="action"
With the first one, roll20 executes a roll, e.g.
<button type="roll" name="roll_class_ability1" value="/roll 1d20"></button>
With the second one, we can set up a click listener on the worker, e.g.
<button type="action" name="act_class_ability1" ></button>
<script type="text/worker">
on("clicked:class_ability1", function() {
console.log("spent class ability 1");
});
</script>
I want both things to happen simultaneously (with only one click). So far I have tried without success:
- Execute a roll from the worker function (doesn't seem to be possible).
- Listen for the click of the button with type="roll" (doesn't seem to be possible).
- Listen for the "mousedown" and "mouseup" of the button with type="roll" (they don't seem to get binded).
- Overlap two invisible buttons of each type, one on top of each other (only the top one receives the click, event propagation seems to be cancelled).
I think that it is a common thing to be expected from a charactersheet. I am pretty sure that someone has already faced this problem and solved. Thanks for your help in advance!