DICE PACKS BUNDLE
  1. #1

    Set initial value in a number or string control

    How can we set an initial value in a number or string control.

    for example I would like to set the attributes to be at minimum 1 so a new sheet would already have the value at 1 (number control)

    Same for string control.

    Thanks

  2. #2
    Anybody know about this. I am know about fantasy grounds and trying to do my ruleset.

    Thanks

  3. #3

    Thumbs up

    something like this might work
    this will give a starting value of 3....change the value map to get a different value

    <numbercontrol name="startingvalue">
    <invisible />
    </numbercontrol>


    <numbercontrol name="strength">
    <bounds rect="165,238,36,30" />
    <noreset />
    <description text="Strength" />
    <source name="startingvalue" op="+" valuemap="0:3" />
    </numbercontrol>

  4. #4
    The following bit of XML is from d20_adventure.xml

    Code:
    <stringcontrol name="name">
    <bounds rect="45,12,-52,20" />
    <empty value="&laquo; New Personality &raquo;" />
    <createidentity />
    </stringcontrol>
    It would appear that using the <empty> tag in a string control will allow you to specify a default value for the control. This value is then removed when the user enters their own value in the control. I'm not sure if this tag can be used in a number control or not.


    The following is from Charsheet.xml
    Code:
    <numbercontrol name="acbasehelper">
    	<invisible />
    </numbercontrol>
    <numbercontrol name="ac">
    	<bounds rect="289,423,34,23" />
    	<nodrop />
    	<nodrag />
    	<noreset />
    	<source name="acdexbonus" op="+" />
    	<source name="acsizebonus" op="+" />
    	<source name="acarmorbonus" op="+" />
    	<source name="acshieldbonus" op="+" />
    	<source name="acmiscbonus" op="+" />
    	<source name="acbasehelper" valuemap="0:10" />
    </numbercontrol>
    Here, they use an invisible number control called acbasehelper to set the "ac" number control with a value of 10. The <source> tag links the "ac" number control to the "acbasehelper" number control, and so when "acbasehelper" equals 0 (which it will by default), the "ac" number control will equal 10.

    That's sort of a sloppy hackish way to accomplish the simple task of setting a default value, but that's how Smiteworks seems to do it.
    Last edited by Archmage; February 28th, 2007 at 03:41.

  5. #5
    You'll be glad to hear in FG 2.0 its much easier but what Archmage posted above will work.

  6. #6

    Join Date
    Feb 2006
    Location
    Fairfax County, Virginia
    Posts
    499
    Note that in FG1, using <source ...> to set the default value of a control doesn't work exactly as you might expect. If you try to import that value into another sheet (e.g., combat tracker), the imported value will be off by whatever the sourced value is. This is because the way a numbercontrol works, it has its own value, and then any source tags are added onto that for the purposes of the display, but when the value of the numbercontrol is imported elsewhere, only the actual value (ignoring the source tags) gets imported.

    As long as you're not getting too fancy, though, it will work how Archmage said.

  7. #7
    Thanks for your help I will try this tonight

Thread Information

Users Browsing this Thread

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

Bookmarks

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 Product Walkthrough Playlist

Log in

Log in