Myrddin
January 1st, 2016, 11:13
Happy New Year one and all!
I am having problems trying to program a windowlist to automatically delete entries once their values hit zero. My code for the windowclass is below. At the moment, FG crashes once I adjust the value of a wound entry to zero, presumably because I am creating an infinite loop with the if getValue() == 0 statement. Any pointers anyone?
<windowclass name="charsheet_woundlistitem">
<sizelimits>
<minimum>
<height>30</height>
<width>0</width>
</minimum>
</sizelimits>
<sheetdata>
<number_dropadd name="wound">
<droptypes>
<type merge="add">damage</type>
</droptypes>
<bounds>5,6,22,16</bounds>
<min>0</min>
<script>
local bProcessing = false;
function onValueChanged()
if bProcessing then
return;
end
bProcessing = true;
if getValue() == 0 then
window.getDatabaseNode().delete();
end
bProcessing = false;
end
</script>
</number_dropadd>
</sheetdata>
</windowclass>
I am having problems trying to program a windowlist to automatically delete entries once their values hit zero. My code for the windowclass is below. At the moment, FG crashes once I adjust the value of a wound entry to zero, presumably because I am creating an infinite loop with the if getValue() == 0 statement. Any pointers anyone?
<windowclass name="charsheet_woundlistitem">
<sizelimits>
<minimum>
<height>30</height>
<width>0</width>
</minimum>
</sizelimits>
<sheetdata>
<number_dropadd name="wound">
<droptypes>
<type merge="add">damage</type>
</droptypes>
<bounds>5,6,22,16</bounds>
<min>0</min>
<script>
local bProcessing = false;
function onValueChanged()
if bProcessing then
return;
end
bProcessing = true;
if getValue() == 0 then
window.getDatabaseNode().delete();
end
bProcessing = false;
end
</script>
</number_dropadd>
</sheetdata>
</windowclass>