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

LazyExperience Script - Disable All Active Characters

1555305124

Edited 1555305315
Loren the GM
Pro
Marketplace Creator
I am looking to use Robin's LazyExperience script ( <a href="https://github.com/RobinKuiper/Roll20APIScripts/tree/master/LazyExperience" rel="nofollow">https://github.com/RobinKuiper/Roll20APIScripts/tree/master/LazyExperience</a> )&nbsp;in a campaign, but have run into a frustrating situation. I am using this addon&nbsp; <a href="https://marketplace.roll20.net/browse/gameaddon/460/area-of-effect-template-pack" rel="nofollow">https://marketplace.roll20.net/browse/gameaddon/460/area-of-effect-template-pack</a> &nbsp;of AoE Templates. Each one is assigned to both be in All Players journal and be Edited/Controlled by all players. Because of this, when I load up LazyExperience for the first time, there are nearly 2000 characters who are splitting XP between the 6 players in my game. Every one of the the area of effect templates is considered a character controlled by each player. (Note the 1559 number in the screenshot - I have manually adjusted Terry C.'s list of characters as outlined below). Now, it is possible to go into each player and toggle the Active switch on every character they control to off. That is something like 2000 clicks and generates a ridiculous chat log that quickly bogs down the game (which is already a very big campaign - Mad Mage).&nbsp; So I'm looking for a way to mass toggle this off for all the players, because it would be very easy to go back in and toggle 1 character back on after mass disabling all of them. I know this functionality doesn't exist in the script currently, but I was hoping someone might be able to look at the code and figure out an easy way to do this. I am unfortunately not a coder, so this is well beyond my means of solving. Many thanks in advance!
1555346349
GiGs
Pro
Sheet Author
API Scripter
I am not familiar with that script, but if the toggle is an attribute on a character, you can use chatsetattr to toggle it off for all of them in one fell swoop. With it installed, something like !setattr --all --attributename|newvalue Make a copy of your campaign first to make sure you dont bork things by making a typo. Replace attributename and newvalue above with the proper values.
1555349109
Loren the GM
Pro
Marketplace Creator
Unfortunately this isn't a sheet attribute issue, but about setting a state within the script to true/false.
1555355067
GiGs
Pro
Sheet Author
API Scripter
Ah, so it sounds like a fix might be to have a script that goes through all the playerids in the lazyexperience state, and deletes any that dont match your player characters (through a whitelist of their names probably). That doesnt sound too hard, I'll whip up something later if no-one does it in the meantime. A better solution would be to put in a fix for lazyexperience directly, so that it only builds its list from whitelisted characters. i'll have a look and see if that's easy to add when i have time.
1555357020
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It's probably also a bad idea to set the tokens up as characters. 2000 additional characters in your game can lead to slowdown and lag. You could set them up as just tokens with permissions given to all characters, but you would probably need to keep them all on one map and copy and paste them as needed. You could delete all the characters, download the graphic set and upload them to your own library. Then you could set them up into one character with a multi-sided token. You could then control the face and size using token-mod and maybe a chat menu. That's the method I use in this post and&nbsp; this video .
1555357732

Edited 1555357835
GiGs
Pro
Sheet Author
API Scripter
Yes, thats a good point. Much better to have them not as characters in the first place. Do they really need to be set up that way? Setting up 2000 tokens as a multi-sided token sounds pretty complex. It'll be possible to do it with a script if they have a consistent naming scheme.
1555358135
GiGs
Pro
Sheet Author
API Scripter
You could also remove all the characters that have AoEs that you dont actually use in your game. Optionally, you also probably only need one of each shape, and can use token-mod to resize it as needed.
1555358624
Loren the GM
Pro
Marketplace Creator
If you install the add-on, it automatically sets up the 300-ish shapes to be controlled by all characters. It isn't 2000 characters, but that is how the script is parsing it, since it is considering each player and the sheets they control. I have not noticed any particular slowdown using this add-on, which I have used across a lot of campaigns at this point since the add-on was released. Looking at them, most of the sheets don't have any entries on Attributes &amp; Abilities, so there shouldn't be that much data to parse with each one.
1555371155
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hm. This might be insoluble without a change by either developer (loot script or AOE tokens). They might just be incompatible.
1555372008

