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

[API] Detect button Press

January 25 (9 years ago)

Edited January 25 (9 years ago)
Is there no event for button presses (macros/rollbuttons)? How would I detect such an interaction? I have not written javascript yet (beside some basic SheetWorker on:change events). Is the only way to send a chatcommand with sendChat and then parse that?

Is there a complete list of events? I mean the wiki obviously is not complete as events like chat:message are not listed there.
January 25 (9 years ago)
The Aaron
Pro
API Scripter
Every object has add, change, destroy events:  https://wiki.roll20.net/API:Events Some destroy events don't seem to fire (destroy:token and destroy:card, which are redundant for destroy:graphic), but you're unlikely to run into cases where that causes you problems.

Chat Events (the only one is chat:message ) are detailed on a separate page: https://wiki.roll20.net/API:Chat

Regarding the buttons, are you talking about Character Sheet Buttons, or API Buttons?  In both cases, you'd have the button in question send an API command like '!foo' and parse it with a chat:message handler.
January 25 (9 years ago)
Is it possible to use sendChat then without the text showing up in the chat? To trigger chat:message without it being visible for others or do I have to spam my own gm chat by whispering myself?
January 25 (9 years ago)
The Aaron
Pro
API Scripter
If your message starts with !, it is an API message which does not show up in chat.
January 25 (9 years ago)
Hmm... today I feel like I have asked the most obvious questions. This means tomorrow can just be a better day ;)
January 26 (9 years ago)
The Aaron
Pro
API Scripter
Answers are only obvious after you know them!  Don't feel bad, most of us are to prideful to have even asked and spent hours trying to figure it out on our own. =D
January 26 (9 years ago)
Lithl
Pro
Sheet Author
API Scripter

The Aaron said:

Answers are only obvious after you know them!
My high school CS textbook's central theme was "Bewilderment + Exposure = Obvious" =)