Varsuuk
January 27th, 2020, 02:03
I have a question, I won't be at the point of editing the values in this sheet for a bit and I wanted to adjust to get it as close to right as possible the first time.
My idea is that if either ANYTHING within the <attacks> list changes, like if we add <claw> ... </claw> or the name subentry of <bite> changes or damage changes etc, that the "updateAttacks_text()" method would be called and I could recreate the string.
But I am not sure, in the past for my character sheet, I did things like this:
DB.addHandler(DB.getPath(nodeChar, "abilities.*.baseracemod"), "onUpdate", updateAbilityScore);
DB.addHandler(DB.getPath(nodeChar, "abilities.*.baseautomod"), "onUpdate", updateAbilityScore);
DB.addHandler(DB.getPath(nodeChar, "abilities.*.score"), "onUpdate", updateAbilityScoreDependencies);
But the difference here is I was wildcarding the stat but the end fields were pre-known. In the new thing, I just listed the parent node and did * assuming "any changes below" but I do not know if that is ACTUALLY what it means to do that.
In this lua file I did:
DB.addHandler(DB.getPath(nodeChar, "attacks.*"), "onUpdate", updateAttacks_text);
For example, a single attack type list:
<attacks>
<bite>
<name type="string">Bite</name>
<damage type="string">1d6</damage>
<numberOfAttacks type="number">1</numberOfAttacks>
</bite>
</attacks>
Why would I need to handle in order to get all updates both below <attacks> (ie, adding or removing entries) and inside a specific entry like <bite>'s subfields?
Do I need instead a more verbose?:
DB.addHandler(DB.getPath(nodeChar, "attacks.*"), "onUpdate", updateAttacks_text);
DB.addHandler(DB.getPath(nodeChar, "attacks.*.name"), "onUpdate", updateAttacks_text);
DB.addHandler(DB.getPath(nodeChar, "attacks.*. damage"), "onUpdate", updateAttacks_text);
DB.addHandler(DB.getPath(nodeChar, "attacks.*. numberOfAttacks"), "onUpdate", updateAttacks_text);
or even THIS?
DB.removeHandler(DB.getPath(nodeChar, "attacks.*"), "onUpdate", updateAttacks_text);
DB.removeHandler(DB.getPath(nodeChar, "attacks.*.*"), "onUpdate", updateAttacks_text);
DB.removeHandler(DB.getPath(nodeChar, "specialabilities.*"), "onUpdate", updateSpecialAbilities);
DB.removeHandler(DB.getPath(nodeChar, "specialabilities.*.name"), "onUpdate", updateSpecialAbilities);
My idea is that if either ANYTHING within the <attacks> list changes, like if we add <claw> ... </claw> or the name subentry of <bite> changes or damage changes etc, that the "updateAttacks_text()" method would be called and I could recreate the string.
But I am not sure, in the past for my character sheet, I did things like this:
DB.addHandler(DB.getPath(nodeChar, "abilities.*.baseracemod"), "onUpdate", updateAbilityScore);
DB.addHandler(DB.getPath(nodeChar, "abilities.*.baseautomod"), "onUpdate", updateAbilityScore);
DB.addHandler(DB.getPath(nodeChar, "abilities.*.score"), "onUpdate", updateAbilityScoreDependencies);
But the difference here is I was wildcarding the stat but the end fields were pre-known. In the new thing, I just listed the parent node and did * assuming "any changes below" but I do not know if that is ACTUALLY what it means to do that.
In this lua file I did:
DB.addHandler(DB.getPath(nodeChar, "attacks.*"), "onUpdate", updateAttacks_text);
For example, a single attack type list:
<attacks>
<bite>
<name type="string">Bite</name>
<damage type="string">1d6</damage>
<numberOfAttacks type="number">1</numberOfAttacks>
</bite>
</attacks>
Why would I need to handle in order to get all updates both below <attacks> (ie, adding or removing entries) and inside a specific entry like <bite>'s subfields?
Do I need instead a more verbose?:
DB.addHandler(DB.getPath(nodeChar, "attacks.*"), "onUpdate", updateAttacks_text);
DB.addHandler(DB.getPath(nodeChar, "attacks.*.name"), "onUpdate", updateAttacks_text);
DB.addHandler(DB.getPath(nodeChar, "attacks.*. damage"), "onUpdate", updateAttacks_text);
DB.addHandler(DB.getPath(nodeChar, "attacks.*. numberOfAttacks"), "onUpdate", updateAttacks_text);
or even THIS?
DB.removeHandler(DB.getPath(nodeChar, "attacks.*"), "onUpdate", updateAttacks_text);
DB.removeHandler(DB.getPath(nodeChar, "attacks.*.*"), "onUpdate", updateAttacks_text);
DB.removeHandler(DB.getPath(nodeChar, "specialabilities.*"), "onUpdate", updateSpecialAbilities);
DB.removeHandler(DB.getPath(nodeChar, "specialabilities.*.name"), "onUpdate", updateSpecialAbilities);