Edited 1555372116
GiGs
Pro
Sheet Author
API Scripter
I think it's solvable with a bit of a hack. I think &nbsp; I've identified the function to edit (getPlayerCharacters), just need to work out a way to do it that is robust enough and doesnt have unexpected consequences. Do all the shapes names start with a number followed by ft (like 5ft 10ft etc) ? Can you list all the sizes (just the bit before ft, not the shape part)?
1555443980
Loren the GM
Pro
Marketplace Creator
They all start that way. The numbers are: 5 10 15 20 25 30 40 50 60 90 100 120 150 A few of them - walls - list as 10x10ft wall, rather than just 10ft. If you need the specifics on those I can provide it.
1555445623
GiGs
Pro
Sheet Author
API Scripter
yes, I'll need those. every variation of name that comes before the ft, so i can catch them all in the script.
1555447893
GiGs
Pro
Sheet Author
API Scripter
also do the names always have a space after the ft ?
1555459960
Loren the GM
Pro
Marketplace Creator
Yes, the format is either: 10ft radius or&nbsp; 10x10ft wall The walls come in the following options: 10x10 20x10 30x10 40x10 50x10 60x10 70x10 80x10 90x10 100x10 5x5 10x5 15x5 20x5 25x5 30x5 40x5 50x5 60x5 70x5 80x5 90x5 100x5
1555566150
GiGs
Pro
Sheet Author
API Scripter
I havent forgotten about this, but I havent been able to get the script to work, even before attempting to make any changes to it. What character sheet are you using?&nbsp;
1555600420
Loren the GM
Pro
Marketplace Creator
I’m using the Roll20 5e sheet.
1555607525
GiGs
Pro
Sheet Author
API Scripter
Maybe I'm not setting up correctly. Whenever I try to use lazy experience (default version from the one click installer, no edits), and try to add experience to a character, it crashes the sandbox (with an undefined error relating to characters). I'll explore later why it is happening, but it would help to know if there are gotchas during setup that aren't explained on the github that I may be skipping over? Was there something unintuitive you had to do while setting it up? I do actually have a fix that I think will work, and I have tested it to the point where it loads the correct characters correctly (I think), but I cant test it fully due to this issue.&nbsp;
1555616187
GiGs
Pro
Sheet Author
API Scripter
I've done some more testing, and found the script breaks for me every time I try to add experience through the Player Config screen. It doesnt break if I add experience through the screen you get to through the Reset Experience button. I haven't dug into the script to figure out why its happening.&nbsp; Note this is completely unrelated to any tweaks I've tried: this is with the base script, with new characters. Does it happen to anyone else? Maybe its something to do with the way I set up my test characters, but I cant see why that would be the case. I may as well as give my fix. It works whether you're hitting the error above or not. It's not related to it at all. I'll describe it in the next post.
1555616723
GiGs
Pro
Sheet Author
API Scripter
To use this fix (or more accurately, this hack :)), I assume you are using the latest LazyExperience, version number 0.1.13. I'll link the full edited script on gist below, but it's a tiny tweak so I'll describe it here too: Go to line 266, and insert this on the next line: &nbsp; &nbsp; &nbsp; &nbsp; // AOE TEMPLATE FIX START &nbsp; &nbsp; &nbsp; &nbsp; }).filter(character =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let name = character.get('name'); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (!name.match(/^([0-9]){1,3}ft +/g) &amp;&amp; !name.match(/^([0-9]){1,3}x([0-9]){1,3}ft +/g)); &nbsp; &nbsp; &nbsp; &nbsp; // AOE TEMPLATE FIX END So the getPlayerCharacters function looked like this before: &nbsp; &nbsp; getPlayerCharacters = (playerid) =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; return findObjs({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _type: 'character' &nbsp; &nbsp; &nbsp; &nbsp; }).filter(character =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let controlling = character.get('controlledby').split(','); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (controlling.includes(playerid) || controlling.includes('all')); &nbsp; &nbsp; &nbsp; &nbsp; }).map(character =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: character.get('name'), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id: character.get('id'), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; experience: 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; }, And now looks like &nbsp; &nbsp; getPlayerCharacters = (playerid) =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; return findObjs({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _type: 'character' &nbsp; &nbsp; &nbsp; &nbsp; // AOE TEMPLATE FIX START &nbsp; &nbsp; &nbsp; &nbsp; }).filter(character =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let name = character.get('name'); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (!name.match(/^([0-9]){1,3}ft +/g) &amp;&amp; !name.match(/^([0-9]){1,3}x([0-9]){1,3}ft +/g)); &nbsp; &nbsp; &nbsp; &nbsp; // AOE TEMPLATE FIX END &nbsp; &nbsp; &nbsp; &nbsp; }).filter(character =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let controlling = character.get('controlledby').split(','); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return (controlling.includes(playerid) || controlling.includes('all')); &nbsp; &nbsp; &nbsp; &nbsp; }).map(character =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: character.get('name'), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id: character.get('id'), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active: true, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; experience: 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; }, Now, in your campaign go to each player's config screen, and click Refresh Characters. It should remove the AoE effects characters and you're good to go. If Robin updates the script again, you'll need to find that function and make this edit. Here's the gist for the edited script: <a href="https://gist.github.com/G-G-G/42cdc1cf9e26081e16578ddd9a36fc11" rel="nofollow">https://gist.github.com/G-G-G/42cdc1cf9e26081e16578ddd9a36fc11</a>