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

"Pulsing" light

I'm creating a room in a dungeon for my players which has 6 crystals on the wall, which give off some blue light and crackle with lightning, giving the entire place a "pulsing light" kind of feel. Now with the API I figure I can actually have them really see this by having the light change from dim to bright and back, increasing and decreasing the radius of it at the same time. Perhaps overlayed by a blue aura that also changes size (but maybe that looks stupid) However I've not had time enough to learn the API well enough yet to be able to do this myself. I'm hoping now some of you who delved into this further than me know how to do this or perhaps you did something similar already.
1368637455
Konrad J.
Pro
API Scripter
for my timer script I had the aura's getting larger, different colours, and then smaller.  It was a visual so you know the timer is ticking.  You can do this with the lights as well.  It would be fairly easy coding.  You could make a generic function that did all that and you passed it the parameters of colour, size, speed, etc.  Then you would be able to change it easily until you found what you liked.  I'm a bit busy right now, but if you could wait until the weekend perhaps I could play around with some ideas and show you how to do it. And I'm sure someone else will speak up with some ideas as well. I'd do it through a chat message event.  A command to turn it on|off and a command to pass it parameters.  Then you can make different macros that make it do all sorts of things.  The only thing we couldn't do is start the sound effects.  API doesn't have control of the sound as of yet (as far as I know).
Ah nice to see it's possible. :) With the timer script you're refering to your Stopwatch/Hourglass one? I'll look into that then.
1368638710
Konrad J.
Pro
API Scripter
Quatar said: Ah nice to see it's possible. :) With the timer script you're refering to your Stopwatch/Hourglass one? I'll look into that then. Yup that is the one.  For flashing faster you would need to change the 1000ms (1sec) to a shorter time.  If you don't get anywhere I'll put something together for you on the weekend.
Check out my video:&nbsp; <a href="http://www.youtube.com/watch?v=-WuLm6f2gis" rel="nofollow">http://www.youtube.com/watch?v=-WuLm6f2gis</a> var lights = function(lightsource,radius,dim,delay) { &nbsp; &nbsp; var light = findObjs({_type: "graphic", name: lightsource})[0]; &nbsp; &nbsp; &nbsp; setTimeout(function() { &nbsp; &nbsp; light.set("light_radius", radius); &nbsp; &nbsp; light.set("light_dimradius", dim); &nbsp; &nbsp; }, delay) }; You can add in a line and a parameter to set the aura if you need it. And you'll need something like: on("chat:message", function(msg) { &nbsp; if(msg.type == "api" &amp;&amp; msg.content.indexOf("!lite") !== -1) { &nbsp; &nbsp; &nbsp; lights("light1",100,0,0) &nbsp; lights("light1",100,100,500) &nbsp; lights("light1",100,0,1000) &nbsp; }; }); etc. That'll flash the graphic named "light1" on and off every half second. After some exploration, using intervals decreases performance, so typing out each line works best. Need 6? Just use each name seperately: lights("light2",100,100,0) etc. Note: do not go under 50 milliseconds on the delay or it will just hang. 100 is safe on my system. So no strobe, but it will flicker on and off.
Wow that video looks great! I really have to find the time to really dive into the API, but thanks a lot there, that should help me!