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] A small script to remove vision from every token on the map

Hey, I remember reading on the API forum that someone made a script that simply remove vision from every token on the map. Does anyone know where I can find that still? All the best, Saevar
1528226425
The Aaron
Pro
API Scripter
I don't remember seeing that, but it would be pretty fast to whip up....
1528227605
The Aaron
Pro
API Scripter
This will blind anything with sight on the GM's current page: on('ready',()=>{ on('chat:message',(msg)=>{ if('api' === msg.type && /^!blind-all\b/i.test(msg.content) && playerIsGM(msg.playerid)){ let gm = getObj('player',msg.playerid); if(gm){ sendChat('BlindAll',`/w "${gm.get('displayname')}" Blinded ${findObjs({ type: 'graphic', pageid: gm.get('lastpage'), light_hassight: true }).map((t)=>{ t.set({light_hassight: false}); }).length } Tokens.`); } } }); }); Command is: !blind-all
1528259571

Edited 1528259674
Gold
Forum Champion
The Aaron said: I don't remember seeing that, but it would be pretty fast to whip up.... Weird cuz I was gonna recommend another script that someone called The Aaron created. Token-Mod API script does this. Torch API script also probably does this. As long as you don't mind Selecting or Select-All to get all the tokens. I keep Token-Mod macros on-deck (in my Macro Quick Bar) with the names "Set Light" (gives a menu of pre-set sight distances included blinded and no sight) and "Flip Sight" (toggles on and off). Macro called SET:Light !token-mod --set ?{Vision|Torch, light_radius#40 light_dimradius#20 light_hassight#yes light_angle#360 light_otherplayers#yes|Hooded Lantern, light_radius#60 light_dimradius#30 light_hassight#yes light_angle#360 light_otherplayers#yes|Bullseye Lantern, light_radius#120 light_dimradius#60 light_angle#60 light_hassight#yes light_otherplayers#yes|Lamp, light_radius#30 light_dimradius#15 light_hassight#yes light_angle#360 light_otherplayers#yes|Candle, light_radius#5 light_dimradius#=0 light_hassight#yes light_angle#360 light_otherplayers#yes|Darkvision, light_radius#60 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Darkvision (90'), light_radius#90 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Warlock Devil's Sight, light_radius#120 light_dimradius#=120 light_hassight#yes light_angle#360 light_otherplayers#no|No light source(Dusk), light_radius#120 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Fog, light_radius#200 light_dimradius#=5 light_hassight#yes light_angle#360 light_otherplayers#no|No light source, light_radius#5 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Blinded, light_hassight#no light_angle#360 light_otherplayers#no} Here's a toggle Macro, more simple, this turns Sight OFF if it's on, and ON if it's OFF. Macro called FLIP:Sight !token-mod --flip light_otherplayers light_hassight That's how I do it.
1528260595
The Aaron
Pro
API Scripter
Well yeah, you could do it like that. =D
Haha, The Aaron, that was the script I remembered :) Its been a while since I've been on Roll20 But thanks! I appreciate it as always.