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

ScriptCard using SelectManager stopped working with latest SelectManager

Hello, I have a ScriptCard macro I use in my game that stopped working with the latest SelectManager. It works if I use the 1.0.13 version of SelectManager but it fails to select the token with the 1.1.0 version. !scriptcard {{ --/|TODO: read season from stored string var --/|TODO: read weather description from handout? --/|TODO: add sound effects for various weather effects --/|Requires: SC 2.1.8+, SelectManager, 5E Resting in Style --#title|Begin New Day --#reentrant|gmrestcard --#whisper|gm --#overrideTemplate|generic --/|VARIABLES --&Season|summer --:GetPlayerTokens| --~TokenCount|array;pagetokens;RestTokenArr;[*C:playerpageid];pc --?[&TokenCount] -eq 0|ErrMsg --:RollForWeather| --=CurrentDayWeather|[T#weather-[&Season]] --?"[$CurrentDayWeather.tableEntryText]" -eq "High Winds"|=WindDirection;1d4 --?[$WindDirection] -eq 1|&WindDirection;West --?[$WindDirection] -eq 2|&WindDirection;North --?[$WindDirection] -eq 3|&WindDirection;East --?[$WindDirection] -eq 4|&WindDirection;South --?"[$CurrentDayWeather.tableEntryText]" -eq "Strange Phenomena"|=Phenomena;[T#weather-strange_phenomena] --+Weather|[$CurrentDayWeather.tableEntryText] [&WindDirection] [$Phenomena.tableEntryText][hr] --:DisplayPlayerRestButtons| --~RestTIDList|array;stringify;RestTokenArr; , --%PCTID|foreach;RestTokenArr --+[*[&PCTID]:t-name]|[r][rbutton]SR::PlayerShortRest;[&PCTID][/rbutton] [rbutton]LR::PlayerLongRest;[&PCTID][/rbutton][/r] --%| --+All Players|[rbutton]SR::PlayerShortRest;[&RestTIDList][/rbutton] [rbutton]LR::PlayerLongRest;[&RestTIDList][/rbutton] --X| --:PlayerLongRest|TokenID --@long-rest|{^& select [&reentryval] } -->Done| --:PlayerShortRest|TokenID --@short-rest|{^& select [&reentryval] } -->Done| --:ErrMsg| --#emoteText|No Tokens Found --+ERROR|No Player Tokens were found on player page -->Done| --:Done| }} The token_id is still being passed in via the re-entry as before but now SelectManager doesn't seem to select the token and the Resting in Style script returns the warning that no tokens were selected. Can anyone help troubleshoot what I need to update to get this working with the latest version? Thank you.
1694349173
timmaugh
Forum Champion
API Scripter
Yes, sorry. That was an oversight on my part. When SelectManager got the ability to use criteria in its selecting, I used a regex statement that was too permissive for identifying marker criteria... too permissive because it caught token IDs as if they were token markers. I have already put a fix in the code. It's in the 1-click merge queue for this week (which should come Tuesday), or if you need it before then, you can get it from my repo . Sorry, again!
Thanks for the quick turnaround on that. Appreciate it.
So testing out the new 1.1.1 code, one thing that used to work under 1.0.13 is that I could pass in a comma separated list of token ids and it would select them all. Under 1.1.1, it seems to only select the last token I pass in in the list. Is that expected? Was selecting more than 1 token from a comma separated list previously a bug that I used as a feature?
1694363759
timmaugh
Forum Champion
API Scripter
No, that's definitely the way things should be working (passing a list). Each item of the comma separated list should be evaluated for whether it's a token or token set identifier vs a criteria. I had not noticed a list failing like this in my testing... I'll take a look and see if I can get this part restored, too.
1694439169
timmaugh
Forum Champion
API Scripter
So, I am unable to reproduce this... are you sure that the tokens for each of the IDs you're passing are on the current page you're viewing (or on the page the executor of the command is viewing)? Can you share your command line? Also, can you try this and see what result you get (requires SelectManager, Fetch, and ZeroFrame)... Using the list of multiple IDs from your command line, put them in this command: !forselected(^) My name is @^(selected.token_name){^&simple} {&select -NVoeujpjAoEFTBaVUzy, -N9krK2uorWlh5ONFFx_, -NUWg-iV2ZnRcWRhHUPy} (replace the token IDs in that {&select} tag with yours) Run that and report what you find. You should get something like this, with one line reporting for each token you provide (as long as they are on the page you're viewing, and you don't supply other criteria that might eliminate them from the set of selected tokens):
Oh this one was my bad. In my token id list I was adding a space instead of just a comma. I don't remember why I added a space there instead of just using the comma separation cause it seems to work on the older SelectManager as well with just the comma and no whitespace. Anyway thanks for your help on this. Sorry for the detour into unexplained whitespace but everything is working with 1.1.1 as I'd expect now. Side note, I never did get any output from the !forselected test and not sure why. My guess is that it is using some of the other Meta toolbox script that I don't have enabled in my games.
1694448004
timmaugh
Forum Champion
API Scripter
Yeah, that one required Fetch, ZeroFrame, and SelectManager. They're all a part of the MetaScriptToolbox script (also available from 1-click), but if you don't have one of them, you'll either get no output (with no ZeroFrame) or bad output (no Fetch). Glad it's working, though!
Hey timmaugh, sorry to necro this thread but I seem to be having another problem with the latest 2 versions of SelectManager. Everything works with versions 1.1.1 and 1.1.2 but 1.1.3 and 1.1.4 seem to have a regression for me. SelectManager doesn't seem to work with a single token id or with a comma separated list of token ids with those latest 2 versions. Here is a ScriptCard that will reproduce the issue: !scriptcard {{ --/|Requires: SC 2.1.8+, SelectManager, 5E Resting in Style --#title|SelectManager Repro --#reentrant|gmrestcard --:GetPlayerTokens| --~TokenCount|array;pagetokens;RestTokenArr;[*C:playerpageid];pc --?[&TokenCount] -eq 0|ErrMsg --:DisplayPlayerRestButtons| --~RestTIDList|array;stringify;RestTokenArr;, --%PCTID|foreach;RestTokenArr --+[*[&PCTID]:t-name]|[r][rbutton]SR::PlayerShortRest;[&PCTID][/rbutton] [rbutton]LR::PlayerLongRest;[&PCTID][/rbutton][/r] --%| --+All Players|[rbutton]SR::PlayerShortRest;[&RestTIDList][/rbutton] [rbutton]LR::PlayerLongRest;[&RestTIDList][/rbutton] --X| --:PlayerLongRest|TokenID --@long-rest|{^& select [&reentryval] } -->Done| --:PlayerShortRest|TokenID --@short-rest|{^& select [&reentryval] } -->Done| --:ErrMsg| --#emoteText|No Tokens Found --+ERROR|No Player Tokens were found on player page -->Done| --:Done| }} I can also reproduce it with your Fetch and ZeroFrame example you posted but with a token id returned from @{selected|token_id} !forselected(^) My name is @^(selected.token_name){^&simple} {&select -Md-kakJq5RmONcC58O4} That line returns an error: No selected tokens to use for that command. Please select some tokens then try again. I didn't see any threads reporting this issue however. Also is there a better thread to post this type of issue? The 2 SelectManager threads I saw both seemed to be closed. Thanks for any help you can provide with debugging this.
1695905955
timmaugh
Forum Champion
API Scripter
OK, sorry about that. It has been a delicate push/pull of functionality since the criteria component of selections got introduced... a little tug in this direction exposed a bug in that direction, etc. I decided to use a more brute-force approach to address the whole situation, so I believe I have this finally settled. You'll want v1.1.5, which is in the queue for next week's merge, but is also available in my repo , if you need it more immediately. As for how to report bugs, the threads aren't consistently active enough to keep them alive, so feel free to open a new thread if you run into new issues and I'll do my best to get them sorted for you!
Tested with 1.1.5 and it works. Thanks for the really rapid fix.