PDA

View Full Version : Total of check box



yoya
November 30th, 2005, 15:23
Hi all,
I would like to know if it is possible to assign a value to another area when my check box is checked ??

[ ]level1
[ ]level2 The Level set is level [ 3 ]
[X]level3
[ ]level4


- <multistate name="inteligence_niv1">
<bounds rect="180,124,9,9" />
<state value="0" icon="indicator_mdtplein" />
</multistate>
- <multistate name="inteligence_niv2">
<bounds rect="191,124,9,9" />
<state value="0" icon="indicator_mdtvide" />
<state value="1" icon="indicator_mdtplein" totalvalue=2 /> <- a thing like this ???
</multistate>

Do you have any idea ?

Regards,
Pierre.

Cantstanzya
November 30th, 2005, 17:33
Let me make sure I understand what you want? You want this to behave like a radio button so if you have level1 selected and you select level3, then level1 would become blank and level3 would have an X. You would then want something that would tell what level is selected. If this is the case then no it cannot be done right now. When 1.06 is released it will have scripting in it and this should be easy to do what you want. Currently the limitation is that you have to change a multistate manually it cannot be done through the software. If you don't mind that the user would have to deselect level1 and then select level3 then yes it can be done. If you'd like some help with this let me know and I can give you a hand when I get home from work (around 7:00ET).

yoya
December 1st, 2005, 13:55
Hi Cantstanzya,
Thank you for your reply and sorry for my english.
In fact, I want to create a ruleset for the World Of Darkness 2 (Vampire, Mage etc ...)
If you don't know this rule system, I'll try to explain it to you and what I want exaclty :)

http://www.itg.gp/~pbodinier/attribut.jpg

In this case, the Intelligence value attribut will serve me after to calculate a skill Level (ex: Informatique skill).
I would like to populate the Informatique skill automaticly with the Int value (in this case, 3).

Is it possible to do this without the FantasyGrounds v1.06 ?

Regards,
Pierre.

Cantstanzya
December 2nd, 2005, 02:35
Yes, the first thing you need to do is create 5 different Multistate in your character sheet xml file


<multistate name="intel1">
<bounds rect="100,100,50,50" />
<state value="0" icon="EmptyCircle" />
<state value="1" icon="FilledCircle" />
</multistate>

<multistate name="intel2">
<bounds rect="150,100,50,50" />
<state value="0" icon="EmptyCircle" />
<state value="1" icon="FilledCircle" />
</multistate>

<multistate name="intel3">
<bounds rect="200,100,50,50" />
<state value="0" icon="EmptyCircle" />
<state value="1" icon="FilledCircle" />
</multistate>

<multistate name="intel4">
<bounds rect="250,100,50,50" />
<state value="0" icon="EmptyCircle" />
<state value="1" icon="FilledCircle" />
</multistate>

<multistate name="intel5">
<bounds rect="300,100,50,50" />
<state value="0" icon="EmptyCircle" />
<state value="1" icon="FilledCircle" />
</multistate>



Then you will have to create two icons using paint or other graphics program and add them to your icons directory of your ruleset. After that you will need to add the following lines to your graphic file


<icon name="EmptyCircle" file="rulesets/YourRulesetName/icons/EmptyCircle.png" />
<icon name="FilledCircle" file="rulesets/YourRulesetName/icons/FilledCircle.png" />

You should now be able to launch FG and the icons should show up and you should be able to click on them and change them from empty to filled

Now (if I understand you correct) you will want to be able to total up how many of the circles are checked. You can do that by adding the numbercontrol below:


<numbercontrol name="TotalIntel">
<bounds rect="350,100,50,50" />
<nodrag />
<nodrop />
<noreset />
<value type="readonly" />
<limits minimum="0" maximum="5" />
<source name="intel1" op="+" />
<source name="intel2" op="+" />
<source name="intel3" op="+" />
<source name="intel4" op="+" />
<source name="intel5" op="+" />
</numbercontrol>

Heres how it works, when you have a multistate empty, it will have a value of zero, when it is filled in it will have a value of 1. In the number control it will add all of these values together for the 5 different multistates and give you the total in this box.
Hope this helps. Let me know if you have any problems or questions. Or if you want it to do something else. Good Luck!

Goblin-King
December 2nd, 2005, 14:49
You can also create 6 states in one multistate control:


