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

To Roll20 Devs: Please Please Please Allow Selections Across Pages

I am a long time GM and mod developer. I recently have been working on a new mod called Gaslight. It is working right now, but it would be working so much better if SelectManager could pass selected tokens across pages. Here is the scenario: I run a command using SelectManager to select tokens A, B, and C. The command fires, but because A, B, and C are all on a different page than the one that I am currently looking at, the command's msg.selected contains no tokens, causing it to fail. I set a timeout to run the same command after 10 seconds, and during that time, I switch to the page that contains tokens A, B, and C. The command fires and runs fine because A, B, and C are on the same page as me. I assume that this is a limitation of Roll20's environment and not a limitation of SelectManager, since tokens I select on other pages manually become un-selected when I transition to a different page. I don't ask for much, but this one thing would really make my day. Please, please, please, and thank you.
The Mod sandbox itself can affect tokens on any page. Tokens are graphic objects with a _pageid, and a script can modify them by ID whether or not that page is currently being viewed. The limitation here is msg.selected, not the sandbox’s reach. msg.selected comes from the VTT client’s current selection at the moment the chat command is sent, and Roll20 selection is page-local. If the GM is on a different page, tokens on another page are not part of the current client selection, so they won’t be in msg.selected. Gaslight can use stored token IDs, explicit token IDs, page ID plus criteria, character IDs, or some other way to find the intended graphics without depending on msg.selected. If you post your code (or a link to it in Github or elsewhere) then others could help with troubleshooting.
Gaslight is operating as a meta-script. I know I can store my own token IDs. The point is that I wish to utilize SelectManager to inject tokens from other pages into msg.selected for other API. I know that this is a limitation of the VTT client. This is why the title of the thread starts with "To Roll20 Devs:" . What I am asking for is NOT something that can be fixed with plugin API.
A Roll20 mod can store a cross-page “virtual selection” in state , then later use that stored list to run actions against those tokens. A workable pattern would be: state.GaslightSelections = {   mySelectionName: [     { _id: tokenAId, _type: 'graphic' },     { _id: tokenBId, _type: 'graphic' },     { _id: tokenCId, _type: 'graphic' }   ] }; It would not be a real VTT selection, and it would not visually select tokens across pages. But it could absolutely behave like a selection for other API scripts , as long as those scripts rely on msg.selected and can operate on token IDs that exist on other pages.
Right. So for API scripts that can run against IDs, there's no problem here. I've already got that figured out. The issue is that I'd like to have this work seamlessly for API scripts that run against selected tokens only. And in those cases, I need to be able to inject tokens into msg.selected.