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

Speeding up Sheet Upgrades??

1547037555
Finderski
Pro
Sheet Author
Compendium Curator
I have a sheet worker to upgrade a sheet...I needed to create a bunch of new fields and the such and when an existing sheet is upgraded, I usually have to open the sheet, close the sheet and wait a few minutes before all the updates are recognized on the sheet...meaning if I don't do that, I get a bunch of errors spewing out in the chat window. I've sometimes had to close the sheet and exit the game for everything to not produce the errors... Are there any tricks I might be missing to refresh the sheet after the upgrade is complete?
1547047153
Natha
KS Backer
Sheet Author
API Scripter
Do you have on("change:") trigger events for these attributes that could be fired in cascading way? If you didn't manage carefully when to do silent or not silent setAttrs in your update function(s), the cascading effect(s) can turn into a long update time, or worse, infinite loops. I would check that first, I think.
1547050984
Finderski
Pro
Sheet Author
Compendium Curator
There are on("change...") trigger events.  How do I fire things in a cascading way?
1547051656

Edited 1547051739
Natha
KS Backer
Sheet Author
API Scripter
Doing a setAttrs({myattribute: a_value}) in a sheet worker function will trigger any on("change:myattribute", ...) event. If you want to modify myattribute without triggering the on("change:...") event, you have to do a silent setAttrs: setAttrs({myattribute: a_value}, {silent: true}); Cf.&nbsp; <a href="https://wiki.roll20.net/Sheet_Worker_Scripts#setAttrs.28values.2Coptions.2Ccallback.29_.5BAsynchronous.5D" rel="nofollow">https://wiki.roll20.net/Sheet_Worker_Scripts#setAttrs.28values.2Coptions.2Ccallback.29_.5BAsynchronous.5D</a>
1547090675
GiGs
Pro
Sheet Author
API Scripter
Of course if you are relying on the on:change &nbsp;events to do your updating, using silent will likely cause you problems. But it's better not to rely on those events to do the upgrade, and using silent is best. It's more work to program all the updates within the upgrade script, but your upgrade will go smoother and much faster.