<multistate name="intel1">
<state value="0" icon="ZeroCircles" />
<state value="1" icon="OneCircle" />
<state value="2" icon="TwoCircles" />
<state value="3" icon="ThreeCircles" />
<state value="4" icon="FourCircles" />
<state value="5" icon="FiveCircles" />
</multistate>


You would also need 6 bitmaps to represent the 6 states the control can be in. The value, when linked, would be 0-5.

Of course, that would require you to keep clicking on the control to cycle through all the possible states, so if you don't like that, you can go with Cantstanzya's version.

As mentioned, this is exactly the thing that will be a snap after 1.06 is ready.

koszza
December 3rd, 2005, 16:08
Thanks a lot for your advices, it does works perfectley.
I only used yet the first method, but the second one will be help full, for other traits.

I have a few more questions. :roll:

I wonder how to invert the process, it's to say how to use a result in order to view point on a secondary traits. For example:

Resolve + composure = 6 = willpower .


Other thing, how to obtain a trait that would equals the smallest value of the two other traits. For example:

Dexterity , Wits . a smallest value is 2, it means defense = 2.

Regards.

Mickael.

Cantstanzya
December 4th, 2005, 02:28
I wonder how to invert the process, it's to say how to use a result in order to view point on a secondary traits. For example:

Resolve + composure = 5 = willpower .

I'm not so sure I understand this, resolve being 3 and composure being 3 would be a total of 6. If this is what you were trying to achieve and you wanted willpower to fill in 6 circles, that currently can't be done. If you just wanted a textbox to show the total you can do that like this:


<numbercontrol name="TotalWillpower">
<bounds rect="350,100,50,50" />
<nodrag />
<nodrop />
<noreset />
<value type="readonly" />
<limits minimum="0" maximum="5" />
<source name="resolve1" op="+" />
<source name="resolve2" op="+" />
<source name="resolve3" op="+" />
<source name="composure1" op="+" />
<source name="composure2" op="+" />
<source name="composure3" op="+" />
</numbercontrol>







Other thing, how to obtain a trait that would equals the smallest value of the two other traits. For example:

Dexterity , Wits . a smallest value is 2, it means defense = 2.

Regards.

Mickael.
For this one you have to get very creative. For argument sake we'll say both are not the same, although the code will still work if both are the same. First create your multistates for dexterity and wits. Then create numbercontrols that will add up the multistates:


<numbercontrol name="Dex">
<bounds rect="300,100,50,50" />
<nodrag />
<nodrop />
<noreset />
<value type="readonly" />
<source name="dex1" op="+" />
<source name="dex2" op="+" />
<source name="dex3" op="+" />
<source name="dex4" op="+" />
<source name="dex5" op="+" />
</numbercontrol>

<numbercontrol name="Wits">
<bounds rect="350,100,50,50" />
<nodrag />
<nodrop />
<noreset />
<value type="readonly" />
<source name="wits1" op="+" />
<source name="wits2" op="+" />
<source name="wits3" op="+" />
<source name="wits4" op="+" />
<source name="wits5" op="+" />
</numbercontrol>


Now create two invisible numbercontrols that will help determine which of the two are lower.


<numbercontrol name="DexMinusWits">
<invisible />
<source name="Dex" op="+" />
<source name="Wits" op="-" />
</numbercontrol>

<numbercontrol name="WitsMinusDex">
<invisible />
<source name="Wits" op="+" />
<source name="Dex" op="-" />
</numbercontrol>


In the code above one will be negative and one will be positive. Now create two more number controls that will extract out the lower value.



<numbercontrol name="DexIsLower">
<invisible />
<source name="DexMinusWits" op="*" valuemap="-5&#58;0,-4&#58;0,-3&#58;0,-2&#58;0,-1&#58;0,0&#58;0,1&#58;1,2&#58;1,3&#58;1,4&#58;1,5&#58;1" />
</numbercontrol>

<numbercontrol name="WitsIsLower">
<invisible />
<source name="WitsMinusDex" op="*" valuemap="-5&#58;0,-4&#58;0,-3&#58;0,-2&#58;0,-1&#58;0,0&#58;0,1&#58;1,2&#58;1,3&#58;1,4&#58;1,5&#58;1" />
</numbercontrol>


