PDA

View Full Version : Populating a field



GMBazUK
August 1st, 2006, 19:06
Ive checked this forum but cant find a solution to a problem which someone else must have encountered, so here it is...

If I type "Fred" in field A, I would like field B to output the value "1".

Ive looked into using a value map Fred:1, but it didnt work.

<stringcontrol name="maincontrol">
<bounds rect="49,136,30,18" />
</stringcontrol>
<numbercontrol name="dependanttext">
<value type="modifier" />
<bounds rect="84,136,30,18" />
<source name="maincontrol" valuemap="Fred:1,Bert:2,Ernie:three" />
</numbercontrol>

Can it be done?

Baz.

joshuha
August 1st, 2006, 19:32
Not until next version. Currently you cannot use a valuemap to a text value.

GMBazUK
August 1st, 2006, 19:35
Ahhhhhhhhhh! I thought as much.

Thanks anyway Joshuha

Baz.

joshuha
August 1st, 2006, 20:02
Depending on what you are trying to do a Multistate could possibly work and allow you to use those values. You would need to make a PNG file with the words Fred, Bert, etc.


<multistate name="workaround">
<bounds rect="x,y,width,height" />
<state value="0" icon="fred" />
<state value="1" icon="bert" />
<state value="2" icon="ernie" />
</multistate>


Clicking on the icon would cycle through the PNG files and the value of the control "workaround" would be 0/1/2 which you could use in other controls. Not sure if this was what you wanted but it may work.

The icons are definied in the graphics.xml just in case you were wanting to do this.

GMBazUK
August 2nd, 2006, 05:38
Im no xml expert, but wouldnt that poplate the output field with the text, if I input a specific number?

I was trying to get it to work conversely. i.e. input text, and get number output.

I think someone (in the past) has suggested creating a list from which you can select an item, which would have a value associated with it so...
Pick "Fred" and get "1".

Thanks again though Joshuha, much appreciated.

Baz.

joshuha
August 2nd, 2006, 14:40
Well I havent tried it yet but the state value should be able to used as a source for a number control. Thereby when selecting Fred/etc. it stores the corresponding number that you could use as an output to another field.

GMBazUK
August 2nd, 2006, 15:03
OK. Now that sounds really interesting if the state value of the multistatecheckbox or in this case the image can be used as an indicator for the output value in the related field.

Unfortunatley, I dont know the code, but I'll certainly give it a go.

Multiplestate checkboxes I can handle. Just have to figure out how to assign an image rather than a state to them. LOL

Thanks again.
Baz.

GMBazUK
August 2nd, 2006, 15:48
What Ive done is follow Cantstanzya's advice:

Ive created a multistatecontrol for the proposed text field

<multistate name="sunsign">
<bounds rect="370,168,120,23" />
<state value="0" icon="ulandus" />
<state value="1" icon="aralius" />
</multistate>

Ive created two new png files for the states and put them in the myruleset/icons folder.

Ive added a link to these icons in my ruleset/graphics.xml

<icon name="ulandus" file="rulesets/myruleset/icons/ulandus.png" />
<icon name="aralius" file="rulesets/myruleset/icons/aralius.png" />

Unfortunately, when I click on the character sheet to initialize either png, FG crashes.
The png files are 2kb each in size.

Anyone have any ideas?

Baz.

Cantstanzya
August 2nd, 2006, 17:07
Unfortunately, when I click on the character sheet to initialize either png, FG crashes.
Anyone have any ideas?

Baz.If you ever had "sunsign" setup as a string it will crash. You must go into the db.xml and remove any "sunsign" that is setup as a string.

GMBazUK
August 2nd, 2006, 17:33
As Archemedes once pronounced in the bath...
"Woot! Game on."

Genius Cantstanzya... well er, very helpful.

Thanks.

Baz.