PDA

View Full Version : Problem calculating from source



Natai
March 7th, 2008, 18:00
I'll have to split this post up

I am just learning how to create rulesets. I have been modifying a copied version of the example d20 ruleset to fit my game. My first step was to alter the abilities section of charsheet_main.xml, also requiring changes to charsheet_templates.xml. I got rid of the ability bonus blocks and changed ability damage to ability max. So now I have to entries for each ability: current and max, neither of which is calculated. My game also uses a total of 10 abilities, so I changed the names of the current ones and added the others.


<!-- ABILITIES -->
<genericcontrol name="abilityframe">
<bounds>15,90,240,300</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>

<abilityscore name="dexterity" source="abilities.dexterity.score">
<anchored>
<to>abilityframe</to>
<position>insidetopleft</position>
<offset>105,23</offset>
</anchored>
<tabtarget>
<next>dexteritymax</next>
<prev>size</prev>
</tabtarget>
</abilityscore>
<abilityscore name="reflex" source="abilities.reflex.score">
<anchored>
<to>dexterity</to>
</anchored>
<tabtarget>
<next>reflexmax</next>
<prev>dexteritymax</prev>
</tabtarget>
</abilityscore>
<abilityscore name="strength" source="abilities.strength.score">
<anchored>
<to>reflex</to>
</anchored>
<tabtarget>
<next>strengthmax</next>
<prev>reflexmax</prev>
</tabtarget>
</abilityscore>
<abilityscore name="constitution" source="abilities.constitution.score">
<anchored>
<to>strength</to>
</anchored>
<tabtarget>
<next>constitutionmax</next>
<prev>strengthmax</prev>
</tabtarget>
</abilityscore>
<abilityscore name="focus" source="abilities.focus.score">
<anchored>
<to>constitution</to>
</anchored>
<tabtarget>
<next>focusmax</next>
<prev>constitutionmax</prev>
</tabtarget>
</abilityscore>
<abilityscore name="willpower" source="abilities.willpower.score">
<anchored>
<to>focus</to>
</anchored>
<tabtarget>
<next>willpowermax</next>
<prev>focusmax</prev>
</tabtarget>
</abilityscore>
<abilityscore name="intelligence" scource="abilities.intelligence.score">
<anchored>
<to>willpower</to>
</anchored>
<tabtarget>
<next>intelligencemax</next>
<prev>willpowermax</prev>
</tabtarget>
</abilityscore>
<abilityscore name="perception" scource="abilities.perception.score">
<anchored>
<to>intelligence</to>
</anchored>
<tabtarget>
<next>perceptionmax</next>
<prev>intelligencemax</prev>
</tabtarget>
</abilityscore>
<abilityscore name="influence" scource="abilities.influence.score">
<anchored>
<to>perception</to>
</anchored>
<tabtarget>
<next>influencemax</next>
<prev>perceptionmax</prev>
</tabtarget>
</abilityscore>
<abilityscore name="deception" scource="abilities.deception.score">
<anchored>
<to>influence</to>
</anchored>
<tabtarget>
<next>deceptionmax</next>
<prev>influencemax</prev>
</tabtarget>
</abilityscore>

<abilitylabel>
<anchored>
<to>dexterity</to>
</anchored>
<static>Dexterity</static>
</abilitylabel>
<abilitylabel>
<anchored>
<to>reflex</to>
</anchored>
<static>Reflex</static>
</abilitylabel>
<abilitylabel>
<anchored>
<to>strength</to>
</anchored>
<static>Strength</static>
</abilitylabel>
<abilitylabel>
<anchored>
<to>constitution</to>
</anchored>
<static>Constitution</static>
</abilitylabel>
<abilitylabel>
<anchored>
<to>focus</to>
</anchored>
<static>Focus</static>
</abilitylabel>
<abilitylabel>
<anchored>
<to>willpower</to>
</anchored>
<static>Willpower</static>
</abilitylabel>
<abilitylabel>
<anchored>
<to>intelligence</to>
</anchored>
<static>Intelligence</static>
</abilitylabel>
<abilitylabel>
<anchored>
<to>perception</to>
</anchored>
<static>Perception</static>
</abilitylabel>
<abilitylabel>
<anchored>
<to>influence</to>
</anchored>
<static>Influence</static>
</abilitylabel>
<abilitylabel>
<anchored>
<to>deception</to>
</anchored>
<static>Deception</static>
</abilitylabel>

