
Jon A. had a great idea for a script and asked me about it, so I created it. =D
If a token has sight that other players can see, then you can select it (or a whole group) and run:
!drop-torch
The script will create a little torch token below each selected token, transfer the light radius, light dim radius, and light angle to it, and remove the same from the selected tokens. Tokens with light that isn't visible to other players (i.e. Darkvision or similar) are not changed and don't create a torch token.
Note: This works with Legacy Dynamic Lighting (i.e. the Dynamic Lighting we've been using, not the new Updated Dynamic Lighting that's currently in public beta). I'll update this when the UDL API solidifies.
Script:
on('ready',()=>{ const torchSrc = "https://s3.amazonaws.com/files.d20.io/images/119704545/iEuLX30JcxYYqwE98nUmcg/thumb.png?158640249955"; const dropTorch = (obj) => { if(obj.get('light_hassight') && obj.get('light_otherplayers')){ let size = Math.min(parseFloat(obj.get('width')),parseFloat(obj.get('width'))); let torch = createObj('graphic',{ imgsrc: torchSrc, pageid: obj.get('pageid'), layer: obj.get('layer'), controlledby: 'all', width: size, height: size, left: obj.get('left'), top: obj.get('top'), light_otherplayers: true, light_angle: obj.get('light_angle'), light_radius: obj.get('light_radius'), light_dimradius: obj.get('light_dimradius') }); setTimeout(()=>toBack(torch),50); obj.set({ light_angle: 360, light_radius: 0, light_dimradius: 0 }); } }; on('chat:message',(msg)=>{ if('api'===msg.type && /^!drop-torch(\b\s|$)/i.test(msg.content)){ (msg.selected || []) .map(o=>getObj('graphic',o._id)) .filter(g=>undefined !== g) .forEach(dropTorch) ; } }); });