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 .
×

List of 'on' events and states

I cant find a good list of event on the page or graphic. I see for change: graphic:rotate and top. I am guessing there is a top. but what other events are there.   also is there on onClick events? or on selected. or even a property of "is selected" that could be read.  if not why? these would be supper useful vary new to the AIP. have done some cool things with it.  But it really needs away to detect click events and selected state. Danny
1599745408
The Aaron
Roll20 Production Team
API Scripter
There are 5 types of events: "ready" -- happens when the API Sandbox has fully loaded the state of the game.&nbsp; No parameters passed to callback. "chat:message" -- happens when anything is sent to chat.&nbsp; 1st parameter passed to callback is a message object that contains details of what was sent and how it was processed. "add:&lt;TYPE&gt;" -- happens when a new object of &lt;TYPE&gt; is created.&nbsp; 1st parameter is the new object (which might be pretty useless, depending on the type...) "change:&lt;TYPE&gt;" -- happens when an object of &lt;TYPE&gt; is updated.&nbsp; This is usually by a player (API doesn't trigger most events), but is sometimes follow on modifications from creation of an object (particularly graphic objects). 1st parameter is the object that was changed (with the changes having already taken place), 2nd parameter is a simple javascript object with the prior state of the object.&nbsp;&nbsp; "change:&lt;TYPE&gt;:&lt;PROPERTY&gt;" -- you can also specify a property you want to be notified about.&nbsp; Note that you need to use the _ on the front of read only names for this. "destroy:&lt;TYPE&gt;" -- happens when an object of &lt;TYPE&gt; is removed. 1st parameter is the object that is being removed in it's current state. There is no event for UI stuff like onClick or isSelected.&nbsp; The API runs on a server far removed from where the game is running.&nbsp; It only observes the state of the game via the backend database, and makes changes to that.&nbsp; Very much "action at a distance." The only place you can know about selected objects is as part of a chat event. Here are some good starter links for API: <a href="https://app.roll20.net/forum/post/6605115/namespaces-novice-seeks-help-exploring-the-revealing-module-pattern" rel="nofollow">https://app.roll20.net/forum/post/6605115/namespaces-novice-seeks-help-exploring-the-revealing-module-pattern</a> <a href="https://app.roll20.net/forum/post/6584105/creating-an-object-that-holds-specific-character-dot-id-and-character-name/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/6584105/creating-an-object-that-holds-specific-character-dot-id-and-character-name/?pagenum=1</a> <a href="https://app.roll20.net/forum/post/6237754/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/6237754/slug%7D</a> <a href="https://www.youtube.com/watch?v=jam2yx8btaQ" rel="nofollow">https://www.youtube.com/watch?v=jam2yx8btaQ</a>
1599745966
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Aaron said: There is no event for UI stuff like onClick or isSelected.&nbsp; The API runs on a server far removed from where the game is running.&nbsp; It only observes the state of the game via the backend database, and makes changes to that.&nbsp; Very much "action at a distance." I've never heard that (or really thought about it). That explains much.&nbsp;
Thanks. That helps.&nbsp; I am going to look into this more. The only place you can know about selected objects is as part of a chat event.