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

Changing angle of emitted light from Torch

Hey, is it possible to change the angle of the light emitted from the !torch script? In our party we have several different light sources - people with torches, magical swords/daggers, candles, and a bullseye lantern. All the lighting needs can be handled by using the flicker and radius options on the torch script, but I don't see a way to make it narrow the beam. Is that possible?
I would imagine you could edit the code (if it isn't already in place on it) to set the angle of the light on the token from blank (360º default) to a smaller angle.
I'd like for it to be one script for all party light sources. If I edit the code, that would mean (if I understand it correctly) that I'd have to have a separate script just for the lantern.
1430596409
The Aaron
Pro
API Scripter
Yeah. Let me see if I can add that for you real quick... I'll probably have to hack it just a bit to get the interface to take the parameter. I wrote that a while ago and the parameters are a bit strict compared to more modern scripts....
Nah, you wouldn't need to have a separate script for it. You could use the same script, simply add that specific part into it. Of course, Aaron looks like he's about to hack it together himself, so I am going to bow out now, let him take over on this, and try and celebrate my daughter's 16th birthday.
1430600100
Gen Kitty
Forum Champion
The best birthday gift you could give her is a copy of the javascript book ^_-
1430602254
The Aaron
Pro
API Scripter
Done. =D You an add --&lt;number&gt; to set the angle, which defaults to 360. This works for both !torch and !flicker-on. !torch 60 30 on --120 !flicker-on 60 30 on --120 With defaults: !torch - - - --120 !flicker-on - - - --120 The angle can come anywhere in the list of token ids, but must be after the first 3 arguments (radius, dim radius, all players) !torch 60 30 on @{target|Target1|token_id} --120 !flicker-on 60 30 on @{target|Target1|token_id} --120 The flicker version flickers by +/- 5º GIT: <a href="https://github.com/shdwjk/Roll20API/blob/master/T" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/T</a>...
1430605686
vÍnce
Pro
Sheet Author
Nice. Thanks for the angle. Good idea Gozer
Wow, quick work!
1430623656
The Aaron
Pro
API Scripter
Ha! I would have been done sooner, but I was in a Starbucks and had to leave and drive an hour home before I got a chance to commit it. =D
1430623744
The Aaron
Pro
API Scripter
I'm considering adding a non-flickering light source on an invisible under-token that does this. The major benefit being I could rotate it to point the beam in a more sensible direction if that was the desired use-case. (maybe tie it into my facing script... hmm...)
Yeah, that is one little problem - sometimes the token used does not "face" the right way. Toward or away from the handle is no big deal, since that can be fixed with a "flip vertical," but what do you do when the handle is on the side of the token? I have a lantern token, but the handle is on the side, which means when the angle is changed, the light comes out of the side of the lantern, not the front. Not a big issue in the grand scheme of things, but...
It doesn't seem to be working for me. I'm just copying and pasting the command you have up there, do I need to take the spaces out, or anything like that?
1430625174
The Aaron
Pro
API Scripter
Shouldn't.. PM me an invite and I'll jump in and take a look..
1430625317
The Aaron
Pro
API Scripter
Also, try typing in the command instead. Sometimes the forum swaps out characters that look the same but don't compare the same and screws up a command.
1430625535
The Aaron
Pro
API Scripter
1430625695
The Aaron
Pro
API Scripter
Try: !torch --help and make sure you're on version 0.8.1
Ok, I've gotten this macro to work as a sort of generic "apply lighting" macro that works with any token: !?{flicker-on/off, torch, snuff|flicker-on} ?{Radius?|40} - ?{All Players see?|yes} --?{Angle?|360} This works, as long as I select a token before I run the macro. However, I wanted to try using as a targeted macro, so I did this: !?{flicker-on/off, torch, snuff|flicker-on} ?{Radius?|40} - ?{All Players see?|yes} @{target|Target1|token_id} --?{Angle?|360} and then I got this error, and my scripts were broken: /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 '1' of null at evalmachine.&lt;anonymous&gt;:2512:59 at Array.filter (native) at Function._.filter._.select (/home/symbly/www/d20-api-server/sandcastle/node_modules/underscore/underscore.js:172:65) at _.(anonymous function) [as filter] (/home/symbly/www/d20-api-server/sandcastle/node_modules/underscore/underscore.js:1073:39) at handleInput (evalmachine.&lt;anonymous&gt;:2511:26) at eval ( I'm assuming I've got something wrong with the "target" syntax, but I don't know what.
1430659497
The Aaron
Pro
API Scripter
Hmm. I'll take a look.
Do you need an invite to my game, or are you going to look elsewhere?
1430665887
The Aaron
Pro
API Scripter
I was just going to look in my test campaign. I don't mind jumping in yours if you want me to look at problems. =D
1430667088
The Aaron
Pro
API Scripter
Fixed! GIT: <a href="https://github.com/shdwjk/Roll20API/blob/master/Torch/Torch.js" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/Torch/Torch.js</a>
Works on mine too! Great job. Now onto the next project...
1430669534
The Aaron
Pro
API Scripter
=D
1430838398
The Aaron
Pro
API Scripter
Updated to fix a bug Mark pointed out. If you had flickers already active in your game, they would cause a crash as the new function expected them to have a light_angle entry. Fixed in 0.8.3