Closed johnlamping closed 1 year ago
I believe this issue is resolved now (or at least, I can't replicate the issue.) Can you screen shot an example if you see it?
I just reproduced it.
I created a new character, and their Dodge showed as Nan. I gave them an irrelevant skill, and Dodge was still Nan I then quit, and re-launched the game, and then they showed -7, like they should for having no training.
Maybe there is some sort of race between initializing something the Dodge computation needs and when it is run the very first time.
Testing now. I suspect that we need to add one more event listener related to create character.
Ahh, I see. This does appear to be a bit of an order of operations topic, and possibly a race condition.
The updateCopiedAbilities
function updates defend
, but not on sheet:opened
, whereas updateArmorValue
does.
I can easily fix the NaN
issue, but am also looking at how to address the order of operations/race condition.
https://wiki.roll20.net/Sheet_Worker_Scripts#setAttrs.28values.2Coptions.2Ccallback.29
When setAttrs
is called, I believe it doesn't trigger change
listeners. (Probably to protect from circular or infinite loops).
setAttrs
does have a callback
function, and I can use that to fix the issue. Testing now...
Also, I was slightly wrong above - both functions have sheet:opened
. One was just buried.
Fixed in #85
The code used to give the default ability of DX - 3 - 5 (With any Defense discipline added in).