FG Spreadshirt Swag
  1. #1

    valuemap for stringcontrol

    I am trying to customize a character sheet in which "BoxA" is populated with a number and "BoxB" is dependent on what is in BoxA. BoxB is a string and must be populated like so "1-4" or "1-2". I have been able to do this using valuemap in a numbercontrol, but can't find a way to do this if BoxB is a stringcontrol. Does anyone have any idea if this can be done? If this can be done can you show a small example?

  2. #2
    I tried this in my character sheets. I wanted a six way control much like the class, cross class, half point controls to adjust a numbercontrol source field.

    I couldn't figure out how to get it done.
    DM: You are outside by the tavern.
    Player: Cool, I\'m getting drunk.
    Player: I\'m getting drunk, are there any girls there?
    Player: Roll the dice to see if I\'m getting drunk.

  3. #3

    here you go...

    in your charsheet.xml file:

    <multistate name="class">
    <bounds rect="55,41,150,20" />
    <state value="0" icon="class_0" />
    <state value="1" icon="class_1" />
    <state value="2" icon="class_2" />
    <state value="3" icon="class_3" />
    <state value="4" icon="class_4" />
    <state value="5" icon="class_5" />
    </multistate>

    in your ruleset graphics file (where SG1 is the name of my ruleset):

    <icon name="class_0" file = "rulesets/SG1/icons/class_0.png" />
    <icon name="class_1" file = "rulesets/SG1/icons/class_1.png" />
    <icon name="class_2" file = "rulesets/SG1/icons/class_2.png" />
    <icon name="class_3" file = "rulesets/SG1/icons/class_3.png" />
    <icon name="class_4" file = "rulesets/SG1/icons/class_4.png" />
    <icon name="class_5" file = "rulesets/SG1/icons/class_5.png" />

    and in your /rulesets/SG1/icons file (where SG1 is the name of my ruleset) add text images for the classes. For example:

    (class_0.png)

    (class_1.png)

    (class_2.png)

    (class_3.png)

    (class_4.png)

    (class_5.png)

    This creates a class field "radio button". The user can cycle through the available class names by clicking on the text.

    Now that you have a "combo box" of sorts using a radio button you can get a little more complex by doing the following:

    <numbercontrol name="explorer_init_bonus">
    <invisible />
    <source name="level" op="+" valuemap="0:0,1:1,2:2,...,20,16"/>
    <source name="class" op="*" valuemap="0:0,1:1,2:0,3:0,4:0,5:0" />
    </numbercontrol>

    'The "level" valuemap contains a listing of the appropriate init bonus for each level for the explorer character class.

    'The class valuemap multiplies the explorer init bonus by 1 if the explorer class is selected in the class control and by 0 otherwise.

    <numbercontrol name="initiative">
    <bounds rect="118,276,34,23" />
    <noreset />
    <hideonvalue value="0" />
    <displaysign />
    <description text="init bonus" />
    <value type="modifier" />
    <source name="dexteritybonus" op="+" />
    <source name="explorer_init_bonus" op="+" />
    <source name="pointmant_init_bonus" op="+" />
    <source name="scientist_init_bonus" op="+" />
    <source name="scout_init_bonus" op="+" />
    <source name="soldier_init_bonus" op="+" />
    <tabtarget next="" prev="" />
    </numbercontrol>

    'The above creates an initiative number control that calculates an initiative modifier by adding the character's dexterity bonus and level based initiative bonus for each of the defined character classes. Since each of the class init bonuses is zeroed out when the class isn't selected in the class control the proper init bonus is calculated.

    Voila! Kind of complicated, but it works. If anyone else knows a simpler way please share it.

  4. #4

    Join Date
    Dec 2004
    Location
    Chicago-ish
    Posts
    2,234
    That has got to be the most impressive first post ever made by someone!



    Thanks for sharing.

    rv

  5. #5
    Wow, I agree, quite impressive. Only thing is that wasn't quite what I was looking at doing (but I will definitely use it in another section of my character sheet).
    Here is an example of what I am doing. Based on 1st Edition rules, if a character has a strength of 17 they have a 1-3 chance on a six sided dice to "Open Doors". I would like to have the character sheet fill this in for them automatically. So when the user creates their character they type in their strength and this will populate the edit box "Open Doors" with the appropriate text. Table:
    If their strength is a 3-7 they would open a door on a 1
    If their strength is a 8-15 they would open a door on a 1-2
    If their strength is a 16-18(50) they would open a door on a 1-3
    If their strength is a 18(51)-18(99) they would open a door on a 1-4
    If their strength is a 18(100) they would open a door on a 1-5

    So you see that I have to enter a string into the "Open Door" box based off of what their strength is. I have been able to get boxes populated based on what the strength is as long as the box I am populating is an integer. I just can't figure out how to do this if the box I am populating is a string. Sorry if there was any confusion. I did like what you did with populating init box based on what class they are. Very creative.

  6. #6

    This may qualify as a bug exploit, but...

    I have discovered that it is possible to have more than one multistate control with the same name in the charsheet.xml file. It is also possible to assign different properties to each multistate control, for example:

    <multistate name="Weapon">
    <bounds rect="55,41,150,20" />
    <state value="0" icon="longsword_picture" />
    <state value="1" icon="shortsword_picture" />
    <state value="2" icon="dagger_picture" />
    </multistate>

    <multistate name="Weapon">
    <bounds rect="55,61,150,20" />
    <state value="0" icon="1d8_text_image" />
    <state value="1" icon="1d6_text_image" />
    <state value="2" icon="1d4_text_image" />
    </multistate>

    'FG will only store one <intvalue name="Weapon" value = "weapon value"> line in the character data and both "Weapon" multistate controls will be assigned the same value. Therefore, changing either multistate control automatically causes the other multistate control to change as well.

    We can take advantage of this behavior to accomplish some neat things:

    The example I've illustrated above would let the user cycle through pictures of weapons to choose a weapon and a corresponding multistate control would change to display a text image with the correct damage die for the selected weapon. The only drawback is that the controls are linked both ways, i.e. clicking on the damage control will cause the weapon picture to change as well.

    So, if you want, you can create text images for the values 0 to 20 and use them as the icons for a "Strength" multistate control with 21 (don't forget 0) state values. You could then have a second "Strength" control with text images "1-2", "1-3", etc. for icons and use this second "Strength" multistate control to display your open doors value.

    Again, kind of complicated, but it's the only way to accomplish what you're trying to do that I can think of.

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
  •  
5E Character Create Playlist

Log in

Log in