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

Help With Query to Call Abilities/TokenMod - 5e by Roll20 Character Sheet

I have a PC who doesn't have dark vision, but he does have an item that he can use to cast light in a 30ft radius.  I can get the TokenMod commands to turn it off or on, and I have those set up as abilities.  I'd really like to have a query so the player can hit a token button and be presented with a "turn the lights on or off" drop-down, but I can't seem to get that to work.  I know it's something simple, and I've looked at the wiki and ended up more confused. Here's what works: Turn The Lights On !token-mod {{   --on     has_bright_light_vision     emits_bright_light     has_night_vision   --set     bright_light_distance|30     night_vision_effect|nocturnal     night_vision_distance|2  }} Turn The Lights Off !token-mod {{   --on     has_bright_light_vision     has_night_vision   --off         emits_bright_light   --set     night_vision_effect|nocturnal     night_vision_distance|2  }} Here's what I'm hoping to have: ?{Light|On, %{Light-ON}|Off, %{Light-OFF}} I know one or more of you geniuses can set me straight here.

Edited 1674838368
API Scripter
Hey, E... you have to think about these things in the order things happen. Before the query is resolved, attributes and abilities are expanded into the command line. That means that your command line now has your query, and within the query is all of the text from BOTH token-mod ability macros. If either of them have query-control characters (closing brace, vertical pipe, or a comma), then your query will break. Fetch can get the ability text into your command line *AFTER* the query runs. There are only 2 catches. 1) Fetch can't use the trick where abilities know what character sheet they are on, so you don't have to include the character's name. To use Fetch, you have to supply the character name: %{Light-ON} ...becomes %(Character Name.Light-ON) 2) You have to start with a bang in order to trigger the metascript cycle, which means that after the query resolves and Fetch gets  the contents of the chosen ability, your message will now have 2 bangs: !!token-mod... Installing ZeroFrame takes care of this (reduces multi-bangs to a single-bang). So, with Fetch and ZeroFrame installed, your command line would look like: !?{Light|On,%(Character Name.Light-ON)|Off,%(Character Name.Light-OFF)}