Readables Prefabs

From The DarkMod Wiki
Revision as of 12:00, 10 March 2020 by Geep (talk | contribs) (→‎Inserting Readables Prefabs: Clarify title vs. body overlap. Add comment about lack of markup)
Jump to navigationJump to search

written by Fidcal


Summary:

  • Select a readable prefab in your map editor.
  • You now have a working readable with blank pages.
  • Copy its template xdata from xdata/prefabs.xd to your own xd file and give it a unique name.
  • Type in your own text between the quotes where shown.
  • Enter the number of pages where shown (default is 1)


Introduction

'Readables' are any documents, books, scrolls, sheets, etc. that can be read by the player in-game. Dark Mod readables are very flexible and you can make your own custom styles and designs (see Readables) but for quickness there are prefabs already prepared for a wide range of types and categorized that way so you can easily select what you want, for example:

book_static_thick_print_stone.pfb

scroll_rolled_mobile_gothic_bamberg.pfb


Inserting Readables Prefabs

  • First make your own plain text xd file, eg, mymap.xd. (Do this BEFORE launching Doom/TDM else it won't load it - you'll have to exit and open TDM again.)
  • In your map editor, in orthoview, point to where you want the readable, RMB, insert prefab, select a readables prefab. There are images at Fonts Screenshots so you can see what the fonts look like.
  • With the readable selected, in Entity Inspector note the xdata name from xdata_contents. (tip: highlight then Ctrl+C to copy it)
  • Open the file xdata/prefab.xd in a text editor and find that xdata name you copied (tip: F3 to search (usually) paste in the name)
  • Select & copy the complete xdata section including the name and the last end curly bracket. (tip: look for a few blank lines then the next xdata header name.)
  • Paste it into your own xd file, eg, mymap.xd.
  • Still in your own xd file, change the xdata name header, eg,
    from book_gothic_bamberg to eg, nightwatch_logbook.
    It MUST be a unique name used nowhere else in this or any other xdata file on the player's system so make it distinctive. 'path' not essential but recommended to make distinctive, eg,
    mymapname/magic_book3


ADDING TEXT:

  • In all xdata sections, your main text should be typed between double quotes usually in a 'body' section where shown.
  • Almost all can also use the same area using a larger font. This is typically called the 'title' section but need not be restricted to just a heading - regard it as just a larger font option for any use or position on the page; it can even be used for the main text if a larger font is needed.
  • Both 'title' and 'body' sections can independently fill the same page (i.e., like two overlays on a blank sheet), so when mixing leave spaces for the other font.
  • You now have choices:
  1. Put text in the body only and leave the title blank.
  2. Put a header in the title and your main text in the body beginning with a \n to linefeed past the header.
  3. Put subheading(s) in the title line-spaced down with \n\n\n and also text in the body also line-spaced down with \n\n\n.
  4. Use only the title for the whole page if you want a larger font.
  5. Some provide an 'illuminated' capital initial letter where shown else leave empty (can precede with \n\n to force linefeeds.) If you do insert an illuminated capital letter then also horizontal-space out the start of the first three body lines to leave room.
  • Enter your text in paragraphs between double quotes which in turn are between the curly brackets.
  • Use \n to linefeed within the quotes else two empty double quotes for blank lines if needed, eg...
{
"paragraph"
""
"paragraph"
""
"paragraph"
}
  • Do not press the Enter key to start a new line within the quotes--the readable will not work if you do! Long lines will wordwrap in the game readable. If you should want to force a new line within quotes then type \n. Tip : set your text editor to wordwrap and narrow its window to approximate the width of the page in-game.

Geep comments, 2020: Note that any given page can only have 1 font for both title and body. But different pages can have different fonts, by editing the "gui_pageN" settings at the bottom of the page setting. No markup is available for font size within a line, or for italics, bold, and underline. You may be able to fake a font size change within a line by using the title/body overlap, but with low probability of success.


ADD NUMBER OF PAGES:

  • If more than 1 page then change the number of pages where shown, eg,
"num_pages"   : "1" ... change to "3"
  • If more than 5 then add more at the end of the section.
  • If less than the default 5 no need to remove any - just use the ones you want (unless you are desperate to save a few bytes.)
  • Resave your xdata file.
  • In your map editor, in Entity Inspector, change the xdata name on the readable entity to the one in your xdata file, eg, mymap.xd. Tip: if you copy and paste this from your xd file make sure you do not accidentally include any linefeeds - it can cause problems.

Testing & Troubleshooting

See Test your Readable!