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

[Script...Idea?] Image change based on rotation.

So, I know that because of how the tabletop is rendered that animated tokens is nigh impossible. But I was thinking, is there a way to make specific tokens change their image based on rotation? Like, say a simple sprite sheet or a series of images that when the rotation is one of the 90 degree points changes to face that particular direction. As opposed to just a top down token. Does something like this need to be whipped up, or does it already exist?
Kerberos said: Does something like this need to be whipped up, or does it already exist? This does sound similar to Rollable Table Tokens .
1450617324
The Aaron
Pro
API Scripter
This could be done with a script, but suffers from the limitation that it will only work with images in a user library. Silvyre is right with the rollable table thought, that would probably be the easiest way to organize it. You would need a separate image for each direction.
Alright, that's awesome to know that there is already essentially a foundation for this. After some momentary checking the info on a Multi-Sided token, there appears to be a currentSide variable that references which "side" of the token is selected. I figure if you make rollable tables in a similar pattern, you could make an api to change the currentSide in reference to one of the 90 degree directions. Or 45 if you have a token with that many faces. My only catch is that I don't know how to look for the update triggers relevant to choosing a side and updating the token. I'm using something like, if ( token.rotation == 90 ) { token.set("currentSide", 1) }; But the token won't update to the new side. Anybody know the update trigger?
1450702843
The Aaron
Pro
API Scripter
This should give you some ideas: on('change:token:rotation',function(obj,prev){ log('Rotation was: '+prev.rotation+ ' now: '+obj.get('rotation')+ ' new face 90: '+Math.floor(obj.get('rotation')/90)+ ' new face 45: '+Math.floor(obj.get('rotation')/45) }); &nbsp; &nbsp; &nbsp; &nbsp;See events:&nbsp; <a href="https://wiki.roll20.net/API:Events" rel="nofollow">https://wiki.roll20.net/API:Events</a>