<abilitymax name="dexteritymax" source="abilities.dexterity.max">
<anchored>
<to>dexterity</to>
</anchored>
<tabtarget>
<next>reflex</next>
<prev>dexterity</prev>
</tabtarget>
</abilitymax>
<abilitymax name="reflexmax" source="abilities.reflex.max">
<anchored>
<to>reflex</to>
</anchored>
<tabtarget>
<next>strength</next>
<prev>reflex</prev>
</tabtarget>
</abilitymax>
<abilitymax name="strengthmax" source="abilities.strength.max">
<anchored>
<to>strength</to>
</anchored>
<tabtarget>
<next>constitution</next>
<prev>strength</prev>
</tabtarget>
</abilitymax>
<abilitymax name="constitutionmax" source="abilities.constitution.max">
<anchored>
<to>constitution</to>
</anchored>
<tabtarget>
<next>focus</next>
<prev>constitution</prev>
</tabtarget>
</abilitymax>
<abilitymax name="focusmax" source="abilities.focus.max">
<anchored>
<to>focus</to>
</anchored>
<tabtarget>
<next>willpower</next>
<prev>focus</prev>
</tabtarget>
</abilitymax>
<abilitymax name="willpowermax" source="abilities.willpower.max">
<anchored>
<to>willpower</to>
</anchored>
<tabtarget>
<next>intelligence</next>
<prev>willpower</prev>
</tabtarget>
</abilitymax>
<abilitymax name="intelligencemax" source="abilities.intelligence.max">
<anchored>
<to>intelligence</to>
</anchored>
<tabtarget>
<next>perception</next>
<prev>intelligence</prev>
</tabtarget>
</abilitymax>
<abilitymax name="perceptionmax" source="abilities.perception.max">
<anchored>
<to>perception</to>
</anchored>
<tabtarget>
<next>influence</next>
<prev>perception</prev>
</tabtarget>
</abilitymax>
<abilitymax name="influencemax" source="abilities.influence.max">
<anchored>
<to>influence</to>
</anchored>
<tabtarget>
<next>deception</next>
<prev>influence</prev>
</tabtarget>
</abilitymax>
<abilitymax name="deceptionmax" source="abilities.deception.max">
<anchored>
<to>deception</to>
</anchored>
<tabtarget>
<next>baseinitiative</next>
<prev>deception</prev>
</tabtarget>
</abilitymax>

<abilityshort>
<anchored>
<to>dexteritymax</to>
</anchored>
<static>DEX</static>
</abilityshort>
<abilityshort>
<anchored>
<to>reflexmax</to>
</anchored>
<static>REF</static>
</abilityshort>
<abilityshort>
<anchored>
<to>strengthmax</to>
</anchored>
<static>STR</static>
</abilityshort>
<abilityshort>
<anchored>
<to>constitutionmax</to>
</anchored>
<static>CON</static>
</abilityshort>
<abilityshort>
<anchored>
<to>focusmax</to>
</anchored>
<static>FOC</static>
</abilityshort>
<abilityshort>
<anchored>
<to>willpowermax</to>
</anchored>
<static>WIL</static>
</abilityshort>
<abilityshort>
<anchored>
<to>intelligencemax</to>
</anchored>
<static>INT</static>
</abilityshort>
<abilityshort>
<anchored>
<to>perceptionmax</to>
</anchored>
<static>PER</static>
</abilityshort>
<abilityshort>
<anchored>
<to>influencemax</to>
</anchored>
<static>INF</static>
</abilityshort>
<abilityshort>
<anchored>
<to>deceptionmax</to>
</anchored>
<static>DEC</static>
</abilityshort>

<stringcontrol>
<anchored>
<to>dexterity</to>
<position>above</position>
<offset>5,2</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Current</static>
<center />
</stringcontrol>
<stringcontrol>
<anchored>
<to>dexteritymax</to>
<position>above</position>
<offset>5,2</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Max</static>
<center />
</stringcontrol

