PDA

View Full Version : stringcontrol data limit?



GeeWhiz2000
July 23rd, 2005, 06:57
I'm getting pretty frustrated here.

I am working on a custom ruleset, and everything works peachy, until I get to the Inventory tab.

For inventory I created a single large <stringcontrol> to house the players inventory. Unfortunatly, there appears to be a hard coded maximum length of text that one can put in this field. It stores it fine WHILE playing, but when it saves to the db.xml file it cuts it off and everything after this 'cutoff' length is discarded.

I'm miffed as to what I can do about this. I can't even put 3 items with their full properties, etc into the inventory box w/o it cutting off the end, or the other 15 items I have.

Is there a workaround or solution for this? I tried a <formattedtext> field there, but apparently they can't be used on character sheets, because the app crashes to desktop when I try that. (Exception)

Please help! Thanks in advance for any advice! :?

Crusader
July 23rd, 2005, 08:54
Here's what I did for my inventory - a windowlist: This works the same way as the spell list in the original d20-ruleset. First off, in the charactersheet-page that holds the inventory I have this:



<windowclass name="charsheet_inventory">
<frame name="charsheet_inventory" />
<datasource name="charsheet" />
<defaultsize width="550" height="654" />
<sheetdata>
<windowlist class="ItemEntry" name="ItemList">
<allowcreate />
<allowdelete />
<nestdata />
<bounds rect="60,83,431,396" />
</windowlist>
<scroller>
<bounds rect="445,452,45,27" />
<target name="ItemList" />
<button normal="button_scroller" pressed="button_scroller_down" />
</scroller>
</sheetdata>
</windowclass>


Then, on a separate entry one needs to define the fields within the list:



<windowclass name="ItemEntry">
<frame name="ItemEntry" />
<datasource name="Item" />
<defaultsize width="419" height="18" />
<sheetdata>
<stringcontrol name="Item">
<bounds rect="0,0,136,18" />
</stringcontrol>
<stringcontrol name="ItemWeight">
<bounds rect="137,0,47,18" />
</stringcontrol>
<numbercontrol name="ItemQuality">
<bounds rect="184,0,52,18" />
<noreset />
</numbercontrol>
<stringcontrol name="Location">
<bounds rect="238,0,180,18" />
</stringcontrol>
</sheetdata>
</windowclass>


If you don't want separate fields within the inventory entry, you could get away with a single stringcontrol holding all data for that item.

The last two steps consists of creating graphics for the item-entry, in my case there's a couple of fields on a transparent space, but if you only want a single string on it all you need is a transparent space with a line at the bottom. Then you need to define it in your graphics.xml file:



<framedef name="ItemEntry">
<bitmap file="rulesets\HarnMaster\frames\ItemList.png" />
<topleft rect="0,0,0,0" />
<top rect="0,0,0,0" />
<topright rect="0,0,0,0" />
<left rect="0,0,0,0" />
<middle rect="0,0,419,18" />
<right rect="0,0,0,0" />
<bottomleft rect="0,0,0,0" />
<bottom rect="0,0,0,0" />
<bottomright rect="0,0,0,0" />
</framedef>


To be quite honest, I'm not quite sure what all the numbers here do, the 'middle rect' entry seems to be the only one that needs data, and as you can see in my case, my itemlist entry consists of an image that is 419 pixels wide and 18 pixels high.

On the charactersheet, you will have an empty space, that when rightclicked upon produces this:

http://www.arecta.se/images/createitem.jpg

When you click on the bottom icon with the three squares and the arrow, a new itementry is created.

This will create something like this in the character xml-file:



<node name="Item">
<node name="00001">
<stringvalue name="Item" value="Waterskin" />
<intvalue name="ItemQuality" value="0" />
<stringvalue name="ItemWeight" value="5" />
<stringvalue name="Location" value="Backpack" />
</node>
</node>


If you click on an existing entry, you get this:

http://www.arecta.se/images/inventoryui.jpg

Where the skull deletes the item clicked upon. Also note the scroller button in the right corner, this will automatically appear when the itemlist exceeds the space available. The location of the scollerbutton is defined by the scroller-section in the inventory_charsheet.

I hope you find this useful. Please let me know if you want further explanations.

GeeWhiz2000
July 23rd, 2005, 20:03
Thank you for the detailed post.

I'll give that a shot and see how it works out.

I just rewrote the entire ruleset for the OCF/DCF system we use and when I got to inventory I wanted to be lazy ;)

Thank you much!

Snikle
April 4th, 2006, 08:19
So the scroller will only work on a group of frames within a windowclass? Not a single multiline windowclass?

Crusader
April 4th, 2006, 10:38
I'm sorry but I'm not sure I understood the question. What is it that you want to do?

/EDIT: Nevermind, I read your post on the other thread. I suspect that isn't possible, but I'm not sure.

Veelivar
April 11th, 2006, 22:01
@Crusader The only problem I see with that (it is what I wanted to do) is that you then can't automatically add up allt he weights of the items in the inventory. If you knoe a way that you can then I would be *very* pleased to know about it :)

What I ended up doing what having a *reasoble* number of slots (27 in my case cos thats waht woudl fit into the space I had) and then adding ip up seperatly. This lead to an awful lot of cuttign and pasting and modify in the xml though...

Dan.

Toadwart
April 11th, 2006, 22:58
Ran into same problem with adding up weights for inventory items.
My temporary clunky solution (hoping 1.06 provides a nicer way of doing this) was to make a total field which can be reset (middle-mouse click sets ti back tro 0) and acceptsdrop with operation="+".
The users can reset the field then drag (one at a time) the weight of each inventory item down onto the total field and it sums them up.

Crusader
April 12th, 2006, 08:27
Yeah, I was kinda hoping for 1.06 to be the rescue as well.