In the DexIsLower numbercontrol above, if dex minus wits is a negative number it will be multiplied by 0. If it is higher than zero it will be multiplied by one.

In the WitsIsLower numbercontrol above, if wits minus dex is a negative number it will be multiplied by 0. If it is higher than zero it will be multiplied by one.

You would then have two numbers, one will be zero and one will be a positive number. Now create two more number controls that will turn the negative number into a 1.



<numbercontrol name="DexMultiplier">
<invisible />
<source name="DexIsLower" op="+" valuemap="-5&#58;1,-4&#58;1,-3&#58;1,-2&#58;1,-1&#58;1,0&#58;1" />
</numbercontrol>

<numbercontrol name="WitsMultiplier">
<invisible />
<source name="WitsIsLower" op="+" valuemap="-5&#58;1,-4&#58;1,-3&#58;1,-2&#58;1,-1&#58;1,0&#58;0" />
</numbercontrol>


Are you still with me?? Now multiply these numbers by their respective counterpart:



<numbercontrol name="DexFinal">
<invisible />
<source name="Dex" op="+" />
<source name="DexMultiplier" op="*" />
</numbercontrol>

<numbercontrol name="WitsFinal">
<invisible />
<source name="Wits" op="+" />
<source name="WitsMultiplier" op="*" />
</numbercontrol>


Finally you can fill in your defense numbercontrol:


<numbercontrol name="Defense">
<bounds rect="400,100,50,50" />
<nodrag />
<nodrop />
<noreset />
<value type="readonly" />
<source name="DexFinal" op="+" />
<source name="WitsFinal" op="+" />
</numbercontrol>


Now lets look at the code at work:
Let's say Dex is 2 and Wits is 5.
DexMinusWits would be -3
WitsMinusDex would be 3
The DexIsLower number control would multiply -3 times 0 which would be 0
The WitsIsLower number control would multiply 3 times 1 which would be 3
The DexMultiplier number control would be set to 1 by the valuemap
The WitsMultiplier number control would be set to 0 by the valuemap
The DexFinal would add Dex of 2 and then multiply it by DexMultiplier of 1 and give you a total of 2
The WitsFinal would add Wits of 5 and then multiply it by DexMultiplier of 0 and give you a total of 0
The Defense would add DexFinal of 2 to WitsFinal of 0 and give you a Defense of 2 (which is what was the lower of the two numbers)

If both were the same this is what would happen:
Let's say Dex is 3 and Wits is 3.
DexMinusWits would be 0
WitsMinusDex would be 0
The DexIsLower number control would multiply 0 times 0 which would be 0
The WitsIsLower number control would multiply 0 times 0 which would be 0
The DexMultiplier number control would be set to 1 by the valuemap
The WitsMultiplier number control would be set to 0 by the valuemap
The DexFinal would add Dex of 3 and then multiply it by DexMultiplier of 1 and give you a total of 3
The WitsFinal would add Wits of 3 and then multiply it by DexMultiplier of 0 and give you a total of 0
The Defense would add DexFinal of 3 to WitsFinal of 0 and give you a Defense of 3 (which in this case were the same but none the less gives you the correct answer)

My character sheet is nearly fully automated and has thousands of lines like the code above (7064 to be exact). I can't wait for 1.06 to come out so that I can clean this up.

Crusader
December 4th, 2005, 08:00
Damn, that's quite clever!

Cantstanzya
December 4th, 2005, 17:01
Damn, that's quite clever!It's amazing what you can do by just adding, subtracting, multiplying and dividing. :)

yoya
December 5th, 2005, 12:57
Thanks friends for all the responses :)

Regards,
Pierre.

koszza
December 7th, 2005, 03:42
I'm not so sure I understand this, resolve being 3 and composure being 3 would be a total of 6. If this is what you were trying to achieve and you wanted willpower to fill in 6 circles, that currently can't be done. If you just wanted a textbox to show the total you can do that like this:
Yes you are understand my question. I taked on error key (5 vs 6).
I'm desolate it's not possible :D I will take your proposition.


Your method for find the smaller number is very creative. Thanks for your work. but there is an error.

You would then have two numbers, one will be zero and one will be a positive number. Now create two more number controls that will turn the negative number into a 1.
...

