I am trying to track down some very weird behavior on my character sheets. Specifically, the console log is consistently saying ReferenceError: Damage_max is not defined(…) When it most certainly should be defined - and in fact I can see the value in Attributes and Abilities. I am also finding that token values that I have linked to attributes will suddenly be blank. For example if bar 2 max is supposed to be a number around 40, the actual value will be blank. Anyway, I wrote some short test code to try to duplicate the behavior in a limited space, and came up with this. <input type="number" name="attr_a" value="5">
<input type="number" name="attr_a_max" value="10">
<br>
<input type="number" name="attr_b" value="15">
<input type="number" name="attr_b_max" value="110">
<br>
<input type="number" name="attr_c" value="25">
<input type="number" name="attr_c_max" value="210">
<!-- WORKERS -->
<script type="text/worker">
on("change:a", function() {
'use strict';
log("change a");
getAttrs([ "c", "c_max" ], function(values) {
'use strict';
log( values[ "c" ] + " and " + values[ "c_max"] );
setAttrs({ "b": values[ "c" ], "b_max": values[ "c_max"] });
});
}); // End on change wt-test1
</script>
It is a pretty useless screen, just 6 boxes that you can change at random. Whenever you change a or a_max, it copies whatever is in c and c_max into b and b_max. I have spent some very boring time just changing numbers. Sometimes I had some of the numbers linked to a tokens bars, but both times the problems occurred when the character sheet was not linked to a token. There seems to be no way to consistently reproduce the trouble. It is just random. I have tried every combination of ways to change these numbers that I can, and everything will work fine for sometimes very long stretches of time (20 minutes or more). But twice now this very simple program has gotten itself messed up. The first time I had been clicking the increment and decrement twirlers on the number boxes when I noticed it was not copying the numbers from c to b. The console log had a message which I stupidly did not write down, but it was something about max being no good (but it was not the message quoted above "c_max is not defined(…) ") In fact I seem to recall that it was not (something)_max at all, it said "max was (something)". (I know that this vagueness is pretty useless) Looking in the Attributes and Abilities, I noticed that c_max was blank. I had never set it to blank, I had always set it to an integer using only the increment and decrement twirlers. I deleted c in attributes and Abilites, and changed the values some more and the sheet created a new "c" and it was quickly working perfectly again. After a very long period of time I got it to mess up again, but in a totally different way. Suddenly the setAttribs stopped working. I still see the messages "changed a" and the values of c and c_max in the console log, but it has stopped updating b and b_max at all. Once again, the worker threads are still running, because I still see the console log. It is just very quietly not setting the new values. Anyway, I am about done bashing my head on this for the day and was hoping that somebody might offer some guidance. Thanks.