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

Aura/Tint HealthColors script does not work in copy of game

1597855239

Edited 1597856919
To run an epic i created a copies of a game. In the original game the Aura/Tint HealthColors script works, but in the copy it yields below error message. Is this a result of UDL? Is there an alternative? We only use it to display the health aura. TypeError: Cannot read property 'auraColorOn' of undefined TypeError: Cannot read property 'auraColorOn' of undefined at handleToken (apiscript.js:19:35) at apiscript.js:324:24 at Function.each (/home/node/d20-api-server/node_modules/underscore/underscore.js:188:9) at apiscript.js:322:22 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1055:14) at updateLocalCache (/home/node/d20-api-server/api.js:1345:18) at /home/node/d20-api-server/api.js:1519:11 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560
Stupid questions: Have you installed the API script in the new campaign? Have you installed the API script to the match the current character sheet?  Whatever you did in the first game needs to be repeated in the new game.  This includes any changes to the default token settings.   Has there been any changes in the attributes of the sheet in the copy of the game?  This might affect this API, but I don't know I don't know anything about API, but these are mistakes I have made in the past using API
1597928421

Edited 1597929165
Have you installed the API script in the new campaign? yes Have you installed the API script to the match the current character sheet?  yes Whatever you did in the first game needs to be repeated in the new game.  This includes any changes to the default token settings.    yes Has there been any changes in the attributes of the sheet in the copy of the game?  This  might  affect this API, but I don't know  No the copy was made and the api was added. Just like the other times we did this procedure 30 minutes before start of play. Anyway... today i am not in a hurry and will perform some debugging
Did some debugging and i guess copying a game loses the state  but somehow the API script decides to handle events before checking whether the state is installed properly. Solve it with an extra check in the script that sets the default state if the state is undefined.  The fact that copying games loses API state is of course something i find in multiple forum posts after debugging and knowing what to look for ... How can i update the github for this script?
1597940176
The Aaron
Roll20 Production Team
API Scripter
You'd need to fork the Roll20 repo, update the version number of the script in a new folder named for the version, update the script.json to indicate the new version number and add the current version to the previous versions list, then send a Pull Request to Roll20's repo.
1597957902

Edited 1597959437
Thanks for the swift reply. It's one big shared repo, that's easy... been accustomed to too many enterprise gating controls. The state is created in CheckInstall. In the ready event, CheckInstall  is called before event handlers are registered. on('ready', function () { 'use strict'; HealthColors.GMW("API READY"); HealthColors.CheckInstall(); HealthColors.RegisterEventHandlers(); }); But somehow events are fired before the state is set in CheckInstall. Previous shutdown complete, starting up... Spinning up new sandbox... "Starting webworker script..." "Loading 711 translation strings to worker..." "HealthColors handleToken -MF67MmCV3kKvKhb5qpv" << this is logging in handleToken (added for debugging) "HealthColors handleToken -MF67MmCV3kKvKhb5qpv" << this is logging in handleToken "-=>HealthColors v1.6.1 debug [Updated: Feb 12 2019]<=-" << this is logging in CheckInstall that should happen first
It's even more strange to me. If a logging statement is added at the top of the on'ready' function, handleToken is even logged before that. Anyhow a pull request has been made for the fix. Spinning up new sandbox... "Starting webworker script..." "Loading 711 translation strings to worker..." "HealthColors handleToken -MF67MmCV3kKvKhb5qpv" "HealthColors handleToken -MF67MmCV3kKvKhb5qpv" " ready " "-=>HealthColors v1.6.1 debug [Updated: Feb 12 2019]<=-"
1598373992

Edited 1598374303
Here's a weirdness.  I was checking on the status of this API script because I noticed that the script wasn't working in my game, and though it's supposed to be using 1.6.1, it's only using 1.6.0.  Even when I force it to use the most up-to-date version.  And, the script still doesn't appear to be working. I stand corrected, it appears to be working and reports in game that it is version 1.6.0.  That said, it's working so I guess I'm good.  Just curious at this point why I think the version is set to 1.6.1, and it reports in game that it is version 1.6.0.
1598374955
The Aaron
Roll20 Production Team
API Scripter
Should be fixed now, just restart your sandbox and you should get the 1.6.1 version.
The Aaron said: Should be fixed now, just restart your sandbox and you should get the 1.6.1 version. Thanks!  Works perfectly!