Fantasy Grounds Fridays Pre
Page 1 of 2 12 Last
  1. #1

    Total of check box

    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.
    ---
    yoyA

  2. #2
    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).

  3. #3
    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



    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.
    ---
    yoyA

  4. #4
    Yes, the first thing you need to do is create 5 different Multistate in your character sheet xml file
    Code:
    			<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
    Code:
    			<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:
    Code:
    			<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!

  5. #5
    You can also create 6 states in one multistate control:

    Code:
    <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.
    Tero Parvinen
    Fantasy Grounds Guru

  6. #6
    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.
    Où allons nous ?
    -Nulle part.
    -Ce sera long ?
    -Sans fin.

  7. #7
    Quote Originally Posted by koszza
    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:
    Code:
             <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>


    Quote Originally Posted by koszza
    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:
    Code:
             <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.
    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>
    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.

    Code:
            <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.

    Code:
            <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:

    Code:
            <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:
    Code:
             <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.

  8. #8
    Damn, that's quite clever!

  9. #9
    Quote Originally Posted by Crusader
    Damn, that's quite clever!
    It's amazing what you can do by just adding, subtracting, multiplying and dividing.

  10. #10
    Thanks friends for all the responses

    Regards,
    Pierre.
    ---
    yoyA

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in