Copyright: DFBEdit, June 1998 - by Dave Humphrey (aj589@freenet.carleton.ca)


DFBEdit - Daggerfall Book Editor
DFBEdit - A Daggerfall Book Editor

DFBEdit is a simple book editor for the game TES:Daggerfall and allows you to edit book files found in the ARENA2\BOOKS directory or to create entirely new ones.  The layout is similar to a standard text editor such as Notepad although there are a few notable differences which you must be aware of when editing or creating books.

Important Notes on Editing Books:

1. There are a number of Special Codes for formatting text described as follows.

 |	This character at the very end of a line signifies that the line should be centered when display in the game.

 ~	The character, on a line by itself, signifies the end of the current page in the book.  Pages should be no longer than 20 lines in length.

 <01>	This code is currently unknown and shouldn't be changed.

 <FB08>

 <FB10>

These two codes are related to directly specifying the position to display the text.  This option currently isn't supported by DFBEdit and these codes should not be edited.

 <FONT FANCY>

 <FONT NORMAL>

These codes specify which font to use.  The fancy font should only be used in the book title

Note that any other string between the < > characters is invalid and may be ignored.  Also watch out for a < without an ending > since you may lose any text appearing after the <.

2. The  Page Length should not exceed 20 lines.  Using a longer page length will result in nasty things when the game attempts to display your book. Insert a ~ (tilde) character on a line by itself to create a page break.

3. You can change the book's Title and Author by choosing Edit Parameter under the Edit menu.

4. Name your book following the format used by Daggerfall.  This is BOK00000.TXT with the 00000 replaced by any valid number from 0 to 99999.  New books may be added in the ARENA2\BOOKS directory and will appear automatically in the game in monster corpses and in stores (confirmed).

The User Interface:

     File Menu

New: This creates a new book, erasing the contents of the current file.  You are prompted to save if the current book has been modified.

Load: Loads an existing book from a disk.  The load (and similarly the save) dialogue window that appears has been custom designed especially for loading the Daggerfall book format.  The program will attempt to identify files as a book format and display the book title.  This is far from fool proof and some files may be incorrectly identified as book files.  Only the first 100 files in a directory are scanned since it can take some time in directories with large numbers of files (such as the ARENA2 directory).

Save: This saves the current book to disk.  If no filename has been specified you are prompted for the filename.

Save As: Use this to change the name of the book you wish to save.  You are prompted if you enter a book that already exists.

Books History: The program will list the last four book files you have saved/loaded, if any.  The values are saved in a INI in the programs home directory.  Clicking on one is merely a shortcut to loading it.

Exit: This exits the program.  You are prompted if the current file has been modified since the last save.

     Edit Menu

Copy:

Cut:

Paste:  These perform the usual operations on the selected text in the main text field.  They can also be accessed by Right-Clicking the mouse in the text area.

Find:

Find Next:  These menu options let you search for a specified search string in the current book.  When found the text is selected and you are moved to its cursor position.  Start by choosing Find to specify the text to search for.  Use the Find Next to move through all the search string occurrences in the current file.

Edit Parameters:  Choosing this allows you to edit the book's author and title.  This is used when you get information on a book or when in a store.

     Insert Menu

End of Page:  Insert a ~ (tilde) character on a line by itself at the current cursor position.

Center Line:  Inserts the | character and starts a new line at the current cursor position.

Normal Font

Fancy Font:  These insert the strings required to change the displayed font in the game.

     The Toolbar

The toolbar provides a shortcut to just about all the menu functions described above.  Although their function should be explained by their graphics, pausing the mouse button over them displays a short descriptive text.

     Book Parameters

Choosing Edit Parameters in the Edit menu or clicking on the edit parameter button on the toolbar will bring up the parameter window.  The two most important fields are the book author and title.  This is what will be displayed when you Info a book in your inventory or a store in the game.  The price field is believed to affect how much your book will cost to buy or when you sell.  A value of 500-2000 is a typical book price (be reasonable now...:).  There are currently three unknown fields which also can be edited but should be left as they are unless you are an experienced hacker (their effects are currently unknown).

Click the Ok button to accept your changes or the Cancel to abort and revert back the original values.

About DFBEdit

DFBEdit was created in the professional edition of Visual Basic 5 and source code is available upon request.  If you experience any difficulties with the program please let me know.

Written by: Dave Humphrey, aj589@freenet.carleton.ca, http://www.honesty.com/jackel/

