Author Topic: How to add images to BOOKS or MAPS.  (Read 791 times)

Venalan

  • Global Moderator
  • Hydlaa Notable
  • *
  • Posts: 630
    • View Profile
How to add images to BOOKS or MAPS.
« on: December 24, 2014, 06:50:04 pm »
Hello all.

For a while PS has had the ability to display images in a book which have been bundled with the client. You could use any image you have, but if you show someone else the book they wont see the image unless you send them the image and tell them how to add it to their client. What I am doing to do here is explain how you can display an image included with the client in a book.

First, you could do this from in game but the the way to do it it will be much easier to write the text outside of PS and then load it into a book in game.



1 - Where are the images I can use?

The names you need to use are the tool tips which appear from icons you see when adding images to shortcuts, so the easiest way is to browse there to find images you want to use and then copy the names of the are from there. The name you get here is the name that icon/image has been defined in the image data.

For example if you mouse over one of the bracer icons you see "/planeshift/materials/bracer_greater_azure_icon.dds" you should use that whole name when using that icon in a book or map.

You can however also directly open up the image list files. The image files are found in two (or more) place(s), both in the directory where you installed PlaneShift. You are looking for a file called "imagelist.xml". You need to navigate to "PlaneShift\art\skins" and then open one of the zip files there, or open the folder called base, and then the client_base.zip file. All of these will contain an "imagelist.xml" file. Each will contain a slightly different set of images, the client_base folder will contain images used by every client so these are safe to use so everyone who reads the book can see the images. The imagelist.xml from the skin files defines images used when that skin is used. Now if you are using custom skins the the names of images in that imagelist will very likely not be present in other peoples games so they will see nothing. I would suggest using images which are clearly used by everyone.

Once you have opened the imagelist.xml you will see massive long lists of things more or less like these examples.

This is taken from a imagelist from a skin file.
<image file="/paws/real_skin/icons.png" resource="ButtonAttackDefensiveActive" >
    <texturerect x="512" y="448" width="64" height="64" />
</image>

These two are taken from the client_base imagelist.xml
<image file="/planeshift/materials/broadsword01a_icon.dds" resource="/planeshift/materials/broadsword01a_icon.dds" />
<image file="/planeshift/materials/broadsword01b_icon.dds" resource="/planeshift/materials/broadsword01b_icon.dds" />
<image file="/planeshift/materials/broadsword01c_icon.dds" resource="/planeshift/materials/broadsword01c_icon.dds" />

The important thing from all three of these are the resource="SomeRandomName" bits. You will need these later, so either

ButtonAttackDefensiveActive
or
/planeshift/materials/broadsword01a_icon.dds
or
/planeshift/materials/broadsword01b_icon.dds



2 - How to write the book to show an image.

This is where the way you write the books will have to totally change. You can not just write like you have and add <image="bla"> as the text you have used to try and make the book show an image will just show as text.

What I will do below is explain how to write a simple book which will contain a paragraph of text, one image, and then a second paragraph of text.

Because you are trying to mix text with images you need to tell the game which bits of the book are text, and which bits are images. So the first bit you add is

<Contents><Content type="text">

Then after this you add the text you want to write.

<Contents><content type="text">Come and see a wonder of the Hydlaa. Weapons made by the great smith HARNQUIST!!!! See blow for images of his amazing skill.

Once you have written the text you need to tell the game that the area that is just text had ended. To do this you add '</Content>'

<Contents><Content type="text">Come and see a wonder of the Hydlaa. Weapons made by the great smith HARNQUIST!!!! See blow for images of his amazing skill.</Content>

Next I want to add an image, so I need to tell the game that I want it to show one. I will use an example from above to show you.

<Contents><Content type="text">Come and see a wonder of the Hydlaa. Weapons made by the great smith HARNQUIST!!!! See blow for images of his amazing skill.</Content><Content type="pic" align="0" padding="5 10 15 20" width="32" height="32" src="/planeshift/materials/broadsword01a_icon.dds;">

