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 .
×
Advertisement Create a free account

Trying to use a single query input in multiple operations

1631467114
I want to change my macro so that rather than having to enter separate queries for dim light and bright light ranges you just enter 1 value that is used in both operations. Currently my code is: ?{ Light/Vision options |Normal vision,!token-mod --on has_bright_light_vision --off has_night_vision |Blind,!token-mod --off has_bright_light_vision |Darkvision,!token-mod --on has_night_vision --set night_vision_distance#?{Range} |No Light,!token-mod --off emits_bright_light emits_low_light |Bright Light,!token-mod --on emits_bright_light --set bright_light_distance#?{Range} |Dim Light,!token-mod --on emits_low_light --set low_light_distance#?{Range} }&{noerror} Is there a way to reuse the 1 query input in both --sets for dim and bright light? Store in the query in a variable or something?
1631514260
GiGs
Pro
Sheet Author
API Scripter
Since its a query, you can only pick one option each time you run it. Are you saying you want to store the value to use in separate macro calls?
1631537222
I want to use the value in both --set bright_light_distance and --set low_light_distance, for example a torch is 20 feet of bright light and 20 feet of dim light, so the player could either enter 40 for the total range and i just divide it by 2 for each. Storing it in a variable would be great.
1631588669
timmaugh
Pro
API Scripter
The query will prompt once, but then can be used anywhere you need it. TokenMod can set multiple properties at the same time, in one statement. So I think you need to just include both bright and dim light set-statements in the same command line, and set them both equally to the same roll query. You might want to have a different or new name for the option that would appear in the outer roll query.... Something like "Bright and Dim Light"
1631588814
Can you give me an example?
1631646314
timmaugh
Pro
API Scripter
Sure... this is your command line with one more entry in your outer query, for "Bright and Dim". Selecting that will turn them both on, and then set both to the same input. ?{ Light/Vision options |Normal vision,!token-mod --on has_bright_light_vision --off has_night_vision |Blind,!token-mod --off has_bright_light_vision |Darkvision,!token-mod --on has_night_vision --set night_vision_distance#?{Range} |No Light,!token-mod --off emits_bright_light emits_low_light |Bright Light,!token-mod --on emits_bright_light --set bright_light_distance#?{Range} |Dim Light,!token-mod --on emits_low_light --set low_light_distance#?{Range} |Bright and Dim,!token-mod --on emits_bright_light emits_low_light --set bright_light_distance#?{Range} low_light_distance#?{Range} }&{noerror}
1631648159
Thanks :)