Now lets look at the code at work:
Let's say Dex is 2 and Wits is 5.
DexMinusWits would be -3
WitsMinusDex would be 3
The DexIsLower number control would multiply -3 times 0 which would be 0
The WitsIsLower number control would multiply 3 times 1 which would be 3
The DexMultiplier number control would be set to 1 by the valuemap
The WitsMultiplier number control would be set to 0 by the valuemap
The DexFinal would add Dex of 2 and then multiply it by DexMultiplier of 1 and give you a total of 2
The WitsFinal would add Wits of 5 and then multiply it by DexMultiplier of 0 and give you a total of 0
The Defense would add DexFinal of 2 to WitsFinal of 0 and give you a Defense of 2 (which is what was the lower of the two numbers)
Is not possible.
The numbercontrol "DexIsLower" and "WitsIsLower" transform the negative number to zero and keep the positive number. The numbercontrol "DexMultiplier" can't operate if there 're not multiplied by 1.

Look the solution.

- Suppress the numbercontrol "DexIsLower" and "WitsIsLower".
- Change the source by "DexMinusWits" in the numbercontrol "DexMultplier" and replace the valuemap. "-5:1,-4:1,-3:1,-2:1,-1:1,0:0,1:0,2:0,3:0,4:0,5:0"
- Change the source by "WitsMinusDex" in the numbercontrol "WitsMultiplier" and modifie the valuemap. "-5:1,-4:1,-3:1,-2:1,-1:1,0:1,1:0,2:0,3:0,4:0,5:0"

<numbercontrol name="DexMultiplier">
<invisible />
<source name="DexMinusWits" op="+" valuemap="-5&#58;1,-4&#58;1,-3&#58;1,-2&#58;1,-1&#58;1,0&#58;0,1&#58;0,2&#58;0,3&#58;0,4&#58;0,5&#58;0" />
</numbercontrol>

<numbercontrol name="WitsMultiplier">
<invisible />
<source name="WitsMinusDex" op="+" valuemap="-5&#58;1,-4&#58;1,-3&#58;1,-2&#58;1,-1&#58;1,0&#58;1,1&#58;0,2&#58;0,3&#58;0,4&#58;0,5&#58;0" />
</numbercontrol>
For exemple:
dex = 2
wits = 5
dexminuswits = 2-5 = -3
witsminusdex = 5-2 = 3
dexmultiplier = dexminuswits (valuemap "-3:1") = 1
witsmultiplier = witsminusdex (valuemap "3:0") = 0
dexfinal = dex * dexmultiplier = 2 * 1 = 2
witsfinal = wits * witsmultiplier = 5 * 0 = 0
defense = dexfinal + witsfinal = 2

Look the complet code.

<numbercontrol name="DexMinusWits">
<invisible />
<source name="Dex" op="+" />
<source name="Wits" op="-" />
</numbercontrol>

<numbercontrol name="WitsMinusDex">
<invisible />
<source name="Wits" op="+" />
<source name="Dex" op="-" />
</numbercontrol>


<numbercontrol name="DexMultiplier">
<invisible />
<source name="DexMinusWits" op="+" valuemap="-5&#58;1,-4&#58;1,-3&#58;1,-2&#58;1,-1&#58;1,0&#58;0,1&#58;0,2&#58;0,3&#58;0,4&#58;0,5&#58;0" />
</numbercontrol>

<numbercontrol name="WitsMultiplier">
<invisible />
<source name="WitsMinusDex" op="+" valuemap="-5&#58;1,-4&#58;1,-3&#58;1,-2&#58;1,-1&#58;1,0&#58;1,1&#58;0,2&#58;0,3&#58;0,4&#58;0,5&#58;0" />
</numbercontrol>



<numbercontrol name="DexFinal">
<invisible />
<source name="Dex" op="+" />
<source name="DexMultiplier" op="*" />
</numbercontrol>

<numbercontrol name="WitsFinal">
<invisible />
<source name="Wits" op="+" />
<source name="WitsMultiplier" op="*" />
</numbercontrol>


<numbercontrol name="Defense">
<bounds rect="400,100,50,50" />
<nodrag />
<nodrop />
<noreset />
<value type="readonly" />
<source name="DexFinal" op="+" />
<source name="WitsFinal" op="+" />
</numbercontrol>

Thanks for your help.