ianmward
March 29th, 2016, 08:28
Hi,
I have a problem with a ruleset layered on CoreRPG where I define a custom tag and FG is only remembering the last instance of the tag instead of creating an array of values.
I am probably doing something wrong, please tell me what.
This is a fragment of my XML:
<basicnumber name="strength" source="abilities.strength">
<anchored to="abilityframe" position="insidetopleft" offset="60,20" width="30" height="25"/>
<anchored width="30" height="25" />
<script>
function onInit()
onValueChanged();
end
function onValueChanged()
Debug.console("onValueChanged: ", derivedcontrol,getDatabaseNode(), self);
for _,v in pairs(derivedcontrol) do
window[v].update(getDatabaseNode());
end
end
</script>
<derivedcontrol>strength_half</derivedcontrol>
<derivedcontrol>strength_fifth</derivedcontrol>
</basicnumber>
What I see in the Console is:
Runtime Notice: s'onValueChanged: ' | { #1 = s'strength_fifth' } | databasenode = { charsheet.id-00001.abilities.strength } | numbercontrol = { value = #85, x,y,w,h = 70,20,30,25 }
So you see that the derivedcontrol tag is being seen but only the last instance is remembered.
Is there a way to make it create an array of values or do I need to think of a better way to do this?
Cheers
Ian
I have a problem with a ruleset layered on CoreRPG where I define a custom tag and FG is only remembering the last instance of the tag instead of creating an array of values.
I am probably doing something wrong, please tell me what.
This is a fragment of my XML:
<basicnumber name="strength" source="abilities.strength">
<anchored to="abilityframe" position="insidetopleft" offset="60,20" width="30" height="25"/>
<anchored width="30" height="25" />
<script>
function onInit()
onValueChanged();
end
function onValueChanged()
Debug.console("onValueChanged: ", derivedcontrol,getDatabaseNode(), self);
for _,v in pairs(derivedcontrol) do
window[v].update(getDatabaseNode());
end
end
</script>
<derivedcontrol>strength_half</derivedcontrol>
<derivedcontrol>strength_fifth</derivedcontrol>
</basicnumber>
What I see in the Console is:
Runtime Notice: s'onValueChanged: ' | { #1 = s'strength_fifth' } | databasenode = { charsheet.id-00001.abilities.strength } | numbercontrol = { value = #85, x,y,w,h = 70,20,30,25 }
So you see that the derivedcontrol tag is being seen but only the last instance is remembered.
Is there a way to make it create an array of values or do I need to think of a better way to do this?
Cheers
Ian