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

Toggle animated token looping via API?

I have a rollable token for each of my PCs, where each side is an animated image: one for healthy, one for bloodied, one for unconscious, one for dead, etc. Everything about this works great. I can drag the token onto the map, manually change sides, and each side will display as expected, fully animated / looping. I have a script that changes which side of the token is visible, based on the character's HP / other factors. For instance, when their HP drops below half, it switches to side[1]: the "bloodied" animation. This mostly  works. When the character drops below 50% HP, for instance, it switches to the appropriate side. However, the new animation only plays once, then stops, instead of continuing to loop. The engine seems to still believe that it is looping: if I manually right-click the token, I can use Animation > Stop Looping, then Animation > Loop, and the token will resume animating, as expected. Is there any way I can do this via API? Some sort of graphic.play() or graphic.set("looping",true) function? I searched around a bit, but haven't found anything. Thank you!
1562675277
The Aaron
Roll20 Production Team
API Scripter
The API currently does not have access to the animation functionality. 
Roger, thanks for the response! Out of curiosity, I tried duplicating the token after setting the new side/image, to see if that might kick the engine into looping it properly, but the duplicated token is stuck on a single playback, too. Hopefully some proper API controls/toggles are on the way soon. Thanks again!
1562716090
The Aaron
Roll20 Production Team
API Scripter
Agreed!
Followup, for future googlers: I was able to work around this problem by writing a client-side script that checks intermittently for canvas objects that SHOULD be looping, but aren't, then manually simulates the Animation > Stop Looping / Animation > Loop commands on that object. This is not a proper solution, of course, and requires some dubious clientside scripting that is prone to break at a moment's notice, but it is possible. Feel free to PM for more information / explanation. In the mean time, a formal bug report has been filed.
Fek, do you have an example of an animated / looping token file?  I am interested in creating some token sets but want them to animate.  Especially what you refer to as having different sides?  Bloodied , unconscious, dead etc.   could you point me in a direction of where to find a file that you deem to be a perfect example of an animated token? Drew
QuickQuests said: Fek, do you have an example of an animated / looping token file? These are the ones I've made for my newest campaign:&nbsp; <a href="http://crosswindscampaign.com/pcsprites/" rel="nofollow">http://crosswindscampaign.com/pcsprites/</a> You're very welcome to use them for testing purposes.