Meatball
May 23rd, 2006, 04:27
Alright guys, I'm trying to work out some fields on a custom character sheet. I'm attempting to calculate a field by taking one field and dividing it by another field that was already calculated as an average.
Here's the basics. In the game system I use there is something called "Encumbrance" It's a penalty to skills that is calculated by taking the total weight or load you are carrying and dividing that by your endurance. Endurance is calculated by averaging three attributes, Strength, Stamina and Willpower.
My eyes are going a bit wonky looking at the code, so maybe someone can see something.
First off, the code that calculates the total load carried appears to be working correctly and everythind adds up fine on the sheet.
<numbercontrol name="TotalLoad">
<bounds rect="233,461,26,16" />
<readonly />
<nodrop />
<nodrag />
<value type="readonly" />
<nokeyedit />
<hideonvalue value="0" />
<font name="smallcontrol" />
<source name="WeaponWeight" op="+" />
<source name="ArmourWeight" op="+" />
<source name="Weight1" op="+" />
<source name="Weight2" op="+" />
<source name="Weight3" op="+" />
</numbercontrol>
Next, I have the calculation that averages the three attributes to calculate Endurance working correctly and it is showing up as expected on the character sheet. (Thanks to Doc4's post on averaging (https://www.fantasygrounds.com/forums/showthread.php?t=3149&highlight=averaging) that helped me to get this working.)
<!-- :Set up Dummy Variable to be used with Average "function" -->
<numbercontrol name="dummy">
<invisible />
<value type="readonly" />
</numbercontrol>
<!-- Endurance is made up of 3 stats, set up dummy variable "3" to hold the # 3. -->
<numbercontrol name="3">
<invisible />
<value type="readonly" />
<source name="dummy" op="+" valuemap="0:3" />
</numbercontrol>
<!-- Endurance - Add Strength + Stamina + Will Then Divide by "dummy" variable of 3 -->
<numbercontrol name="Endurance">
<bounds rect="231,286,26,15" />
<font name="smallcontrol" />
<center />
<nodrop />
<noreset />
<value type="readonly" />
<source name="Strength" op="+" />
<source name="Stamina" op="+" />
<source name="Will" op="+" />
<source name="3" op="/" />
<description text="Endurance" />
<hideonvalue value="0" />
</numbercontrol>
So far, everything looks good. But now when I attempt to add the code to calculate Encumbrance by taking the total load and divide it by the endurance, FG crashes as soon as I try to create a new character sheet. Here's the code:
<numbercontrol name="Encumbrance" >
<bounds rect="233,493,26,16" />
<readonly />
<nodrop />
<nodrag />
<value type="readonly" />
<nokeyedit />
<hideonvalue value="0" />
<font name="smallcontrol" />
<source name="TotalLoad" op="+" />
<source name="Endurance" op="/" />
</numbercontrol>
Any help/thoughts would be mucho appreciated. Thanks!
Here's the basics. In the game system I use there is something called "Encumbrance" It's a penalty to skills that is calculated by taking the total weight or load you are carrying and dividing that by your endurance. Endurance is calculated by averaging three attributes, Strength, Stamina and Willpower.
My eyes are going a bit wonky looking at the code, so maybe someone can see something.
First off, the code that calculates the total load carried appears to be working correctly and everythind adds up fine on the sheet.
<numbercontrol name="TotalLoad">
<bounds rect="233,461,26,16" />
<readonly />
<nodrop />
<nodrag />
<value type="readonly" />
<nokeyedit />
<hideonvalue value="0" />
<font name="smallcontrol" />
<source name="WeaponWeight" op="+" />
<source name="ArmourWeight" op="+" />
<source name="Weight1" op="+" />
<source name="Weight2" op="+" />
<source name="Weight3" op="+" />
</numbercontrol>
Next, I have the calculation that averages the three attributes to calculate Endurance working correctly and it is showing up as expected on the character sheet. (Thanks to Doc4's post on averaging (https://www.fantasygrounds.com/forums/showthread.php?t=3149&highlight=averaging) that helped me to get this working.)
<!-- :Set up Dummy Variable to be used with Average "function" -->
<numbercontrol name="dummy">
<invisible />
<value type="readonly" />
</numbercontrol>
<!-- Endurance is made up of 3 stats, set up dummy variable "3" to hold the # 3. -->
<numbercontrol name="3">
<invisible />
<value type="readonly" />
<source name="dummy" op="+" valuemap="0:3" />
</numbercontrol>
<!-- Endurance - Add Strength + Stamina + Will Then Divide by "dummy" variable of 3 -->
<numbercontrol name="Endurance">
<bounds rect="231,286,26,15" />
<font name="smallcontrol" />
<center />
<nodrop />
<noreset />
<value type="readonly" />
<source name="Strength" op="+" />
<source name="Stamina" op="+" />
<source name="Will" op="+" />
<source name="3" op="/" />
<description text="Endurance" />
<hideonvalue value="0" />
</numbercontrol>
So far, everything looks good. But now when I attempt to add the code to calculate Encumbrance by taking the total load and divide it by the endurance, FG crashes as soon as I try to create a new character sheet. Here's the code:
<numbercontrol name="Encumbrance" >
<bounds rect="233,493,26,16" />
<readonly />
<nodrop />
<nodrag />
<value type="readonly" />
<nokeyedit />
<hideonvalue value="0" />
<font name="smallcontrol" />
<source name="TotalLoad" op="+" />
<source name="Endurance" op="/" />
</numbercontrol>
Any help/thoughts would be mucho appreciated. Thanks!