PDA

View Full Version : Set initial value in a number or string control



Nilliom
February 24th, 2007, 16:48
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

Nilliom
February 27th, 2007, 22:48
Anybody know about this. I am know about fantasy grounds and trying to do my ruleset.

Thanks

unimatrixzero
February 28th, 2007, 02:06
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>

Archmage
February 28th, 2007, 03:34
The following bit of XML is from d20_adventure.xml


<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


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

joshuha
February 28th, 2007, 04:18
You'll be glad to hear in FG 2.0 its much easier but what Archmage posted above will work.

Dachannien
February 28th, 2007, 15:37
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.

Nilliom
February 28th, 2007, 17:44
Thanks for your help I will try this tonight