Let me now explain what each bit does [ type="pic" ] tells the game it is a picture [ align="0" ] means the image is left aligned, if you use 1 you get center aligned, and 2 for right aligned. [ padding="5 10 15 20" ] adds a border around the image on the left(5) top(10) right(15) and bottom(20). Width and height tell the game how big to make the picture. Finally [ src="/planeshift/materials/broadsword01a_icon.dds;" ] tells the game which image you want to display. The ; symbol is important to add as it marks the end of the image name, this does mean you can show a row of images. Like below

<Contents><Content type="text">Come and see a wonder of the Hydlaa. Weapons made by the great smith HARNQUIST!!!! See blow for images of his amazing skill.</Content><Content type="pic" align="0" padding="5 10 15 20" width="32" height="32" src="/planeshift/materials/broadsword01b_icon.dds;/planeshift/materials/broadsword01a_icon.dds;/planeshift/materials/broadsword01c_icon.dds;">

Once again you need to tell the game that the area which will show an image is finished by adding a </Content> section again

<Contents><Content type="text">Come and see a wonder of the Hydlaa. Weapons made by the great smith HARNQUIST!!!! See blow for images of his amazing skill.</Content><Content type="pic" align="0" padding="5 10 15 20" width="32" height="32" src="/planeshift/materials/broadsword01b_icon.dds;/planeshift/materials/broadsword01a_icon.dds;/planeshift/materials/broadsword01c_icon.dds;"></Content>

Now finally we will be adding one final paragraph of text. As before you need to use both <Content type="text"> to start it and </Content> to end it.

<Contents><Content type="text">Come and see a wonder of the Hydlaa. Weapons made by the great smith HARNQUIST!!!! See blow for images of his amazing skill.</Content><Content type="pic" align="0" padding="5 10 15 20" width="32" height="32" src="/planeshift/materials/broadsword01b_icon.dds;/planeshift/materials/broadsword01a_icon.dds;/planeshift/materials/broadsword01c_icon.dds;"></Content><Content type="text">Come and see him on the 87 of Frizzday for the greatest selection of blades you will ever cut you own hand off with.</Content>

Once you have done this you need to tell it that the content of the book has finished, to do this you add </Contents>

<Contents><Content type="text">Come and see a wonder of the Hydlaa. Weapons made by the great smith HARNQUIST!!!! See blow for images of his amazing skill.</Content><Content type="pic" align="0" padding="5 10 15 20" width="32" height="32" src="/planeshift/materials/broadsword01b_icon.dds;/planeshift/materials/broadsword01a_icon.dds;/planeshift/materials/broadsword01c_icon.dds;"></Content><Content type="text">Come and see him on the 87 of Frizzday for the greatest selection of blades you will ever cut you own hand off with.</Content></Contents>

Now what you do is save the text file you have made the books in, you can just copy the book I have shown above to test it. Then go in game and load that text into a book and save it. Now when you read the book you will see the text and images you told the game to display.



3 - I tried making one and it wont work!

Well, from what I've done most of the time it hasn't worked all I get a book full of text with commands in where you should get images. There are also times when some images show and some don't

There are a few things to be aware of. First, it is all case sensitive. <Contents> is correct, <contents> is not. Also make sure you do not have other spelling mistakes. You must also make sure that you have all the matching <Contents></Contents> and <Content></Content> set correctly in pairs. These mistakes will result in you just getting lots of text.

You should make sure that each of the following piece of information are present when adding images.
<Content type="pic" align="0" padding="" width="" height="" src="">
If you don't the images may well show, but will very likely show incorrectly.

There are limitations to what you can do, I hope it will get looked at at some point.

You can download this file and load it in game as an example of what it will look like when you make a book with images.



4 - How add a new icon to a map.

Now, when adding images to maps it is a little easier to do.

For a simple example, buy a map, drop an icon in the middle. If you save it you get something like this..

<pages><page l="37" t="167" w="684" h="484"><ic x="342" y="242" i="city_01"/></page></pages>


All you need to do is change the i="" bit to the resource name for the piece of art you want to use, using the names I explained at the start. Like this.

<pages><page l="37" t="167" w="684" h="484"><ic x="342" y="242" i="/planeshift/materials/combat_infantry02_icon.dds"/></page></pages>

Then load this in game and you will have a brand new image shown in your map

------

And with that....

Good luck, and enjoy.
« Last Edit: December 09, 2016, 05:04:28 am by Venalan »
..

