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

Strange Issue with Matt's Doors Script + Bump

It seems that doors that have been linked and tokens that have been "bumped" sometimes forget they are linked after I exit roll20 (they work perfectly fine right after they are set up). I am not able to easily recreate this bug, but linked doors and bumped tokens will eventually stop working within a few hours. This is only an issue for recently created doors and bumped tokens. Bumped tokens and linked doors I set up a few weeks ago function normally. I started noticing this issue several days ago. This issue causes no errors in the&nbsp;API Output Console, and the scripts still run and work normally for freshly linked doors or bumped tokens, as well as doors I linked several weeks ago. I have tried restarting the API sandbox, but that does not fix anything Example for issue with Bump, since it is difficult for me to explain with words:&nbsp; GIF . When I try to use the !OpenDoor command on switches having this issue, the api output console writes "{}", which is the same message I get if I type that command while selecting something that isn't a linked switch for a door. The only error I get in the dev console in chrome seems to not be related to either script, but rather with an image of a shadow I found in the art library. This only happens when loading one of the pages it question, and does not happen in relation to the Doors/Bump. I will include it here in case it is relevant:&nbsp; Access to Image at '<a href="https://s3.amazonaws.com/files.d20.io/images/369927/dwsvAMUHTMuU7CakvsDOLA/thumb.png?135280991355555555" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/369927/dwsvAMUHTMuU7CakvsDOLA/thumb.png?135280991355555555</a>' from origin '<a href="https://app.roll20.net" rel="nofollow">https://app.roll20.net</a>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="https://app.roll20.net" rel="nofollow">https://app.roll20.net</a>' is therefore not allowed access. Scripts : Doors Script:&nbsp; Aaron's Updated Matt's Door Script . Bump: Latest version found in Script Library Other Scripts Used : 5th Edition OGL by Roll20 Companion, latest version found in script library Aaron's&nbsp; Map Lock , version&nbsp;0.4.4 Roll20 Audio Master:&nbsp;Latest version found in script library Torch:&nbsp;Latest version found in script library Aaron's&nbsp; Imperial Calendar , version 0.1.2 TokenMod:&nbsp;Latest version found in script library Keven's TokenAction Creator , version 0.2.4 I also use a small initiative script that I found on the forums a some time ago. I can't find the original link, but I think Aaron posted it as an example. on('ready',function(){ &nbsp; &nbsp; "use strict"; &nbsp; &nbsp; on('chat:message',function(msg){ &nbsp; &nbsp; &nbsp; &nbsp; var args,cmds,who,initial,change,entry; &nbsp; &nbsp; &nbsp; &nbsp; if('api' === msg.type && msg.content.match(/^!act\b/) && playerIsGM(msg.playerid) ){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(_.has(msg,'inlinerolls')){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg.content = _.chain(msg.inlinerolls) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .reduce(function(m,v,k){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var ti=_.reduce(v.results.rolls,function(m2,v2){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(_.has(v2,'table')){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m2.push(_.reduce(v2.results,function(m3,v3){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m3.push(v3.tableItem.name); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return m3; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },[]).join(', ')); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return m2; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },[]).join(', '); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m['$[['+k+']]']= (ti.length && ti) || v.results.total || 0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return m; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },{}) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .reduce(function(m,v,k){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return m.replace(k,v); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },msg.content) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .value(); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; args = msg.content &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .replace(/&lt;br\/&gt;\n/g, ' ') &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .replace(/(\{\{(.*?)\}\})/g," $2 ") &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .split(/\s+--/); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmds=args.shift().split(/\s+/); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; change=parseFloat(cmds[1])||'+1'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initial=parseFloat(cmds[2])||0; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; entry=args.join(' '); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(entry.length){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let to=JSON.parse(Campaign().get('turnorder'))||[]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to.unshift({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id: "-1", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pr: initial, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; custom: entry, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; formula: change &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Campaign().set('turnorder',JSON.stringify(to)); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; who=getObj('player',msg.playerid).get('_displayname'); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat('ACT',`/w "${who}" &lt;div style="padding:1px 3px;border: 1px solid #8B4513;background: #eeffee; color: #8B4513; font-size: 80%;"&gt;&lt;div style="background-color: #ffeeee;"&gt;Error: no entry name provided.&lt;/div&gt;&lt;/div&gt;`); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; }); }); I am including both of these issues in a single post as both scripts started exhibiting these issues at the same time. Let me know if there is any more information I can provide. (Btw, thank you for making + updating so many scripts, Aaron! They really improve my games)
1508164559
The Aaron
Pro
API Scripter
Can you install this little script, save it, and wait for the output "State Test: undefined" then save it again and see if you get "State Test: state is writeable" the second and subsequent times? on('ready',()=&gt;{ log(`State Test: ${state.test}`); state.test='state is writeable'; }); A working case should look like this in the API Console Log: "State Test: undefined" Restarting sandbox due to script changes... Previous shutdown complete, starting up... Spinning up new sandbox... "State Test: state is writeable" A failing case will look like this: "State Test: undefined" Restarting sandbox due to script changes... Previous shutdown complete, starting up... Spinning up new sandbox...&nbsp; "State Test: undefined" I suspect you're suffering from the state write bug.
I got&nbsp;"State Test: state is writeable" upon saving the above script.
1508173143
The Aaron
Pro
API Scripter
Oh!&nbsp; Well, that's good! This isn't the first time I've seen this issue.&nbsp; The Bump one has been plaguing my GM for months.&nbsp; The correlation to more recently bumped tokens is interesting.&nbsp; If you have that above situation still, I'd like to examine it and see if I can learn anything more, if you can PM me and invite and GM me.&nbsp; It looks like it's reverting to an older saved state, but it's hard to say, and will be even harder to track down if that's the case.
1508179354
The Aaron
Pro
API Scripter
Actually, it does look like you're hitting some kind of limit.&nbsp; I adjusted the above sample to set 'state is writeable--AAAAAAAAAAAAAAAAAAAAAAAAA', which turns out to be too long for it to save as an update.
1508181085
The Aaron
Pro
API Scripter
I think this is the transient state size bug.&nbsp; I've pinged it over to the Devs.
Thank you for looking into this -- hopefully it isn't anything too complicated to fix on the devs' end. Could this be something I might solve by deleting some doors/bumped tokens on unused maps?
1508259570
The Aaron
Pro
API Scripter
That could certainly alleviate the issue for the time being.&nbsp; I'd suggest doors, if you can.&nbsp; They take up a much greater part of your state: ShapedScripts:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Size: 0.002kb&nbsp; Percent: 0.0% roll20-logger:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Size: 0.022kb&nbsp; Percent: 0.0% FifthEditionOGLbyRoll20: Size: 0.085kb&nbsp; Percent: 0.1% TokenLock:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Size: 0.063kb&nbsp; Percent: 0.1% MapLock:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Size: 4.712kb&nbsp; Percent: 7.2% ItsATrap:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Size: 0.085kb&nbsp; Percent: 0.1% DoorControls:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Size: 30.644kb Percent: 47.1% Roll20AM:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Size: 10.830kb Percent: 16.6% Torch:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Size: 4.023kb&nbsp; Percent: 6.2% Bump:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Size: 7.250kb&nbsp; Percent: 11.1% ImperialCalendar:&nbsp; &nbsp; &nbsp; &nbsp; Size: 5.066kb&nbsp; Percent: 7.8% TokenMod:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Size: 0.139kb&nbsp; Percent: 0.2% PAGENAVIGATOR:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Size: 1.858kb&nbsp; Percent: 2.9% OneWayDynamicLighting:&nbsp; &nbsp;Size: 0.002kb&nbsp; Percent: 0.0% test:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Size: 0.046kb&nbsp; Percent: 0.1% RecursiveTable:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Size: 0.015kb&nbsp; Percent: 0.0% Total:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Size: 65.080kb Percent: 100.0% &nbsp;
I deleted a whole bunch of doors. That seems to have fixed it for the time being. I will try to remember to do that when I am done with a map from now on.
1508264708
The Aaron
Pro
API Scripter
I'll see if I can optimize that...
Just to clarify, then this issue with Bump is because of the size of the State? If that is correct, I just want to point out two things: Thank you for figuring that out!&nbsp; The Bump script was my most used script a year ago.&nbsp; But it has become so unreliable that I had to quit using it.&nbsp; :( I was right!&nbsp; In an old thread I said that you (Aaron) were trying to make enough scripts to fill the State.&nbsp; See:&nbsp;&nbsp; <a href="https://app.roll20.net/forum/post/4525803/script-imperialcalendar-fully-featured-calendar-for-traveller-stars-without-number-and-other-scifi-games-public-player-and-private-notes-calendar-and-journal-formats/?pageforid=4539701#post-4539701" rel="nofollow">https://app.roll20.net/forum/post/4525803/script-imperialcalendar-fully-featured-calendar-for-traveller-stars-without-number-and-other-scifi-games-public-player-and-private-notes-calendar-and-journal-formats/?pageforid=4539701#post-4539701</a>
1508291728
The Aaron
Pro
API Scripter
I can neither confirm nor deny....
Aaron, how did you get the state memory usage?&nbsp; I'd also like to know what I could cut out so I could start using Bump again. Thanks!
1508335353
The Aaron
Pro
API Scripter
You can throw this script in: on('ready',()=&gt;{ &nbsp; &nbsp; let size=JSON.stringify(state).length; &nbsp; &nbsp; Object.keys(state).forEach((k)=&gt;{ &nbsp; &nbsp; &nbsp; &nbsp; let ksize=JSON.stringify(state[k]).length; &nbsp; &nbsp; &nbsp; &nbsp; log(`${k}: Size: ${(ksize/1024).toFixed(3)}kb Percent: ${((ksize/size)*100).toFixed(1)}%`); &nbsp; &nbsp; }); &nbsp; &nbsp; log(`Total: Size: ${size}b Percent: 100.0%`); });
1508337781
Ziechael
Forum Champion
Sheet Author
API Scripter
Neat tool, turns out doors is a large part of my state as well... but overall it was smaller than I thought it would be for a nearly 3 yr old game :)
Running the provided script, I'm at&nbsp;"Total: Size: 65522b Percent: 100.0%".&nbsp; And my recent Bumps also do not work.&nbsp; So 65k seems to be the state ceiling.&nbsp; (Which makes sense). So now I guess I need to look into storing data some other way as I have a weather script that takes up roughly 35k of data in state.
1508348211
The Aaron
Pro
API Scripter
Three of Swords said: So 65k seems to be the state ceiling.&nbsp;
Thank you for that script to keep track of state memory usage! I am certain now that all the issues were caused by having too many linked doors. Everything works again after unlinking ~50 or so old, unused doors. I am down to 51k used. Very glad to have bump working normally again -- I think it is my most important script in my library. I hope roll20 might consider upping the state ceiling some time in the future (but I have no idea if it is a technical limitation or how difficult that would be to increase. I know nothing about javascript)
1509470862
The Aaron
Pro
API Scripter
Tony, you shouldn't have a problem with copious doors now...
Is there an updated Doors script I should add, or was the&nbsp;state ceiling changed? Either way, thanks for the help
1509473238
The Aaron
Pro
API Scripter
State ceiling was increased from 65k to 2048k, will be in the corner announcement end of the week.
Good and bad news for me. Good news for the future.&nbsp; Bad news cuz I spent hours rewriting my weather script not to use the State.&nbsp; :)
The Aaron said: State ceiling was increased from 65k to 2048k, will be in the corner announcement end of the week. That is excellent news!
1509479692
The Aaron
Pro
API Scripter
Yeah, I may have put some time into rewriting Matt's door script for the same reason...&nbsp; On the plus side, there are some good benefits to not using the state if you do it right.&nbsp; I was looking into creating a character to represent Matt's Door script, then using attributes to store configuration data.&nbsp; The benefit is that then you could move configurations between games by moving that character.&nbsp; You could even move between games that you didn't create a you could use the Character Vault.&nbsp; The complicated bit comes in linking up to things in game without using IDs which wouldn't (shouldn't) be the same.&nbsp; There's ways around that, but yeah.. complicated. =D