Advertisement Create a free account

API for timed light source.

1568068463

Edited 1568068508
Hello, I'm looking to play a game of 10 candles on Roll20 and one of the things needed for the game are candles. What I'd like to do is create an API that I can call when I place a token on the board that would display one image for an amount of time, possibly random, and then change the image automatically when that time elapses. It's been a few years since I did any coding, and I'm pretty lost so any help would be appreciated. Even better would be to have it be a light source with the dynamic lighting API.
1568071734
The Aaron
Forum Champion
API Scripter
Interesting.  So, Ideally, you'd like to have a script that does: For a selection of tokens (or perhaps creating a group of tokens for the purpose): Initialize each to some amount of time (perhaps a base amount plus some random offset) Set each to the "first" image of a full candle Set each to some initial full radius of Dynamic Light Over time, for each token: Decrement the remaining time Decrease the radius of Dynamic Lighting light (possibly by some inverse power function) As each subset of it's life (based on number of images) passes, switch to the next image When the end of the time is up, set to the last image and extinguish the light Sound about right? If you can furnish the images, I can furnish the script.  Unless you just want to write it, in which case I can give you some pointers.
1568074968

Edited 1568075158
Yeah, basically, or just have two states, "Lit" and "Not lit" with a timer that will change from one state to the other, unless it's changed manually. One aspect of the game is a scene ends when a candle goes out, either through the results of play, or the wax burns up, or just random chance, and it would really help to have some of those variables in play to add tension. If you could help out with the script that would be great. My skills are about 5 years rusty.
1568085329
The Aaron
Forum Champion
API Scripter
No problem!  So, sounds like players/GMs can chose to blow out a candle. And a candle can go out because of an accident, like setting a book down too hard near it. Are there any other parts of the game like tokens or character sheets or the like?
1568148970
Pretty much! Other than dice, which Roll 20 already has, there isn't much else to it.
1568666440
Hey @Aron, just wondering if you are still interested in the script. Do you need me to supply images to you so you can work on it?
1568687707
The Aaron
Forum Champion
API Scripter
I am, just have limited free time at the moment. Images would be a great help.