This error applies to both setAttrs and getAttrs, and possibly other sheet worker functions, but those are the two I've encountered. At its root, it may be the same problem that Stephen L posted about 4 months ago: sheet worker - setAttrs callback doesn't work . Context: I am trying to write a utility function for sheet worker scripts which will calculate the value of an autocalc field, so that autocalc+sheet workers can play nicely together. I believe I have my utility function working correctly, or close to it, but making it useful appears impossible with this error. My function returns a Promise which, when resolved, provides an object similar to the callback parameter in getAttrs see usage: on('sheet:opened change:a change:b', function() {
getAttrs(['a', 'b'], function(values) {
var a = parseFloat(values.a);
var b = parseFloat(values.b); // @{c} === "@{a}**@{b}"
resolveAutocalc (['c']).then(function(values) { // c === Math.pow(a, b)
var c = values.c; // Character Sheet Error: Trying to do setAttrs when no character is active in sandbox.
setAttrs({
d: Math.round(Math.floor(c) * (a / b)) + Math.abs(a - b)
});
});
});
});
on('sheet:opened change:a change:b', function() { resolveAutocalc (['c']).then(function(values) {
var c = values.c; // Character Sheet Error: Trying to do getAttrs when no character is active in sandbox.
getAttrs(['a', 'b'], function(values) {
var a = parseFloat(values.a);
var b = parseFloat(values.b);
setAttrs({
d: Math.round(Math.floor(c) * (a / b)) + Math.abs(a - b)
});
});
});
}); The Promise code is not escaping the sheet worker sandbox ( window is still a DedicatedWorkerGlobalScope object), but it does seem to be getting detached from the character triggering the sheet worker event.