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

Running group-init with SelectManager

I'm trying to string together a way to select a group using SelectManager API then running the GroupInitiative API to add them to the turn order (dnd 5e).  Tried a few things but so far haven't made any progress.  What I thought might work was: !token-mod --ids {& select Hobgoblin*} --current-page  #GroupInit (macro that I use for running the GroupInitiative API...I have tried !group-init as well but no joy there either).   And, is there a way to make the static select item (i.e. Hobgoblin) a variable that can prompt me vs. hard coding it in? Thanks for any tips! Scott
1698434667
timmaugh
Forum Champion
API Scripter
Hey, Lhas... there are a couple of things to correct about your usage of the {&select} tag. First, for your TokenMod line... you don't have to use the --ids argument. In fact, the {&select} tag doesn't return a list of IDs that it is selecting. Instead, it modifies the message object behind the scenes so that by the time TokenMod sees it, the message has the correct selected tokens. In other words, since TokenMod operates on the selected tokens by default, you don't have to change the behavior at all to use the {&select} syntax. This should work better: !token-mod ...args here...   {& select Hobgoblin*} I'm just not sure what you're doing with the TokenMod line...? You don't appear to be setting anything. If you're just needing to be able to use the SelectManager {&select} syntax with GroupInit, you can skip this line altogether. Next, for your GroupInit line... the {&select} statement has to be on the same line as the GroupInit macro for it to work on it. Provided the #GroupInit macro begins with a bang ("!") -- which it should since you're calling GroupInit -- then you can actually put the {&select} syntax right after it. Roll20 will expand the macro into your command line, so it will basically be like you've typed the GroupInit command yourself... just that you've *also* included the {&select...} syntax to follow it: #GroupInit {&select Hobgoblin*} Now, if those two lines (TokenMod and GroupInit) are going to operate on the same tokens, you might as well batch the lines up with ZeroFrame to reduce the overall level of processing you have to do. A ZeroFrame batch will allow you to run the SelectManager tag one time, gathering all of the Hobgoblin tokens, then handing that token set off to the TokenMod and GroupInit lines when they are ready. That would look like this: !{{ {&select Hobgoblin*}    !token-mod --current-page    #GroupInit }} The {&select} tag can be almost anywhere in the set of lines, above. Since it will be processed before the message reaches ZeroFrame (which will then turn around and dispatch the messages to TokenMod and GroupInit), it will be consumed before ZeroFrame even gets to parsing the lines. Finally, to prompt for a query is easy enough... {&select ?{Which group?|Hobgoblin*} } That will prompt with the ability to free-type text to enter the pattern that will match the necessary tokens (don't forget the wildcard symbol - * ). You could enter: Hobgoblin* -- to get all things that begin "Hobgoblin" Goblin* -- to get all things that begin "Goblin" *oblin* -- to get all things that contain "oblin", which would include both Goblins and Hobgoblins Were* -- to get all things that begin "Were" etc. You could also have those in the query: {&select ?{Which group?|Hobgoblins,Hobgoblin*|Goblins,Goblin*|All Goblin Types,*oblin*|Werethropes,Were*} }
Thanks!  I will give it a shot and post here with the results!