Credits: Thanks to Hoostine (Hoostine@juno.com) for pointing out a few improvements in my code (I migrated from VB version 1 to version 5 so I'm missing a lot of the convenient changes I can use).

Bethesda of course for making such a wonderfully addicting and great game!

Legal Disclaimer

DFBEdit and its source code is public domain software and can be freely distributed.  If you do use any of the source code in any publicly released program it would be nice to mention me somewhere.

This is an unofficial product.  I am in no way related or connected to Bethesda.  Bethesda Softworks, Battlespire, XnGine, Daggerfall, Arena and The Elder Scrolls are trademarks of Media Technology Limited, Copyright © 1994-1997 Media Technology Limited.

I cannot be held responsible for any damage incurred through the use of this program.  This includes falling asleep at the keyboard and getting electrocuted due to fatigue of editing books for 8 hours without a break.

The Daggerfall Book File Format

       DESCRIPTION OF THE DAGGERFALL BOOK FILE FORMAT

=============================================================================

   Written By Dave Humphrey                                  20 June 1998

      aj589@freenet.carleton.ca

This file describes as much as is known about the book files used in the

Daggerfall CRPG game created by Bethesda.  The book files exist in the

directory ARENA2\BOOKS\ in the main DAGGER directory and have names such

as 'BOK00100.TXT', 'BOK00002.TXT', etc... All of the information contained

in here was found from looking at all the different book files.  As such,

all known possible values for a field will be stated where appropiate.

Overall Format

=================================================

The general format of a book file can be split into four different parts,

explained as follows.

        [ ..... 64 Bytes, Title of Book ..... ]

        [ .... 160 Bytes, Author of Book .... ]

        [ ..... Variable Length Header ...... ]

        [ . Variable Start/Length Book Text . ]

The first two fields, the title and book author appear to be the only fixed

length fields beginning the file.  Everything else after this depends on the

length of the header.

Header Format

=================================================

The header isn't that well known at the moment, but I'll attempt to describe

what is known.  The first portion of the header is always 12 bytes long and

has the following format.

     [ .. Bytes 224..227 .. ] (long)  Book Price

           I believe this has something to do with the relative price of the

           book (confirmed).

0x03E8: Most files have this value

0x012C, 0x0190, 0x000A, 0x1388, 0x01F4, 0x2710

     [ .. Bytes 228..229 .. ] (int)

           Unknown quantity that is a value from 1 to 4. Probably some sort

           of book type field?

     [ .. Bytes 230..231 .. ] (int)

           Always 0x04D2 except for book #100 where it is  0x04D3.  Note that

           0x04D2 = 1234 in decimal which is a rather peculiar number.

     [ .. Bytes 232..233 .. ] (int)

           Always 0x0929 except for book #100 where it is 0x092A.  Note that

           0x0929 = 2345 in decimal which again is a  rather strange number.

     [ .. Bytes 234..235 .. ] (int)

           The number of page offsets which follow.

The important bytes to remember are the last too which will be required in

order to determine where exactly the book text starts.  What follows in the

file now are a number of long integer (4 byte) values.  The exact number is

determined by the value of the last two bytes described above.  The offsets

each point to the top of a page in the book.  This is most likely used for

changing pages of a book in the game.  The first offset will point to the

very start of the book text which also corressponds to the first byte after

the offset list ends.  So, the header looks essentially like this...

           ...... Author ....... ]

     { Start of Header }

  [ 4 bytes, Book Price ]

          [ 6 bytes Unknown Header Information ]

          [ 2 Bytes, Number of Offsets ]

          [ Offset List, (4 * Number of Offsets) Bytes Long ]

     { End of Header }

          [ ...... Book Text .......

Book Text Format

=================================================

The text of the book is not in normal ASCII format so it needs some

explaining.  There are a number of non-printable characters which have

a specific task...

     [ Character 0x00 ]

        This character is the equivilent of a Carriage Return, indicating

that a new line should be started.

     [ Character 0x01 (ASCII 1) ]

Not sure what this is, but it appears to only exist before the

0xFB character described below.  It might have something to do

with text display but I'm not sure.

     [ Character 0xF6 (ASCII 246) ]

This character indicates the end of a page in the book.

     [ Character 0xF9 (ASCII 249) ]

This selects which font is to be used depending on what the next

character afterwards is.

0x02: Display the fancy text (for titles)

0x04: Display the regular text

     [ Character 0xFB (ASCII 251) ]

        This character controls the display position of the text given by

        the following two bytes.  The two bytes (a short integer) give the

        pixel position on the screen to print the next character at (this

        may be relative or absolute).  Typical values used are 0x0800 and

        0x1000 (8 and 16 respectively) (almost confirmed).

     [ Character 0xFD (ASCII 253) ]

Indicates that the next line printed should be horizontally centered

on the screen.  Used mostly for titles, authors, etc...

Besides the regular printable characters, these are the only ones to exist

in any of the books.  The exception is the book BOK10000.TXT which appears

to be written in german or something and has all kinds of wierd things

happening in it.  For this reason I decided to ignore it since it didn't

fit the format of all the other book files.  For testing purposes I used

the above information to create a simple program to output the book files

to the screen in text mode.  The output appears to be very close, if not

identical, to the output produced in Daggerfall itself.  The exception

occurs for certain lines where the line feed character 0x00 appears to be

missing.  This causes really long lines (> 80 characters) to be displayed.

I would assume that the Daggerfall windowing code can automatically handle

and wrap long lines with no line feeds since similar things happen in the

quest text files.  There actually appears to be evidence that DF cannot

properly handle long text lines as someone pointed out to me, since there

are cases where text flows past the end of the window.

That's about all there is too it.  If there's any mistakes, or you find out

one of the unknown bytes, just e-mail me to let me know....Enjoy.