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 planet rotation

I found a few year old script to simulate multiple planet rotations from  S plenectomY , but I cannot get it to work. Is there an existing one i am just not seeing?
1613849648
The Aaron
Roll20 Production Team
API Scripter
You're talking about this one?&nbsp;&nbsp; <a href="https://gist.github.com/SplenectomY/18d1aa4c76cd31749e5c95e9303ef910" rel="nofollow">https://gist.github.com/SplenectomY/18d1aa4c76cd31749e5c95e9303ef910</a> Probably the check for gmnotes: "isPlanet" on line17 is failing.&nbsp; If you change that to: on('ready',function() { SplenectomY.planets = findObjs({ _type: "graphic", }) &nbsp;&nbsp;&nbsp;&nbsp;.filter(p=&gt;/isPlanet/.test(p.get('gmnotes'))); }); It will start working as intented. Note that it expects you to have graphics with the right name (Anadia, Coliar, etc) and the phrase "isPlanet" in the gm notes.&nbsp; Additionally, it expects the planets to be a transparent graphic where the center aligns with the center of the solar system, and the planet is on the graphic at the radius you'd expect the planet to be at.&nbsp; Like a jelly bean sitting on the edge of a transparent vinyl record.
That works now, thank you. I made sure all the graphics were as expected first, just am inexperienced at script functionality.&nbsp; So it was failing to find the GMnotes that effected the action?
1613851001
The Aaron
Roll20 Production Team
API Scripter
It's more that the encoding of the GM Notes has changed a bit.&nbsp; It used to be that GMNotes was raw text, but when they upgraded the in game editor a few years ago, it changed the way it stores things.&nbsp; It looks the same to humans, but to the API, it's different: gmnotes "%3Cp%3EisPlanet%3C/p%3E" "isPlanet" decodeURIComponent("%3Cp%3EisPlanet%3C/p%3E"); "&lt;p&gt;isPlanet&lt;/p&gt;" So the script was written before and looked for explicitly "isPlanet" but couldn't find it. The change above will just make it look for "isPlanet" somewhere in the text, so it could say: isPlanet This is the planet Andadia, it's a pretty hot planet this close to the sun! and it would still be fine.
Awesome.&nbsp; Great job as always.