Readables Prefabs: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Geep (talk | contribs)
→‎Inserting Readables Prefabs: Clarify title vs. body overlap. Add comment about lack of markup
Geep (talk | contribs)
 
(5 intermediate revisions by the same user not shown)
Line 3: Line 3:
{{Summary|
{{Summary|
* Select a readable prefab in your map editor.
* Select a readable prefab in your map editor.
*You now have a working readable with blank pages.
* 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.
* 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.
* Create your new text content, either with the Readable Editor or by hand-editing.
* Enter the number of pages where shown (default is 1)
}}
}}


Line 18: Line 17:
''scroll_rolled_mobile_gothic_bamberg.pfb''
''scroll_rolled_mobile_gothic_bamberg.pfb''


Within the "Choose Prefab" viewer's left pane, look for the "readables" category. This is further subdivided into books, scrolls, and sheets. (There are also signs, treated separately in [[Text_Decals_for_Signs_etc.]]) Provided book prefabs are open or closed, and scrolls are open or rolled up. All forms are available in mobile (aka movable) or static (aka immobile) form, also discussed in [[Readables]].


==Inserting Readables Prefabs==
==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.)
* First make your own plain text xd file, e.g., 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.
* 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)
* 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)
* In the TDM distribution, within tdm_prefabs01.pk4, find the file prefabs.xd
* Open prefabs.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.)
* 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.
* Paste it into your own xd file, e.g., mymap.xd.
* Still in your own xd file, change the xdata name header, eg, <br>from ''book_gothic_bamberg'' to eg, ''nightwatch_logbook''.<br>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,<br>''mymapname/magic_book3''
* Still in your own xd file, change the xdata name header, e.g., <br>from ''book_gothic_bamberg'' to e.g., ''nightwatch_logbook''.<br>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, e.g.,<br>''mymapname/magic_book3''
 
* If you are using Method 1 next, save and close your xd file. Otherwise, leave it open for further editing.
==Creating Text Content for One or More Pages==
===Method 1: By Using the Readable Editor===
''suggested by joebarnin''
* In DR, with the readable selected and open in the Entity Inspector, change the '''xdata_contents''' property to the new name (e.g., nightwatch_logbook) you used in the xd file.
* At this point you should be able to use the [[Readable Editor]]. It will update your xd file automatically.


===Method 2: By Direct Editing of Your XD File===
'''ADDING TEXT:'''
'''ADDING TEXT:'''
* In all xdata sections, your main text should be typed between double quotes usually in a 'body' section where shown.
* 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.
* 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.
* Both 'title' and 'body' sections can ''independently'' fill the same page (i.e., like two overlays on a blank sheet). So when mixing both, leave spaces for the other's text, to avoid overlapping characters.
* You now have choices:
* You now have choices:
# Put text in the body only and leave the title blank.
# Put text in the body only and leave the title blank.
Line 42: Line 49:


* Enter your text in paragraphs between double quotes which in turn are between the curly brackets.
* 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...
* Use \n to linefeed within the quotes else two empty double quotes for blank lines if needed, e.g...
  {
  {
  "paragraph"
  "paragraph"
Line 53: Line 60:
* '''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.
* '''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.
Geep comments, 2020: Note that any given page can only have 1 font style for both title and body. But different pages can have different font styles, 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. Under some circumstances, you may be able to fake a font size change within a line by using the title/body overlap, but test it with different screen widths.




Line 64: Line 71:
* Resave your xdata file.
* 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.
* In DR, with the readable selected and open in the Entity Inspector, change the '''xdata_contents''' property to the new name (e.g., nightwatch_logbook) you used in the xd file. 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==
==Testing & Troubleshooting==

Latest revision as of 21:31, 27 December 2021

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.
  • Create your new text content, either with the Readable Editor or by hand-editing.


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

Within the "Choose Prefab" viewer's left pane, look for the "readables" category. This is further subdivided into books, scrolls, and sheets. (There are also signs, treated separately in Text_Decals_for_Signs_etc.) Provided book prefabs are open or closed, and scrolls are open or rolled up. All forms are available in mobile (aka movable) or static (aka immobile) form, also discussed in Readables.

Inserting Readables Prefabs

  • First make your own plain text xd file, e.g., 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)
  • In the TDM distribution, within tdm_prefabs01.pk4, find the file prefabs.xd
  • Open prefabs.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, e.g., mymap.xd.
  • Still in your own xd file, change the xdata name header, e.g.,
    from book_gothic_bamberg to e.g., 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, e.g.,
    mymapname/magic_book3
  • If you are using Method 1 next, save and close your xd file. Otherwise, leave it open for further editing.

Creating Text Content for One or More Pages

Method 1: By Using the Readable Editor

suggested by joebarnin

  • In DR, with the readable selected and open in the Entity Inspector, change the xdata_contents property to the new name (e.g., nightwatch_logbook) you used in the xd file.
  • At this point you should be able to use the Readable Editor. It will update your xd file automatically.

Method 2: By Direct Editing of Your XD File

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 both, leave spaces for the other's text, to avoid overlapping characters.
  • 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, e.g...
{
"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 style for both title and body. But different pages can have different font styles, 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. Under some circumstances, you may be able to fake a font size change within a line by using the title/body overlap, but test it with different screen widths.


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 DR, with the readable selected and open in the Entity Inspector, change the xdata_contents property to the new name (e.g., nightwatch_logbook) you used in the xd file. 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!