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 Request] Token Bar/Data Export

I'm a complete newb when it comes to scripting. I spent some time on Unity and scripted some simple little things that i thought were pretty awesome, but that's beside the point. The main idea here is to be able to export the Health Bar, for example, of a player token, to somewhere where data could be retrieved. This would all be to acquire the health bar that would automatically sync with the character tokens, so people livestreaming on Twitch could put the characters health bar on an overlay or something similar, on the screen, so everyone could see the players health. Not sure if this is possible at all, or if it's even available elsewhere, but I think it would be neat.
1449281209
The Aaron
Pro
API Scripter
Hmm. I've not used Twitch or any of the overlay stuff. Seems like you'd need a couple different things to happen to do what you're after. Can you describe how you see the process working?  I'm assuming this info world need to be exported on some interval or at a minimum whenever it changes. And where would you expect it to go?  A handout might work, or to the chat in an inoculus way?  Seems like there would need to be a client side script doing the extract?  Thoughts? Details?  :)
1449281975

Edited 1449282170
Even if there were a way to just receive the raw data for the bar, like the current and total number, I.E. 30/47 it would be fairly simple to make a bar for the overlay that works just like the bar on the tokens do. I would imagine having a way to maybe store the token info as a variable somewhere that would refresh at a specific rate. Somewhere where it can be accessed outside of the physical roll20 interface should do the trick. Although If it could be tied to a handout, that could work very well too. Assuming we can get a bar like effect on the handout itself. Adding a method of capturing that bar for the stream is easy. It could be done from the tokens, but the tokens move so the capture would have to move with it, that's not really an option. If we could get something that would emulate a health bar of the token, and put it on a handout, that would work perfect.  Hmm... Maybe add a tag in the DM notes of the character sheet that tells it to output/store the data from Bar 1, and we could emulate the bar on a handout? No idea if that would work, but it's the best i have.
1449331880
The Aaron
Pro
API Scripter
The API can't provide anything directly to outside Roll20, so stuffing those details in something like a handout that could be updated and also popped out of the interface is probably the easiest thing to do.  The actual API script is simplistic for the case that only players are making changes to the bars via the UI (listen to on('change:token') events).  When the changes come in as part of an API script, it becomes slightly more complicated as API changes to attributes do not trigger change events.  You would either need to modify all the scripts to cause the update to happen (likely by calling some function) or setup an interval that polls known attributes for changes ever so often and updates the handout then.