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

Trying to have clickable Undo button in the chat template

April 08 (4 months ago)
Joel
Pro

My custom character sheet automatically deducts ammo when a weapon is fired. I've added a small “↩️ Undo” button in the chat output (inside the roll template) next to the “Ammo used / Ammo remaining” line. Ideally, clicking that button would restore the last amount of ammo spent — a helpful quality-of-life tool during testing or if someone misclicks.

I tried placing a <button type="action"> inside the roll template, and while the button appears visually, it’s not clickable and doesn’t respond. My suspicion is that buttons and inputs inside the chat window are non-functional by design, which would explain the issue.

I think this kind of thing would be possible with the API (for Pro accounts), but I’m looking for any known workarounds that might work using only standard character sheet tools. I'd like this to work out of the box for anyone who might use this custom sheet in the future.

I have all the working code finished if this behaved like a normal button inside the chat. Is there a way to create a functional interactive button within the chat — or a clever hack using Chat Menus, roll queries, or macros that can safely modify an attribute (like ammo) from a chat message?

Thanks in advance for any insight!

April 08 (4 months ago)
vÍnce
Pro
Sheet Author

AFAIK roll and action buttons do not work in chat. Things may have changed and I could be wrong about that.  IDK

One thought/option;
Chat menu buttons work though, so I think you should be able to convert your "Undo" into a chat menu button that executes a new roll using Custom Roll Processing (a roll can be hidden from chat by using '!' inside rollString) This new roll could be used to undo that last roll.  You would need to save the first roll's actions (a hidden attribute(s) perhaps?) in order to undo it with the 2nd roll.

April 09 (4 months ago)
GiGs
Pro
Sheet Author
API Scripter

I think you'll need your undo action button to be a hidden action button one the sheet, then you can call the button from chat. When the original action is run, you output the undo chat command with any needed parameters (like which attribute to affect and how much to change it)