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 .
×

One Vision Macro to Rule Them All

I've got token-mod macros to adjust token vision for pretty much any situation, but I'd like to collapse them into a single macro with a dropdown instead of 6+ individual macros cluttering up my screen.  As usual, I can do the simple stuff, but complicated macros are beyond me. Samples: Blind /emas @{selected|token_name} is blinded! !token-mod {{ --ids @{selected|token_id} --set bright_vision|off night_vision|off defaulttoken }} Restore-Vision !token-mod {{ --ids @{selected|token_id} --set bright_vision|on night_vision|off defaulttoken }} Restore-DV !token-mod {{ --ids @{selected|token_id} --set bright_vision|on night_vision|on night_vision_distance|60 night_vision_effect|nocturnal defaulttoken }} I have more that handle other vision conditions (torches, lanterns, extinguished light sources, etc.), but if what I'm trying to do is possible, all I need is a pattern I can copy for everything else.
TokenMod specifically allows for # to be used in place of | for queries, so that is the first thing you can change. You also don't need to include --ids @{selected|token_id} as any selected token is already affected by default.  You can move anything that is common to all of the query responses outside of the query so it doesn't have to be repeated over and over. If you want to include an /emas command, then you need a line break for that response. 
 is the HTML entity for a line break that can be used in a query. For Blinded you don't need to remove 'night_vision' - turning off 'bright_vision' will blind a token. The same is true for 'Restored Vision' - you can leave 'night_vision' alone altogether when blinding a character, so when you restore sight, the token will still have the setting for night vision saved. !token-mod --set ?{Vision?| Restored,bright_vision#on defaulttoken --report gm#"{name}'s vision is restored." | Blinded,bright_vision#off defaulttoken 
/emas @{selected|token_name} is blinded!| Darkvision,night_vision#on night_vision_distance#60 night_vision_effect#nocturnal defaulttoken --report gm#"{name} has darkvision enabled." } You can add the --report feature if you want a GM note for when a token was modified as well: !token-mod --set ?{Vision?| Restored,bright_vision#on defaulttoken --report gm#"@{selected|token_name}'s vision is restored."| Blinded,bright_vision#off defaulttoken 
/emas @{selected|token_name} is blinded!| Darkvision,night_vision#on night_vision_distance#60 night_vision_effect#nocturnal defaulttoken --report gm#"@{selected|token_name} has darkvision enabled." }
Yeah... including things I don't really need is an artifact of learning to code back in the '90s:  Be specific and exercise control of everything or be surprised when stuff doesn't work as expected. But I like where this is pointing and I'm pretty sure it gives me exactly what I'm looking for... as long as I don't screw up the syntax.