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

[Bug] On Change Graphic Rotation Event

1368516454
Konrad J.
Pro
API Scripter
This might be the way its intended?  But on a change graphic:rotation event, prev seems to be an object.  From the description of the API docs I thought it was supposed to be simply the rotation.  Here is the log of prev. {"_id":"-IuRmVDlJAmzGpV0CHnD","_pageid":"7F73B956-71C3-4C5B-8C72-576EE4F15EA4","left":1190,"top":490,"width":140,"height":140,"rotation":-45,"layer":"objects","isdrawing":false,"flipv":false,"fliph":false,"name":"","gmnotes":"","controlledby":"","bar1_value":"","bar1_max":"","_bar1_link":"","bar2_value":"","bar2_max":"","_bar2_link":"","bar3_value":"","bar3_max":"","_bar3_link":"","_represents":"","aura1_radius":"","aura1_color":"#FFFF99","aura1_square":false,"aura2_radius":"","aura2_color":"#59E594","aura2_square":false,"tint_color":"transparent","status_redmarker":false,"status_bluemarker":false,"status_greenmarker":false,"status_brownmarker":false,"status_purplemarker":false,"status_dead":false,"showname":false,"showplayers_name":false,"showplayers_bar1":false,"showplayers_bar2":false,"showplayers_bar3":false,"showplayers_aura1":false,"showplayers_aura2":false,"playersedit_name":false,"playersedit_bar1":false,"playersedit_bar2":false,"playersedit_bar3":false,"playersedit_aura1":false,"playersedit_aura2":false,"light_radius":"","light_dimradius":"","light_otherplayers":false,"_type":"graphic","_subtype":"token","_cardid":""} From the docs... NOTE:  In individual property events, the  prev  object is the previous value of that specific property, not a list of all previous properties. So in the above example,  prev  would be the previous rotation value. So OK, its an Object, no big deal, but when I try and do a prev.get it throws up an error Object [object object] has no method get..... To make it work I had to simply use prev.rotation, but I'm fairly sure you want us to only use gets and sets for Roll20 objects. I hope that made some sense! :)
1368516522
Konrad J.
Pro
API Scripter
Sorry, I clicked post before I noticed I didn't finish the Subject! :)   It should read [Bug] On Change Graphic Rotation Event.
1368524051
Gauss
Forum Champion
Fixed the title - Gauss
This is working as intended. I'll update the docs. However, as noted in the docs, the prev object is not the same as an "obj" object, you get the properties like this: prev["rotation"] or prev.rotation There's no get/set, it's just a simple object. - RD
1368565615
Konrad J.
Pro
API Scripter
Riley D. said: This is working as intended. I'll update the docs. However, as noted in the docs, the prev object is not the same as an "obj" object, you get the properties like this: prev["rotation"] or prev.rotation There's no get/set, it's just a simple object. - RD Ah sorry, I did see something about that.  I was just trying to do it properly by using get and set.  :) No problem, I'm using it that way and it works, just wanted to check. Thanks for he quick answer!