PDA

View Full Version : Sub-skills lost after reloading ruleset



Ikael
February 16th, 2008, 18:38
Hello, my current problem with home-brew ruleset:

I made the skill list where each listitem has label (skill name) and level (skill ranking). New skill instances can be made, but also by pressing enter on skill label control a new sub-skill is created below the main skill. For example having Guns skill you can have sub-skills Handgun and Shotgun, I believe you got the point. It look something like this:

Guns....................2
Handgun......4
Shotgun......4

My problem is that when I reload the ruleset or reboot the program all the subskills are (lost) changed to main labels and have main skill name.
The example above would have changed to following after reboot:

Guns....................2
Guns....................4
Guns....................4

How to make subskills remain after the reboot?


Skill List:



<!-- SKILL LIST ITEM ************************************* -->
<windowclass name="charsheet_skilllistitemi">
<sizelimits>
<minimum>
<height>18</height>
</minimum>
</sizelimits>
<script file="scripts/charsheet_skilllistitem.lua" />
<sheetdata>

<!-- LABEL -->
<stringfield name="label">
<anchored>
<left>
<anchor>left</anchor>
<offset>7</offset>
</left>
<top>
<anchor>top</anchor>
<offset>5</offset>
</top>
<size>
<width>105</width>
</size>
</anchored>
<font>sheetlabelsmall</font>
<frame>
<name>textline</name>
<offset>0,5,0,0</offset>
</frame>
<script>
function onEnter()
-- one label can have multiple sublabels (sub-skills)
window.windowlist.addNewInstance(window.label.getV alue(), window.level.getValue());
end
</script>
</stringfield>

<!-- SUBLABEL -->
<stringfield name="sublabel">
<anchored>
<left>
<parent>label</parent>
<anchor>left</anchor>
<offset>15</offset>
</left>
<right>
<parent>label</parent>
<anchor>left</anchor>
<offset>105</offset>
</right>
<top>
<parent>label</parent>
<anchor>bottom</anchor>
<offset>0</offset>
</top>
<size>
<height>15</height>
</size>
</anchored>
<invisible />
<font>sheetlabelsmall</font>
<frame>
<name>textline</name>
<offset>0,5,0,0</offset>
</frame>
</stringfield>

<!-- LEVEL -->
<numberfield name="level">
<anchored>
<to>label</to>
<position>insidetopleft</position>
<offset>115,-3</offset>
<size>
<width>21</width>
<height>14</height>
</size>
</anchored>
<frame>
<name>modifier</name>
<offset>5,5,5,5</offset>
</frame>
<keyeditframe>
<name>rowshade</name>
<offset>1,1,1,1</offset>
</keyeditframe>
<stateframe>
<drophilight>
<name>rowshade</name>
<offset>1,1,1,1</offset>
</drophilight>
</stateframe>
<droptypes>
<type>number</type>
</droptypes>
<font>sheetnumbersmall</font>
<hideonvalue>0</hideonvalue>
<noreset />
<nodrop />
<script>
function onDrag(button, x, y, dragData)

if window.label.isVisible() then
dragData.setType("number");
dragData.setDescription(window.label.getValue() .. " level");
dragData.setNumberData(getValue());
return true;
else
dragData.setType("number");
dragData.setDescription(window.sublabel.getValue() .. " level");
dragData.setNumberData(getValue());
return true;
end
end

function onValueChanged()
-- when skill's level changes all sublabel levels
-- also changes. All sublevels are always 2 points high than the main skill's level.
-- How to increase all sublevels when the level changes?
end
</script>
</numberfield>
</sheetdata>
</windowclass>




And addnewinstance script:



-- ADD NEW INSTANCE script **************************************
function addNewInstance(label, level)
local newwin = createWindow();
newwin.label.setValue(label);
newwin.label.setVisible(false);
newwin.sublabel.setVisible(true);
newwin.level.setValue(level+2);
newwin.setCustom(false);
newwin.sublabel.setFocus();
end


Second question is that how can I change all the subskill levels when the main skill level changes?


Thanks forhand for reading this post :)