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

Select Torches by Name and turn off

So - I'm extremely new to mods.  I'm trying to find commands (Pro Version) to map-wide select numerous light sources (torches) with the same name and toggle their light status to on or off.  I'm fairly sure certain Mods will do it once I make a marco... but I'm a bit overwhelmed by the amount of info I need to wade through to get started.  Any help folks?
1687350052
timmaugh
Forum Champion
API Scripter
Hey, Grimtoothy... I understand how everything can be overwhelming when you're getting started -- there's a lot of information to digest! You're going to want 2 mods to make this work: TokenMod and SelectManager SelectManager will allow you to virtually "select" things without having to click on them (they won't actually change to being the thing you have selected on the game board -- scripts can't do that -- but they will report to the message as the tokens which were selected when the message was dispatched, if that makes sense). You can select tokens using  a comma-delimited list of   some identifying component (name, id), with or without wildcards: {&select torch*} That would select everything on the current map that had a name beginning "torch". (You can even use regex statements, but you shouldn't need that for your situation.) You can modify the name/wildcards to match what you have, and you can name your torches with more locality if you want finer control (torch_ballroom, torch_northhall, etc.). Then TokenMod will handle the actual turning on/off. Barring an instruction to the contrary, it will by default work on the selected tokens. !token-mod --set emits_bright_light|off emits_low_light|off emits_low_light|off bright_distance|0 low_distance|0 (That command will turn the light "off" for the selected tokens; you'll want another one to  turn them "on".) So the final command line would combine these two elements to make sure we are selecting the correct tokens, then taking action on them: !token-mod --set emits_bright_light|off emits_low_light|off emits_low_light|off bright_distance|0 low_distance|0 {&select torch*} Note, you can't combine script commands like this for just any script... SelectManager is what we call a metascript, and is specially designed/built to be added to the command lines of other scripts. It acts first (before the other script), detects what it needs to do, changes the message object (what the scripts see), and removes the syntax structures from the line before the receiving script (TokenMod) sees it.