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

Edited 1781809840
Gauss
Forum Champion
Kenan Millet said: &nbsp;This is why the title of the thread starts with "To Roll20 Devs:" .&nbsp; If you want to contact the Devs the forums are not the best place for that. The forums are primarily community help. The Devs may or may not see it.&nbsp; File a Help Center request or a Suggestion in the Suggestions forum.&nbsp; Help Center:&nbsp; <a href="https://help.roll20.net/hc/requests/new" rel="nofollow">https://help.roll20.net/hc/requests/new</a> Suggestions forum:&nbsp; <a href="https://app.roll20.net/forum/category/385189" rel="nofollow">https://app.roll20.net/forum/category/385189</a>
1781897947
timmaugh
Pro
API Scripter
(Author of SelectManager and the other metascripts in the Metascript Toolbox)... Fetch can refer to tokens from another page in a couple of ways: 1) if the token is uniquely named across the game (I know, not always ideal), and 2) by using a page reference in the Fetch construction (new in 2.2.1) Because you're using a Fetch construction to return the token, and Fetch typically runs AFTER SelectManager (if you have the full Toolbox installed), you either need to defer the SelectManager construction: {\&amp;select ... } ...or you could use a ZeroFrame timing structure to reorder Fetch to be first: {&amp;0 fetch, sm} Also, if you are operating as a metascript but (it would seem) *not* registering to ZeroFrame, you'll need to make sure your script is installed *after* the Toolbox to make sure that the Toolbox can do all of the above before your script sees the message. (Seems like you're doing that already, but figured I'd say it.) If you have any trouble utilizing or building the new functionality of Fetch and making it work with SelectManager, post back.
1781921804
timmaugh
Pro
API Scripter
To make it clear... Fetch does not require the unique name to reference a token from another page if you're using the method from update 2.2.1 (linked). Those were 2 different methods of referring to a token from another page.