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

[Request] Creating an image-based bar that wraps to token

I saw, recently, a thread that suggested that the API could be used with scripts to create custom health bars, but I want to take it one step further - specifically for games like Shadowrun, World/Chronicles of Darkness and Exalted, which use box-based health. The basics would use images to wrap a bar (images?) around the token spaced and sized based on how many boxes you have, or in the case, two for Shadowrun health tracks, which would be separated into ticks, and either hold a symbol, or colour to indicate if they're empty, or filled with damage. Additionally, could you use the same idea to wrap -any- kind of bar to a token? If I wanted to position a health track, and two other bars inside of that track that adjust dynamically, is that also possible? If so, where would one start, if you have next-to-zero coding talent?
1464702348
The Aaron
Pro
API Scripter
It is possible to do what you are suggesting, but probably not terribly easy, particularly if you haven't learned programming yet.  The place to start would be learning javascript and writing some very simple API scripts to get a feel for it. Here is my understanding of what you are describing: Add a colored border box around a given token to represent a health track (possibly more than one) The border is graduated into segments to represent the values of the track. Changing an attribute causes the border to get portions marked off. Sound about right? Have a look at  Facing for starters.  Facing has a little dial that follows around a token and points in a direction to indicate what direction the token is facing, while keeping the token right side up.  Much of what facing does is similar to what the script you are describing would need to do. (create image, have it follow the token, etc).   For your script, I'd suggest pre-making the border graphics, one for each possible value, probably in sets of 10.  So, one for 0/10, 1/10, 2/10, etc. 0/20, 1/20, 2/20, etc.   ( Pro Tip : If you make them grayscale, you can color them with the graphic tint option to get variations.)  Swapping to the right image will be much easier than adding a mark to the existing one and moving it around along with the token and background. You'll probably want ones for 70px X 70px interior, 140px X 140px, etc.  You might also want ones that fit outside of those for secondary bars. That's probably enough to get you started on process.  I'm happy to discuss at length if you want to dive in.