Jump to content
Eternal Lands Official Forums
Sign in to follow this  
Quinticus

XML format

Recommended Posts

I know it took far longer than it should (got the flu, don't have my computer, etc), but it's done now.

http://ttlanhil.tripod.com/cgi-bin/book.pl has been updated to work with the current book format. The result matches the books that are included for the races in the new character creation page, too, so I'm taking that as a good sign 8^)

 

note that this doesn't make use of images or anything, it's just able to put the text into the XML. if you want images, you can always add the code manually. (reference)

 

if there are any bugs, please let me know ASAP, otherwise anyone should be able to use this to convert books

Edited by ttlanhil

Share this post


Link to post
Share on other sites

Currently i'm at school so i have none of my resources with me now, but as soon as i get back to the office i'll get to work testing it out. Thanks a bunch, it should help a lot! I'll let you know if I encounter any bugs along the way.

Share this post


Link to post
Share on other sites

I made a couple more adjustments to it, now you can use it from outside the bookmaker.

for examples, see

http://www.eternal-lands.com/forum/index.p...ndpost&p=177541

and

http://www.eternal-lands.com/forum/index.p...ndpost&p=177517

 

if you're really keen, you can look at the page source and see that those links actually contain the stories. the short version is:

 

http://ttlanhil.tripod.com/cgi-bin/book.pl?title=Title of story&author=Whoever wrote it&body=the entire story goes here.\nuse slash n for a new line\nso this would have three lines(copy this whole URL into your browser to see it in action)

 

to get multiple lines in the body, use `\n' in it. this makes it go to a new line.

 

to be able to do chapters, paragraphs, all that... see the doc on the bookmaker itself

 

note that the forum is really picky about the URLs it accepts as valid, you'll probably need to go through and use URL encoding to get it to work as a link here... so don't bother with that 8^)

Edited by ttlanhil

Share this post


Link to post
Share on other sites

As far as putting the books into the CVS once we get the conversion to XML done (along with graphics etc.), how do we go about getting them placed into the code and such? Lachesis, can you shed any light on the subject? Also, by chance, do you think you could explain the following line of code? Or should i ask wytter how to get the images into the whole project?

 

<image x="" y="" w="" h="" u_start="" u_end="" v_start="" v_end="" src="/path/to/image.bmp">image text</image>

Edited by Quinticus

Share this post


Link to post
Share on other sites

The x, y is the start location in the book.

The w is the width

The h is the height

The u_start is the starting u texture coordinate. ~x axis

The v_start is the starting v texture coordinate. ~y axis, but reversed so 0.0 is on the top, 1.0 is on the bottom

The u_end is the ending u texture coordinate.

The v_end is the ending v texture coordinate.

A texture coordinate shows the location of the pic you wish to display within a texture (within a bitmap).

Image text denotes the text you want to have around/next to the picture

 

An example would be the following:

 

               <image x="50" y="120" w="120" h="120" src="./maps/seridia.bmp">Seridia</image>

That would just show the map of Seridia - We do not have to split this up hence specify the texture coordinates since we wish to use the entire picture. Otherwise texture coordinates will be between 0.0f and 1.0f.

Edited by Wytter

Share this post


Link to post
Share on other sites

In the new format, the images will be defined in a slightly different way. I'm still working on it, but some information is already available in the example files.

Share this post


Link to post
Share on other sites

Would it be possible for one (or maybe even more) of you guys to be able to get together with ttlanhil and I and explain the process by which we get books added? All of the information that we need is parcelled out amongst the different forums. And some of the questions we may have might not be answered through the various channels of discussion we have here.

 

Since CK is out, could either Lachesis, Wytter, or anyone else who knows the COMPLETE process join us (perhaps even Lyanna, just to make sure all bases are covered) in game sometime? What ever time is convenient for you guys would work fine for me. I think ttlanhil and I have pretty much the same hours online. I'm on from 9:00 - 4:00 EST US time. But I can be on after 7:00 as well.

 

We have several stories converted (with out graphics), all we need now is information on how to complete the process.

Share this post


Link to post
Share on other sites

To add books to your maps you will use the tag called use_area.

 

Each use_area has a new option called open_book - if you set anything here, you can't have it teleport people around etc.. The open_book is followed by the unique id of the book that's supposed to be opened when the client clicks on the given object.

 

Example (taken from guildmap_co.def):

 

"to votd"
use_area
min_x: 70
min_y: 25
max_x: 72
max_y: 28
teleport_x: -1
teleport_y: -1
teleport_map: -1
map_object_id: 56
inv_object_id: -1
send_sparks: 0
open_book: 2
too_far_text: `You try reading the book, but soon realize that you have to get closer`
use_text: ``
wrong_object_text: `Nothing happens.`

With the new format it will look like this:

"to votd"
[use_area]
min_x: 70
min_y: 25
max_x: 72
max_y: 28
teleport_x: -1
teleport_y: -1
teleport_map: -1
map_object_id: 56
inv_object_id: -1
send_sparks: 0
open_book: 2
too_far_text: `You try reading the book, but soon realize that you have to get closer`
use_text: ``
wrong_object_text: `Nothing happens.`
[/use_area]

 

You can also make clicking on items read a book using open_book_on_read: <book_id> but just leave that up to the server devs - request it and we shall give you what you want :(

 

When you want to write a book, you must use the following format for the server-side books (should really just be used for quests, and small books).

 


[book]
      book_id: 2
      title: Test book 2
      type: 1
      [server]
              filename: books/testbook.eml
      [/server]
[/book]

The books/testbook.eml is located server-side. It wlil look like this:

 

[book]
             

                      [text]
                              And they went sailing, yea!
                              I walked a mile in your shoes - but htey never fitted me
                      [/text]
                      [image]
                              file: textures/items9.bmp
                              u_1: 0
                              u_2: 1
                              v_1: 1
                              v_2: 0
                              startx: 20
                              starty: 20
                              width: 100
                              height: 100
                              text: this is a picture of their swamp
                      [/image]
              
              

                      [text]
                              This is a special test...
                      [/text]
                      [text]
                              tetsldksx
                              sadælkasdæ
                              asdlæksadælsad
                              sæadsaældkasd
                              asækdjsaækdjasd
                              askldjksaldjasd
                              ækasjdlksajdsad
                              ækasjdælksajda
                              askæjdlækajdskslad
                              æjasdlksajdlsakjdsad
                              jakldjalksjdsad
                              klasdjlkasjdlksajd
                              æjasdælkjasdkljsad
                              ækajsdkælajsdlkasjd
                              ækajsdkælajsdlkasjd
                              ækjalkdsjalksdjsa
                              æjaskdlasjdlkasj
                      [/text]
              
              

                      [text]
                              New text
                      [/text]
              
              

                      [text]
                              The end.
                      [/text]
              
[/book]

 

For the local books (the books that are supposed to be in the books/ directory) you have to do the following to make them readable:

[book]
      book_id: 1
      title: Test book
      type: 1
      [local]
              filename: books/testbook.xml
      [/local]
[/book]

 

The file opened will one of the .xml files located client-side.

 

<book title="Cry me a river">
       <page>
                   <title></title>
                   <author></author>
                   <text></text>
                   <image></image>
                   <text></text>
                   <title></title>
                   <text></text>
       </page>
       ...
       <page>
       </page>
</book>

Edited by Wytter

Share this post


Link to post
Share on other sites

the bookmaker has been updated to be able to do EML as well.

 

I've decided not to make .def fragments, because it will confuse some people, and most of it will need to be filled in by devs later anyway. the stories, on the other hand, where wrapping it up in XML is repetative and consistant, works a lot better for being scripted

Edited by ttlanhil

Share this post


Link to post
Share on other sites

Just tried making a book with this:

Open the window

Let me come in

Following the light

Murdering at sight

And it generated:

[book]
  

     [title]Testbook[/title]
     [author]Wytter[/author]
     [text]Open the window[/text]
     [text][/text]
     [text]Let me come in[/text]
     [text][/text]
     [text]Following the light[/text]
     [text][/text]
     [text]Murdering at sight[/text]
  
[/book]

 

But should have generated:


[book]
  

     [title]Testbook[/title]
     [author]Wytter[/author]
     [text]Open the window

Let me come in

Following the light

Murdering at sight
     [/text]
  
[/book]

Share this post


Link to post
Share on other sites

Just tried making a book with this:

Open the window

Let me come in

Following the light

Murdering at sight

And it generated:

[book]
  

 

But should have generated:


[book]
  

179083[/snapback]179083[/snapback]


     [title]Testbook[/title]
     [author]Wytter[/author]
     [text]Open the window[/text]
     [text][/text]
     [text]Let me come in[/text]
     [text][/text]
     [text]Following the light[/text]
     [text][/text]
     [text]Murdering at sight[/text]
  
[/book]

     [title]Testbook[/title]
     [author]Wytter[/author]
     [text]Open the window

Let me come in

Following the light

Murdering at sight
     [/text]
  
[/book]

 

i was under the impression that whitespace would be ignored, and the xml displays I've seen tend to ignore newlines as well. having it come out the way it does makes sure that the lines are inserted. but if the book renderer does honour newlines, then I can strip that down a bit and still have it show up the way the author intends

Share this post


Link to post
Share on other sites

The normal xml-books are the same thing - they'll recognize the newlines properly.

Share this post


Link to post
Share on other sites
The normal xml-books are the same thing - they'll recognize the newlines properly.

179089[/snapback]

ahh, okay. I've changed it a bit, now it won't split unless the author/converter explicitly tells it to.

 

also had a few other fixes while I was at it, including changing the non-standard quotation marks.

on that topic, if anyone sees something come out looking funny (like how †comes out as aQE or some such) then let me know. I'll add it to the list of characters to be 'shrunk' down to the equivelent (in this case, †becomes ")

 

edit: oh yeah, for those books I posted a "converted" link to, no they don't need to be updated (unles syou saved to had drive). those links run through the converter each time. loading them again will give the updated output

Edited by ttlanhil

Share this post


Link to post
Share on other sites

Then what should i use to tell the converter to place a new line in XML. I took a poem and all the white space was ignored. I converted it in EML and the spacing worked fine. You'll find two examples below.

 

[book]
  

     [title]Ballad of the Red Moon War[/title]
     [author]Razia[/author]
     [text]The red moon lights the sky
Trembling earth's warning unheeded
Till the shrill of a sleeper's cry
o AWAKENED! o

What tragic call to arms
Gargoyles swarmed from Vermor Castle
Luxin's soldiers shouted alarms

Goblins too; all darkness' host
Oger's midst the titanium mine
The demons of Tahraji's savage coast

Portland threatened, then overrun!
Till brave warriors make their stand
And when we thought all had been won...

Cave Trolls strike the crystal cave!
The slaughter of miners, innocents all
Made many a mournful grave

The warriors of the dwarven valley
Three invasions did repel
And then....
Mortos' grand finale!

Killaren Fields became a Hell
Of Chimeran Wolves all running free
Blood and fangs of darkness' spell

Do not forget the fighters, brave or coward
Do not forget the innocents who fell
Do not forget the victims, devoured
Do not forget, though all is well

Though all the monsters are as before
And the sky is beautiful clear
Yet be on guard 
For darkness favors war
And Mortos still holds influence here[/text]
  
[/book]

Here's the EML :icon13:

 

 <?xml version="1.0" encoding="UTF-8" ?> 
- <book title="Ballad of the Red Moon War">
- <page>
 <title>Ballad of the Red Moon War</title> 
 <author>Razia</author> 
 <text>The red moon lights the sky Trembling earth's warning unheeded Till the shrill of a sleeper's cry o AWAKENED! o What tragic call to arms Gargoyles swarmed from Vermor Castle Luxin's soldiers shouted alarms Goblins too; all darkness' host Oger's midst the titanium mine The demons of Tahraji's savage coast Portland threatened, then overrun! Till brave warriors make their stand And when we thought all had been won... Cave Trolls strike the crystal cave! The slaughter of miners, innocents all Made many a mournful grave The warriors of the dwarven valley Three invasions did repel And then.... Mortos' grand finale! Killaren Fields became a Hell Of Chimeran Wolves all running free Blood and fangs of darkness' spell Do not forget the fighters, brave or coward Do not forget the innocents who fell Do not forget the victims, devoured Do not forget, though all is well Though all the monsters are as before And the sky is beautiful clear Yet be on guard For darkness favors war And Mortos still holds influence here</text> 
 </page>
 </book>

And heres the XML :fire:

 

Forgive me if you have i have to be walked through most of this stuff, i've never encounted XML or much programming before. Once i get the drift, though, i'll be confident enough to handle my own. :axeman_rune:

Share this post


Link to post
Share on other sites

when you use the 'view in browser' option (I can tell since there's the '-' to show the area can be shrunk), your browser will ignore newlines. if you view the raw XML, the newlines will be shown.

I;m not sure how to make it so browser will honour the newlines, but as long as you use the download or view raw options, you will get the right output (even the right end of line characters... if you open it with a text editor on windows, it will look funky because of that)

Share this post


Link to post
Share on other sites

Ah, gotcha. Thanks for the info...i'll get to work on making them ready to go placed in game. :P

 

Also downloaded the document:

 

 <?xml version="1.0" encoding="UTF-8" ?> 
- <book title="Ballad of the Red Moon War">
- <page>
 <title>Ballad of the Red Moon War</title> 
 <author>Razia</author> 
 <text>The red moon lights the sky Trembling earth's warning unheeded Till the shrill of a sleeper's cry o AWAKENED! o What tragic call to arms Gargoyles swarmed from Vermor Castle Luxin's soldiers shouted alarms Goblins too; all darkness' host Oger's midst the titanium mine The demons of Tahraji's savage coast Portland threatened, then overrun! Till brave warriors make their stand And when we thought all had been won... Cave Trolls strike the crystal cave! The slaughter of miners, innocents all Made many a mournful grave The warriors of the dwarven valley Three invasions did repel And then.... Mortos' grand finale! Killaren Fields became a Hell Of Chimeran Wolves all running free Blood and fangs of darkness' spell Do not forget the fighters, brave or coward Do not forget the innocents who fell Do not forget the victims, devoured Do not forget, though all is well Though all the monsters are as before And the sky is beautiful clear Yet be on guard For darkness favors war And Mortos still holds influence here</text> 
 </page>
 </book>

 

As you can see the new lines aren't being inserted, i'm probably just doing something wrong :P.

Edited by Quinticus

Share this post


Link to post
Share on other sites

if you right-click -> view source, you'll see the newlines.

after you downloaded it, opening it again in your web browser will make the web browser try to render it again, which means it ignores newline characters as before

(alternatively, you can open it in notepad, but then you'll see black boxes where the new line should be. it's in unix format, not windows)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×