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] Animation

Visual effects and moving bits are a great way to enhance immersion. The Animation script is here to help your game look great. Define animations you can refer to by name, then run them at will. For example: Select a token of a ball of fire and enter !anim add image Fire to name the image "Fire" for easier reference later. Create a new (empty) animation named "Fireball" using !anim add animation Fireball Add the first frame using !anim add frame Fireball Fire 50 -w 35 -h 35 --light 10 --dim 5 which will add a 1/20th of a second frame which emits bright light out to 5 feet and dim light out to 10 feet. Add subsequent frames using !anim add frame Fireball --copy -1 -w 70 -h 70 --light 20 --dim 10 which will copy the previous frame, but override the width, height, light, and dim properties with those specified. Continue adding frames until the desired effect is achieved. From now on, you can select a token and enter !anim run Fireball to cause a ball of fire and light to explode on the token. Alternatively, running !anim run Fireball -x 525 -y 315 will center the fireball in the center of the fifth square down the eighth column of the page.
1434616090
Ziechael
Forum Champion
Sheet Author
API Scripter
A really interesting and potentially very useful idea... do you happen to have a gif or short video link you could post so that prospective abusers users of this script can see it in action before putting the (admittedly minimal) effort in? Can think of so many uses for this! Thanks =D
1434632741
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Slick. Just played around with it!
looks awesome, without scanning the script, how did you handle the load issues? During peak hours players need to load the graphics as they appear and given the time of 'first seen' and when the graphic should vanish, it in all likelihood wouldn't appear as a fluid animation. Perhaps missing a few frames, perhaps even leaving artifacts (similar to the token move artifact if a move packet is lost).
You sir. Are a god if this works as you say it does.
This script sounds like what everybody would like to see but I get an "Unexpected Identifier" error when I copy/paste the script to a new API slot and try to run it...
Dunno. Not gotten around to playing with it yet.
No videos (I'm not terribly good with the whole graphics thing), but I did just add export functionality so people can share what they make reasonably easily. Not sure what's going on with the "unexpected identifier" message, although if the unexpected identifier is "s" then that's a pretty common problem that people seem to have (which I've never hit) that seems to be related to how multiple scripts are concatenated together. In that case, it may be valuable to verify that all active scripts have a ';' at the end of their last nonempty line and resave one or all active scripts. It's also worth checking to make sure the script got pasted in completely.
Curious, how are you "deleting" the images from the tabletop? Also is it possible to set it up so that the last frame stays on the board? as a controllable Token? I suppose I could make the last frame last a indefinite amount of time but I feel this might hangup the script doing that.
/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Cannot read property 'id' of undefined at Object.Animation.addJob (evalmachine.:6003:29) at Object.Animation.handleAnimationMessage (evalmachine.:6930:22) at Animation.handleChatMessage (evalmachine.:6951:19) at eval ( Also this error comes up, I imagine its because it can't take images from the Roll20 Marketplace database?
The script just calls the token's remove() method when the last frame is done. If you wanted to leave all animation tokens around after their respective animations finish, you could comment out the call to tok.remove() in removeRunningAnimation. I'll have to think a bit to figure out the best interface for specifying that an animation should stick around after it's done on a per-animation basis. As a clunky workaround for now, you can set the last frame to be a few seconds long, then copy and paste the token on top of itself. You're right about the cause of the error: images used by the API must come from a user library, not the marketplace. I'll add an error check there so we can handle that case more gracefully than by crashing.