Bonifarzia

  • Hydlaa Notable
  • *
  • Posts: 718
    • View Profile
Re: How to add images to books.
« Reply #1 on: December 25, 2014, 02:01:40 am »
Thanks for this very detailed guide - and for this useful new feature, which will lead to a new generation of PS books :)

When I read this, I wonder if such tags will also allow some more formatting options for the text content of books, like headers, centered text or better control of line- and page-breaks.

Siteya

  • Hydlaa Resident
  • *
  • Posts: 147
    • View Profile
Re: How to add images to books.
« Reply #2 on: December 25, 2014, 01:07:10 pm »
Thanks Venalan for taking the time to post that!

Mariana Xiechai

  • Hydlaa Notable
  • *
  • Posts: 986
    • View Profile
Re: How to add images to books.
« Reply #3 on: December 25, 2014, 08:22:50 pm »
You freaking rock Venalan. This is going to open up some seriously fun Role Play potential!

Venalan

  • Global Moderator
  • Hydlaa Notable
  • *
  • Posts: 630
    • View Profile
Re: How to add images to books.
« Reply #4 on: December 27, 2014, 10:52:27 am »
Thanks for this very detailed guide - and for this useful new feature, which will lead to a new generation of PS books :)

When I read this, I wonder if such tags will also allow some more formatting options for the text content of books, like headers, centered text or better control of line- and page-breaks.

When the new book format was being made I asked about adding support for basic editing like bold, underlined, left/center/right aligned, and page/line breaks. But it wasn't added, which is a shame as you could do some really nice formatting of books using them. Maybe in the future.
..

Venalan

  • Global Moderator
  • Hydlaa Notable
  • *
  • Posts: 630
    • View Profile
Re: How to add images to BOOKS or MAPS.
« Reply #5 on: December 08, 2016, 04:57:46 pm »
It was brought to my attention that people didn't know this method could be used to add any image in game also to maps so i added the following to the opening post.

4 - How add a new icon to a map.

Now, when adding images to maps it is a little easier to do.

For a simple example, buy a map, drop an icon in the middle. If you save it you get something like this..

<pages><page l="37" t="167" w="684" h="484"><ic x="342" y="242" i="city_01"/></page></pages>


All you need to do is change the i="" bit to the resource name for the piece of art you want to use, using the names I explained at the start. Like this.

<pages><page l="37" t="167" w="684" h="484"><ic x="342" y="242" i="/planeshift/materials/combat_infantry02_icon.dds"/></page></pages>

Then load this in game and you will have a brand new image shown in your map
« Last Edit: December 09, 2016, 05:05:49 am by Venalan »
..

Sirial

  • Hydlaa Resident
  • *
  • Posts: 57
    • View Profile
Re: How to add images to BOOKS or MAPS.
« Reply #6 on: December 09, 2016, 04:14:12 am »
Does it use the same src as the books icons?
Aniroho Aimirrel (Researcher in Knowledge Seekers)
Terelen Honoro (Captain of the Iron Claw)

Venalan

  • Global Moderator
  • Hydlaa Notable
  • *
  • Posts: 630
    • View Profile
Re: How to add images to BOOKS or MAPS.
« Reply #7 on: September 11, 2017, 02:34:11 pm »
Hey all, so Mishka and I have been talking a bit about art bundled with the client and its use in books/maps, the next art update will have some additional art available to players which has always been in the client but never accessable.

Part of this work has also led to Mishka to making some maps and has been kind enough to allow me to share two of them here.

Below are the image and the xml code to the make them.



https://pastebin.com/4m50s25h/





https://pastebin.com/Z7DuuVTJ/
..

Emaline

  • Game Masters
  • Hydlaa Citizen
  • *
  • Posts: 247
  • Game Master
    • View Profile
Re: How to add images to BOOKS or MAPS.
« Reply #8 on: September 11, 2017, 02:41:04 pm »
I can't wait to see players start to use these in game! Looks awesome, keep up the good work guys!
I'm very responsible, whenever something goes wrong they always say I'm responsible.

Any Event idea find us on IRC #ps-event
Problem Ingame use IRC: #Planeshift-gmtalk