PDA

View Full Version : editing db.xml - not sorting nodes correctly



rom90125
May 26th, 2006, 19:24
I'm editing the db.xml file for a port of the Shackled City adventure path. What I want is a series of links that look like this:

Preparation
Chapter 1
Chapter 2
Chapter 3
...
Chapter 12.


What I am getting is this:
Chapter 1
Chapter 10
Chapter 11
Chapter 12
....
Preparation.

I had assumed that the parser would sort by node name, thus the 'Preparation' node has a name "00001", and Chapter 1 has a node name of "00100", Chapter 2 node name equals "00200", etc.

It looks like the parser is sorting based on the stringvalue name for each node and not the node name value. Can you help me specify via xml the desired sorting order I listed above?

Here is how I have the node's coded:

<node name="00001">
<stringvalue name="name">Preparation</stringvalue>
<formattedtext name="text">
<linklist>
<link class="item" recordname="00005"><b>The Kidnappings </b></link>
<link class="item" recordname="00010"><b>Recent Abductees </b></link>
<link class="item" recordname="00015"><b>Rumors in Cauldron </b></link>
<link class="item" recordname="00020"><b>Researching the Villians </b></link>
</linklist>
</formattedtext>
</node>
<node name="00100">
<stringvalue name="name">Chapter 1</stringvalue>
<formattedtext name="text">
<linklist>
<link class="item" recordname="00101"><b>Life's Bazaar </b></link>
</linklist>
</formattedtext>
</node>
<node name="00200">
<stringvalue name="name">Chapter 2</stringvalue>
<formattedtext name="text">
<linklist>
<link class="item" recordname="00201"><b>Drakthar's Way </b></link>
</linklist>
</formattedtext>
</node>

Thanks much.

Griogre
May 26th, 2006, 19:52
I'm editing the db.xml file for a port of the Shackled City adventure path. What I want is a series of links that look like this:

Preparation
Chapter 1
Chapter 2
Chapter 3
...
Chapter 12.


What I am getting is this:
Chapter 1
Chapter 10
Chapter 11
Chapter 12
....


You are correct it sorts by string values. I could get you a learned discussion on xml... :p but Honestly the easiest, simpliest what to solve you problem is to change your chapter names so values less than 10 are like this:

Chapter 01
Chapter 02
Chapter 03 ... etc. They will then sort correctly.

Back to the FG. Entries in the Storybook, Map/Images, Personalities etc are all sorted by the displayed string. Because of this when I do a set of encounters I always number them starting at with 00 for introductionary/background material, then 01 "Encounter Name Here" etc.

As long as we are discussing Chapters - you may find it usefull to know you can add additional tabs to the various DM "books". I do not believe that is documented anywhere except on the boards and in a patch readme. I also believe you could make a case for making each "Chapter" of the Shackeled City Adventure into a seperate module. IMHO there is little reason to put all the data in one campaign file - it just makes it harder to find the part you are currently running. In the interest of full discosure - some people hate using modules so YMMV.

kalmarjan
May 26th, 2006, 23:08
Giogre:

Correct. Only thing is if you have more than 99 entries, the mess starts off again.

Rom:

Best thing to do is figure out how many entries there are and go from there. Since the xml is sorted alphabetically, (Numerically as well) this is why you are getting the messed up chapters. (Because the computer equates 10 as being before 9. The sorting begins with the frist character, then goes to the second.) If you have entries in the Hundreds (Such as with the adventire path) then you can run into real problems.

Two ways to get around this as well is to do the following:

1) Make a tab that is just a container for all your entries. Have another tab with a table of contents entry that links back to these. Sorting issue solved. You can even place the TOC entry in your hotkeys so you do not have to search for it.

2) Break each chapter into modules, and have a "sandbox" campaign. One thing to look out for though; make sure that the id for the entries (<node name="#####" />) do not conflict. This would not be a problem if you only have one module open at a time, but if you ever open up two with conflicting nodes, you can run into memory troubles, if FG just does not overwrite the entries with the first "unique" id.

I hope that helps, if you have any other questions, PM me and I will be glad to help. Like you, I have a big campaign that I have transcribed slowly *over the past year* called Return to the Temple of Elemental Evil that has over 600 rooms, and over 2000 different entries, along with around 500 NPCs, so I have had an opportunity to figure out FG's quirks. :)

Sandeman

rom90125
May 27th, 2006, 03:33
Thanks for the great info guys. A few more questions:

kalmarjan:
Can you provide a quick and basic example what you mean:

1) Make a tab that is just a container for all your entries. Have another tab with a table of contents entry that links back to these. Sorting issue solved. You can even place the TOC entry in your hotkeys so you do not have to search for it.

2) Break each chapter into modules, and have a "sandbox" campaign.

I have a good amount of experience with programming, just not with XML. I totally understand the ideas you present here, however I lack the understanding of the syntax to code it up.

kalmarjan
May 27th, 2006, 03:46
Well, the good news is that you do not need to have any experience with xml to do this; you can do it right in FG.

Once you have your entries typed in. (Or however you do this) you can create a new tab by right clicking on the tab and choosing the create new tab icon. Then you drag your story entries to this tab.

As for making a TOC contents, make a new story item, and list out the names of your story items.

Highlight this, right click and select the link icon.

Then it is just a matter of placing the draggable boxes into your link boxes and viola! You now have a table of contents.

Drag the story link for your table of contents into your hot links bar, and there you have it.

As for modules, an excellent tutorial is located here:

https://www.murderatavedonhill.com/visualfaqs.htm

Hope that helps

Sandeman

rom90125
May 29th, 2006, 18:05
Kalmarjan,

Thanksa again for the great info. Hopfully I will get a chance to play around with FG more tonight and start implementing the TOC and modules.