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

Lag on characther sheet

Every time i associate a token with an specific characther and then open his sheet, the game enter in a lag state, everything runs pretty slow and only come back to normal after 2-3 minutes.
1678773131
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Mestrinhu! Some more information might be helpful in pinpointing a cause: Are you using a VPN? Have you tried turning off autofill and autocomplete in your browser? Are you running any extensions that affect the behavior of Roll20: Beyond20, VTTES, that sort of thing? Does the performance hit also happen in a private browsing window? Are you running on a desktop computer or a mobile device? Are you using either Chrome or Firefox (the supported browsers)? What sheet are you using? Any of these questions might help narrow down the source of the lag.
1678811012
GiGs
Pro
Sheet Author
API Scripter
To add to Keith's suggestions, does this only happen when a character sheet is opened? If so, have a look at the character sheet code and see if a lot of sheet workers are using sheet:opened . Chances are a lot of those can be removed.
1678811701
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ah, I did not check the forum this was under. Is this a sheet you are developing, Mestrinhu? If so, GiGs' advice is probably orders of magnitude better than mine.
1678821105
GiGs
Pro
Sheet Author
API Scripter
Thank you, Keith. I'd also see if there are any loops involved the asynchronous functions (getAttrs, setAttrs, getSectionIDs) - if they are being triggered by sheet:opened, getting rid of sheet:opened will help a lot, but there is still an efficiency problem there that could cause lag when the sheets are in use.
Does this happen to any sheet or a specific one?  I know that one of the sheets I wrote (Mythras) has this issue, and it can lead to problems getting the player assignment to stick.  I'm not entirely sure what causes it but I see javascript errors show up in the console when a player is initially assigned, but I'm not aware of any sheet workers that get triggered on player assignment alone and the errors themselves weren't too useful.  Either way this seems to help with the my sheet's issues: 1) Switch to Firefox (or maybe just a non-default browser).  My users have reported that normally clears up the lag issues. 2) If you are seeing the same player assignment issues this works for us: -  Add a new character - Open the character and click Edit  - Assign Players to the character and click Save - The sheet will close, reopen it from the journal and click Edit again - Click Save again - Refresh the page to reload the game and see if the assignment stuck If it is my Mythras sheet you are using I have been working on a complete re-write which doesn't seem to have this issue and will hopefully be finished in the next month or two.
1679338212
GiGs
Pro
Sheet Author
API Scripter
Matt Carpenter said: If it is my Mythras sheet you are using I have been working on a complete re-write which doesn't seem to have this issue and will hopefully be finished in the next month or two. What in your old sheet triggers this problem, and what are you doing in the new sheet to avoid it?
I have no clue what causes it in the old sheet.&nbsp; As far as I can tell there is not a way to setup an on("assignment:player") or anything like that so I'm not even sure why sheet workers are running when a player is assigned.&nbsp; The error I see in the console is: VM3510:3 Uncaught TypeError: Cannot read properties of undefined (reading 'toString') at Function.jqotenc (vtt.bundle.js:25026:51429) at X.eval (eval at jqotec (vtt.bundle.js:25026:51096), &lt;anonymous&gt;:3:407) at HTMLScriptElement.&lt;anonymous&gt; (vtt.bundle.js:25026:49504) at Function.each (jquery-1.9.1.js:648:23) at jQuery.fn.init.each (jquery-1.9.1.js:270:17) at jQuery.fn.init.jqote (vtt.bundle.js:25026:49436) at X.render (vtt.bundle.js:41161:57189) at vtt.bundle.js:41161:59673 at Array.forEach (&lt;anonymous&gt;) at I.each.I.forEach (vtt.bundle.js:24180:7324) From previous debugging I think that can come up if you try to set a value to undefined in setAttrs but I haven't invested a lot of time into figuring it out since the new version I'm working on already appears to be free of the bug. As for why the new version works better I am also not sure, but a big focus for my re-write was to improve performance and simplify the sheet so I made sure not to cause a chain of triggers by changing a value in sheetworkers which trigger more sheet workers for example.&nbsp; I also consolidated a ton of repeating fieldsets and attributes.&nbsp; I was still pretty new to javascript when I last updated the published sheet.&nbsp; I have hopefully improved since then and hope the code is just objectively better on a number of levels. If anyone is curious to take a deep dive the current Mythras sheet code is here: <a href="https://github.com/Roll20/roll20-character-sheets/tree/master/Mythras" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/tree/master/Mythras</a> and the new code so far is here: <a href="https://github.com/DigitalPagan/Mythras-Roll20-Sheet/tree/v4/Mythras" rel="nofollow">https://github.com/DigitalPagan/Mythras-Roll20-Sheet/tree/v4/Mythras</a>