cscase
August 18th, 2013, 01:32
Hey all,
I am really stumped on this one. Quick summary of the bug:
I am creating a windowlist that makes entries on a list of skills. All is well up to this point.
One of the skills is actually health, which is the character's HP, so I want that skill's value to show up in a HP box elsewhere on the sheet. So, I created a box for HP like this:
<numberfield name="hp" source=".skills.Health.pool">
Now, when I create a new character and open the sheet, I see Health listed as a skill twice. If I hit reload, everything's fine after that. So this only happens on a new character.
When the new character sheet is opened, the first thing that happens (I know this via debug messages I set up) is that the windowlist with skills is populated, by this code:
for k, t in pairs(skilldata) do
local matches = winlist[k];
if not matches then
Debug.chat('creating skill window '..k);
local newwin = createWindow("."..k);
newwin.label.setValue(k);
newwin.rating.setValue(t.rating);
newwin.pool.setValue(t.rating);
matches = { newwin };
end
end
This lists each one of the skills being created, and it only shows Health showing up ONE time.
After that, the HP box I mentioned above is initialized.
On the skill list, I have Health showing up TWO times. Reloading the ruleset makes the duplicate entry disappear. If I take away the source part on the HP box, the problem does not occur. So, my debug code is only showing me that I'm running a single createwindow for health, yet it's showing up twice, and somehow the source parameter for that HP box is making this happen. Is this a bug with my code or with FG? Any ideas?
edit: Also, I should add, I'm assigning health an initial value of 1, so that it doesn't start off as null. I read something in another thread that suggested that might help, but so far no love.
I am really stumped on this one. Quick summary of the bug:
I am creating a windowlist that makes entries on a list of skills. All is well up to this point.
One of the skills is actually health, which is the character's HP, so I want that skill's value to show up in a HP box elsewhere on the sheet. So, I created a box for HP like this:
<numberfield name="hp" source=".skills.Health.pool">
Now, when I create a new character and open the sheet, I see Health listed as a skill twice. If I hit reload, everything's fine after that. So this only happens on a new character.
When the new character sheet is opened, the first thing that happens (I know this via debug messages I set up) is that the windowlist with skills is populated, by this code:
for k, t in pairs(skilldata) do
local matches = winlist[k];
if not matches then
Debug.chat('creating skill window '..k);
local newwin = createWindow("."..k);
newwin.label.setValue(k);
newwin.rating.setValue(t.rating);
newwin.pool.setValue(t.rating);
matches = { newwin };
end
end
This lists each one of the skills being created, and it only shows Health showing up ONE time.
After that, the HP box I mentioned above is initialized.
On the skill list, I have Health showing up TWO times. Reloading the ruleset makes the duplicate entry disappear. If I take away the source part on the HP box, the problem does not occur. So, my debug code is only showing me that I'm running a single createwindow for health, yet it's showing up twice, and somehow the source parameter for that HP box is making this happen. Is this a bug with my code or with FG? Any ideas?
edit: Also, I should add, I'm assigning health an initial value of 1, so that it doesn't start off as null. I read something in another thread that suggested that might help, but so far no love.