Natai
March 7th, 2008, 18:01
My next step has been to create a new set of boxes that show the characters initiative. I removed the information in the classes area and am using that frame. My first box should display the character's base initiative, which is calculated by adding the values of two abilities, namely Reflex and Perception.
Here's the problem: I can setup the box to calculate the base initiative only if it is based on the abilities that initially existed and that I renamed. If I try to base it on an ability I added, it ignores that particular source. I cannot find any differences between the abilities I changed and the ones I added, but nothing I have tried seems to work. Please help.


<!-- INITIATIVE -->
<genericcontrol name="initiativeframe">
<bounds>255,90,145,200</bounds>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>

<stringcontrol name="initiativelabel">
<anchored>
<to>initiativeframe</to>
<position>insidetopleft</position>
<offset>15,10</offset>
</anchored>
<font>sheetlabelsmall</font>
<static>Initiative</static>
</stringcontrol>

<baseinit name="baseinitiative" source="derived.initiative.base">
<anchored>
<to>initiativeframe</to>
<position>insidetopleft</position>
<offset>95,23</offset>
</anchored>
<tabtarget>
</tabtarget>
<source>
<name>abilities.perception.score</name>
<op>+</op>
</source>
<source>
<name>abilities.reflex.score</name>
<op>+</op>
</source>
<script>
function onSourceUpdate()
setValue(calculateSources());
end
</script>
<readonly />
</baseinit>

<initiativetypelabel>
<anchored>
<to>baseinitiative</to>
</anchored>
<static>Base</static>
</initiativetypelabel>

And here's the relevant portion of charsheet_templates.xml

<template name="abilityscore">
<numberfield>
<anchored>
<position>belowleft</position>
<offset>0,7</offset>
<size>
<width>32</width>
<height>20</height>
</size>
</anchored>
<frame>
<name>bonus</name>
<offset>5,5,5,5</offset>
</frame>
<keyeditframe>
<name>sheetfocus</name>
<offset>5,5,5,5</offset>
</keyeditframe>
<font>sheetnumber</font>
<script>
</script>
</numberfield>
</template>

<template name="abilitylabel">
<stringcontrol>
<anchored>
<position>lefthigh</position>
<offset>0,4</offset>
<size>
<width>90</width>
<height>20</height>
</size>
</anchored>
<static />
<font>sheetlabel</font>
</stringcontrol>
</template>

<template name="abilityshort">
<stringcontrol>
<anchored>
<position>righthigh</position>
<offset>7,4</offset>
<size>
<width>25</width>
<height>20</height>
</size>
</anchored>
<static />
<font>sheetlabel</font>
</stringcontrol>
</template>

<template name="abilitymax">
<numberfield>
<anchored>
<position>right</position>
<offset>9,0</offset>
<size>
<width>36</width>
</size>
</anchored>
<frame>
<name>bonus</name>
<offset>5,5,5,5</offset>
</frame>
<keyeditframe>
<name>sheetfocus</name>
<offset>5,5,5,5</offset>
</keyeditframe>
<font>sheetnumber</font>
<script>
</script>
</numberfield>
</template>

<template name="initiativetypelabel">
<stringcontrol>
<anchored>
<position>lefthigh</position>
<offset>0,4</offset>
<size>
<width>80</width>
<height>20</height>
</size>
</anchored>
<static />
<font>sheetlabel</font>
</stringcontrol>
</template>

<template name="baseinit">
<linkednumber>
<anchored>
<position>belowleft</position>
<offset>0,7</offset>
<size>
<width>32</width>
<height>20</height>
</size>
</anchored>
<frame>
<name>bonus</name>
<offset>5,5,5,5</offset>
</frame>
<keyeditframe>
<name>sheetfocus</name>
<offset>5,5,5,5</offset>
</keyeditframe>
<font>sheetnumber</font>
</linkednumber>
</template>

Natai
March 7th, 2008, 18:56
Nevermind.
After looking at the saved characters xml file. I discovered that the different abilities were being saved differently. Another 30 minutes later I realized that it's "source" not "scource". Aaaargh

Oberoten
March 7th, 2008, 19:00
Believe me... I know THAT feeling.

Griogre
March 8th, 2008, 19:18
That "Aaaargh" is seconded by everyone who has ever done this type of thing. :p Those are such a pain, and after a you have been staring at the source a while you just *don't* see those mistakes. :(

Dachannien
March 9th, 2008, 13:06
I agree totally. Sometimes you just want to defenestrate yourself after finding those kinds of errors ;)