cscase
July 27th, 2013, 21:37
Hey all,
This is probably a really noobish question, but I'm hoping you can give me a hand here.
I'm working on making a custom character sheet, and I want to make a list of skills. For each skill, there will be three columns/values: The name, the skill rating or max value, and the pool.
Because what I want to do is really simple, I thought I would learn more and have an easier time just starting with an empty frame and building my own skill list, instead of trying to puzzle through the more complex code in existing rulesets. I have some code that makes one line on the skill list. Below I'm pasting the first couple of pieces as an example.
I had initially thought to just keep it as simple as possible by just hand coding each individual skill like this. But repeating all this code for every skill in the list just seems like SUCH an inefficient way to go about it.
So, I thought maybe the thing to do would be to use a windowclass, then create windowinstances for each skill. But in the reference material, there is no example code for windowinstance, and the rulesets I'm looking at don't use it either. I feel like I'm just kinda flailing around and trying different syntaxes randomly to see if I hit on something that works, and I'm not really sure if I'm even moving in the right direction. That's where I'm hoping to get some advice.
What do you think is the best approach for generating a skill list with simple objects? I'm thinking each line an explicitly instantiated class object, but if you think I'm going the wrong way to go about it, I am all ears. I really feel lost. It seems like what I struggle with most is figuring out what tags to use for what. The Lua I've seen so far makes sense.
Thanks all!
<stringcontrol name="skillname">
<anchored>
<to>skillframe</to>
<position>insidetopleft</position>
<offset>10,38</offset>
</anchored>
<sizelimits>
<width>5</width>
</sizelimits>
<font>sheetlabel</font>
<static>Athletics</static> <!-- Need to somehow make this label a variable??? -->
<script>
function onDoubleClick(x,y)
ChatManager.throwDice("dice",{"d6"},0," ("..window.name..")");
return true;
end
</script>
</stringcontrol>
<numberfield name="skillrating">
<min>0</min>
<max>15</max>
<anchored>
<to>athleticslabel</to>
<position>right</position>
<offset>62</offset>
<size>
<width>30</width>
</size>
</anchored>
<font>sheettextnumval</font>
<stateframe>
<keyedit>
<name>sheetfocus</name>
<offset>5,5,5,5</offset>
</keyedit>
</stateframe>
<delaykeyupdate />
<script>
function onWheel(notches)
if Input.isControlPressed() then
setValue(getValue() + notches);
if window.skillpool.getValue() > getValue() then
window.skillpool.setValue(getValue());
end
end
return true;
end
function onDoubleClick(x,y)
ChatManager.throwDice("dice",{"d6"},0," ("..window.name..")");
return true;
end
function onValueChanged()
if window.skillpool.getValue() > getValue() then
window.skillpool.setValue(getValue());
end
return true;
end
</script>
<nodrag />
</numberfield>
This is probably a really noobish question, but I'm hoping you can give me a hand here.
I'm working on making a custom character sheet, and I want to make a list of skills. For each skill, there will be three columns/values: The name, the skill rating or max value, and the pool.
Because what I want to do is really simple, I thought I would learn more and have an easier time just starting with an empty frame and building my own skill list, instead of trying to puzzle through the more complex code in existing rulesets. I have some code that makes one line on the skill list. Below I'm pasting the first couple of pieces as an example.
I had initially thought to just keep it as simple as possible by just hand coding each individual skill like this. But repeating all this code for every skill in the list just seems like SUCH an inefficient way to go about it.
So, I thought maybe the thing to do would be to use a windowclass, then create windowinstances for each skill. But in the reference material, there is no example code for windowinstance, and the rulesets I'm looking at don't use it either. I feel like I'm just kinda flailing around and trying different syntaxes randomly to see if I hit on something that works, and I'm not really sure if I'm even moving in the right direction. That's where I'm hoping to get some advice.
What do you think is the best approach for generating a skill list with simple objects? I'm thinking each line an explicitly instantiated class object, but if you think I'm going the wrong way to go about it, I am all ears. I really feel lost. It seems like what I struggle with most is figuring out what tags to use for what. The Lua I've seen so far makes sense.
Thanks all!
<stringcontrol name="skillname">
<anchored>
<to>skillframe</to>
<position>insidetopleft</position>
<offset>10,38</offset>
</anchored>
<sizelimits>
<width>5</width>
</sizelimits>
<font>sheetlabel</font>
<static>Athletics</static> <!-- Need to somehow make this label a variable??? -->
<script>
function onDoubleClick(x,y)
ChatManager.throwDice("dice",{"d6"},0," ("..window.name..")");
return true;
end
</script>
</stringcontrol>
<numberfield name="skillrating">
<min>0</min>
<max>15</max>
<anchored>
<to>athleticslabel</to>
<position>right</position>
<offset>62</offset>
<size>
<width>30</width>
</size>
</anchored>
<font>sheettextnumval</font>
<stateframe>
<keyedit>
<name>sheetfocus</name>
<offset>5,5,5,5</offset>
</keyedit>
</stateframe>
<delaykeyupdate />
<script>
function onWheel(notches)
if Input.isControlPressed() then
setValue(getValue() + notches);
if window.skillpool.getValue() > getValue() then
window.skillpool.setValue(getValue());
end
end
return true;
end
function onDoubleClick(x,y)
ChatManager.throwDice("dice",{"d6"},0," ("..window.name..")");
return true;
end
function onValueChanged()
if window.skillpool.getValue() > getValue() then
window.skillpool.setValue(getValue());
end
return true;
end
</script>
<nodrag />
</numberfield>