Tes2Mod: DFQEdit manual
DFQEDIT v0.30 Beta - Daggerfall Quest Editor
DFQEdit is the start of hopefully a full TES: Daggerfall quest editor. Right now it can only modify the QRC quest files which contain all the texts needed for a quest. It can't accurately determine the type of each text, although it tries to, since the format of the text type is not well understood at the moment. It is being released as a Beta program since I have only been able to test it on a limited number of quest files and am not sure if it can load all quest files (although it should). I have tested some QRC files altered with DFQEdit in Daggerfall and it appears as though it works correctly, but there's simply too many variables to say for sure. Bugs, comments, and suggestions are gladly accepted at firstname.lastname@example.org
- 1 Features
- 2 Installation Guide
- 3 DFQEdit - Users Manual
- 4 Text Editor - Users Manual
- 5 A few Notes about Editing Quest Text
- 6 What to do in Case of Errors
- 7 Known Bugs
- 8 Credits
- 9 Sites
- 10 Included Files
- 11 Version Changes
- 12 Programming Note
- 13 Legal Stuff
- 14 Appendix A - Listing of %string Variables
- 15 Appendix B - Listing of _string_ Variables
- 16 Appendix C - Listing of =string_ Variables
- 17 Appendix D - Included Data Files (*.DAT)
- Load QRC files and change quest texts to your liking. Can change some of the quest parameters to some extent.
- Displays all known quest type parameters such as guild, minimum rank, and character status.
- Edit the quest texts in a simple built-in editor which displays special quest variables and codes in different colors.
- Change the various quest parameters which automatically builds most of the quest filename for you.
- Edit the item and npc sections of the QBN file to some extent.
- Can't really create quests from scratch yet, but it's getting there.
DFQEdit should be installed in it's own directory to help organize files and directories better. I recommend a directory in the DAGGER directory such as \DAGGER\DFQEDIT\ but it is up to you. DFQEdit initially looks for all files in the current directory upon startup, but directories and drives can be specified when loading/saving files (eliminating the need for a CFG file for now).
DFQEdit - Users Manual
Editing quest files (all .QBN and .QRC files in the ARENA2 directory) is not a simple task, even with an editing tool such as DFQEdit. If something is not done quite right it is possible that Daggerfall will crash when it attempts to use the modified quest. The best method, in my opinion, is to copy quest files I wish to modify into the DFQEdit dir and then copy them back into the ARENA2 dir when finished. Thus, I can be sure the quest won't be used until I want it to. Also, backups of modified quests should be create in case an 'Un-documented DFQEdit Feature' (read bug) ruins that quest file you took days to rewrite (remember, it's currently only a Beta version and is not thoroughly tested).
DFQEdit requires that both the QRC and QBN files of a quest are present in the same directory. If you save a new QRC file DFQEdit will automatically save the QBN file, notifying you if the quest files already exist. Quest file names are also very important as they give information such as which guild, minimum rank etc... In general, the only characters in the quest name which can be safely changed are the last two which are simply a quest index number to differentiate files. DFQEdit will automatically generate the quest file name, except for the last two characters which can be specified when you save.
When you first start DFQEdit you should be presented with a colorful text screen in 80x50 resolution (a standard VGA text mode which permits twice as much information to be displayed at a time than the normal 80x25 mode). The top center of the screen displays the current quest loaded, which at startup should be none, the new quest filename (in red). The new quest filename is automatically built based on the quest parameters below on the page. Thus you can save quest with the right name so that Daggerfall can correctly read the file.
Below this are several lines of quest information telling you various information about the current quest. If you click on the little green arrows you will get a listing of possible values. Changing these values will modify the new quest filename at the top of the screen.
The next section below this is a listing of quest texts. Currently up to 32 different texts can be shown at a time, hopefully many more than you'll ever need (all quests I've seen have had less than 20 different texts). The quest text description, which is not currently 100% accurate, can be clicked to edit that text. To the right of the description is a value 'Yes/No'. This represents if that text section has any text in it currently. The number in brackets to the left of the quest text description represents the hexadecimal text type loaded from the QRC file. It is only useful if you are into determining more of the format for quest files.
At the bottom of the DFQEdit screen are the buttons Load QRC, Save QRC, New QRC, and Exit which should be self-explanatory and are described in more detail below.
Loading a QRC File
To load a QRC file click the LOAD button at the bottom of the screen (eventually text shortcut keys will be assigned to everything). A new window will appear on the screen listing files, directories and drives. When DFQEdit is first started, this list is the current directory but on subsequent saves and loads it will remember where you left it. Use the mouse, TAB, and cursor keys to select a directory or QRC file. Wildcards are accepted in the file name box (default is *.QRC). When a QRC file a wish to edit is found, press the ENTER key or click the OK button, otherwise ESC or CANCEL will exit the window. The QRC file should now be loaded. The main DFQEdit screen will be changed to the new file. Unless you are particularly lucky however, many of the quest texts will be labeled as 'Unknown'. This is because the type of quest seems to affect how the texts are labeled in the QRC file and the quest type in the QBN file is not understood. Likewise, the quest type box at the top of the screen will probably not be correct at the moment either. I have programmed it to find the closest matched quest type but only a handful of types are programmed into DFQEdit at the moment (did I mention the quest type in the QBN file isn't understood?). No worries though, you can still edit 'Unknown' text types although you'll have edit the text to see what it contains.
Saving a QRC File
Saving a QRC file is much the same as loading. Simply click the SAVE button and enter a new or existing filename. If the file already exists you will be asked if you wish to overwrite or not. If you save to a new QRC file you will need to copy the appropriate QBN file to the new name as well, since both Daggerfall and DFQEdit require both QRC and QBN files for loading quests. The new quest filename based on current quest parameters will be the default filename. All that's needed is to add a two digit index and save.
This is a new button as of version 0.30b. It allows you to change the editing mode from QBN to QRC and vice-versa. See the sections 'Editing a QRC' and 'Editing and QBN' for more information on each screen.
This simply clears the contents of the window. Will be more useful when you can create quests from scratch.
This button displays a window listing information about DFQEdit and the current environment.
You can quit DFQEdit by either pressing the EXIT button or by the ESC key when in the main DFQEdit window. You will be asked if you truly want to exit but it won't currently tell you of unsaved files.
Editing a QRC Text
To edit a qrc text simply click on the text description (even if it says 'Unknown'). This will bring up another window with allowing you to Edit, Delete, or Cancel. Deleting the text will clear it from memory and the text section will be omitted if you save the file. This might cause problems in Daggerfall if it needs that text for the quest (deleting the quest description and then saving is asking for disaster). If edit is selected you will be brought to the text editor which looks much like the DOS edit program, although much simpler (see the TEXT EDITOR MANUAL below for more information). Here you can edit text, load new text, or save text for later. When you load or save text, you are loading normal text files, nothing related to the QRC file. Special quest variables and codes are displayed in different colors. Help can be found by pressing F1 or ALT-H and the file menu can be activated by mouse or ALT-F. The text editor's code appears to be quite solid and I have yet to have it crash, although loading too large a file or binary files might cause undefined behavior. When you quit the text editor, any changes in the text are automatically recorded although you still need to save the QRC file. If you delete all text by the 'NEW' command, DFQEdit assumes you don't want the text section and 'turns it off'.
Editing a QBN
First of I'd like to say that editing the QBN section of a quest file is not for everyone at the moment. We don't currently completely under- stand the QBN file format but I've included what sections we do mostly know, the Item and NPCs. When in the QBN Edit mode you will notice several buttons on the left-hand side of the screen. These are the various QBN sections which can be currently edited. Right now these include only Items and NPCs. The outlined box in the center of the screen represents the current object data. At the top of the box is a line giving the current object number with current number loaded and the maximum allowed to be loaded. The object number can be changed with the 'Prev' and 'Next' buttons at the bottom of the screen (the 'Add' button is currently disabled at the moment).
The values you can edit will appear as list boxes or text fields. Simply click on the arrow to display lists and click on text fields to edit their contents. The values in light-blue below these are the numerical values of the fields. This is useful in recording a value the fields show as 'Unknown'. If you can identify such a value, please let me know.
Sometimes, if a particular field is not currently well understood, the actual numerical value of the field is displayed. This value is always a decimal, or base 10, value. The title of the field should also contain one of the words, char, int or long to identify the length and allowed values of the field as follows.
If you input a value greater than the allowed limit it will 'wrap'. For example entering '256' in a char field will result in the value of 0 being displayed and saved. The values are always unsigned so inputting a negative value will also result in 'wrapping'. For example entering -1 in a char field results in the value 255 being displayed.
The input text fields also accept hexadecimal, octal, and binary input as well as decimal as follows
|Binary (base 2)||Ends with a b, ie: 10001b, 001100101111b, etc...|
|Octal (base 8)||Start number with a 0, ie: 056, 01462, etc...|
|Hexadecimal (16)||Starts with a 0x, ie: 0xFA45, 0x45, etc...|
Entering an invalid value in a certain base (such as 0xT6, 12356b, etc...) will result in a 0 being displayed. Please note that even though you may input the number in another base, the value is still displayed as a decimal.
The item sections is completely free for one to edit, although we are not completely sure what all the values do yet. The item types and the item fields should be self-evident. Usually one should use the 'Item' or 'Gold' values in the item type field as the 'Artifact' and 'Unknown' values are not well understood. The item list is loaded from the file ITEMS.DAT in the DFQEdit directory and can be edited to add more items if you're sure you follow the correct format (don't get fancy). If you can identify the value of an unknown item, please let me know as there are currently many I'm missing.
The item message type usually relates to the message variable used in the QRC texts. Sometimes, however, the number is not related to such a variable, usually when the item represents a letter. If you click on the 'Find Msg' button the program searches through all current QRC texts for any texts which have this message variable. It shows a list of matches which you can then edit/view.
The Message ID #1 field is not well understood but we believe it to represent the text message displayed when the PC receives the item. This is only if the ID is non-zero. Click the 'View Msg' button to view the message if there is one.
The Letter MSG ID field represents the message id displayed when the PC uses an item, such as for a letter. A zero value here implies no message. Click the 'View Msg' button to view the message if there is one.
The NPC section is still sketchy at best but it's values are useful for hacking purposes. All but 5 bytes of the NPC field can be edited (the value1 and value2 fields cannot yet since their purpose is unknown).
The gender field is a guess at best since it usually contains one of 4 values (but mostly one of 3 values).
The gender message type is similar to the item message type described above. Click the 'Find Msg' Button to search QRC texts for a match to this variable. It usually relates the NPC to a variable name in the QRC texts. The two message id fields are also currently unknown at this time. Click the 'View Msg' buttons to view the messages if the value is non-zero.
The location section is still very unknown at the moment so we'll concentrate on only the location numbers for now.
The general location value places the location of the quest either in the current town (like the kill the rats type quests) or the more common Outside Town type (for dungeons, other towns, etc...). There is a third option which may indicate the quest takes place in the current house/dungeon but this is not verified.
The location type places the quest in a random home, a random dungeon, or a specific place. The specific locations are not yet known at the moment but most of them occur in the main quest files (S*.QBN)
There are many unknown fields here, of which I haven't the foggiest idea what they do...yet. Feel free to test them out if you're brave enough.
Like most sections, the location field also has a message type value.
The monster section is a small one, with only three editable fields which are relatively well understood.
The monster index field selects exactly which monster is to appear. A monster can be a non-human monster (rats, orcs, daedra etc...) or a human one (barbarians, assassins, thieves, etc...). The human monsters are not well documented at the moment but feel free to try them out (and let me know what they are).
There is one unknown field with a few limited values. Most of the time the value is '1' here. It may govern the number of monsters appearing but that is merely a guess.
Again, this section has a message type value associated with it.
Text Editor - Users Manual
The built in text editor in DFQEdit is a simpler one, much like the EDIT program found in DOS. The mouse can be used to move around the screen and activate the File and Help menus. Keyboard commands can be found below.
|ALT+F / Mouse||Activate File Menu|
|ALT+Q||Quit Text Editor|
|F1 / ALT+H||This help Screen|
|F2||Save Text to TXT file (not to QRC!)|
|F3||Load TXT file|
|CTRL+Y||Delete Current Line|
Special quest variables and codes are displayed in different colors and are explained in the edit help screen (F1 or ALT+H). The text editor's code appears to be quite solid and I have yet to have it crash, although loading to large a file or binary files might cause undefined behavior. The header at the top of the screen also displays what type of text you are editing (although this is currently quite inaccurate...have I mentioned the quest type in the QBN file is not known?).
The text editor assumes that TAB's in loaded text files are 5 spaces. It saves TABS as spaces and currently doesn't accept the key TAB as input. The editor has many shortcoming in combining lines with deleted or added text since lines are currently limited to 78 characters or less (you can't scroll left or right).
A few Notes about Editing Quest Text
Editing quest text is relatively straight forward, just like in any text editor, but there are a few things you should be aware of listed below.
- The end-of-line characters '|' and '<' are important. Whenever one of these characters is found, a new line is started. If you truly _have_ to use one of these characters as normal text....you can't. I chose these as they seemed the more obscure and lesser used. If these characters aren't found at the end of a line, the '<' is assumed to be there.
- Be aware of the line length. Don't use too long of lines as these must be displayed in Daggerfall. The average line length is about 40 characters, or about half the width of the screen. Also remember that various variables can be very long so make lines with variables on them appropriately shorter. Examples: The '_house_' variable is only 7 characters long, but it can represent a string like 'Hearthborne Residence' or 'The Resolution of Zenithar' which must fit on the current line. Daggerfall may or may not wrap text, although I do know it fits the quest box to the text.
- In general, the %string variables can be used in any quest text, but other variables (such as the _string_ and =string_ ones) depend on the quest type. In general, if you don't find a variable in the original text, assume that it can't be added. If you do added a variable not supported by the quest type you will simply get a 'BLANK' (which I'm sure we've _all_ seen at one time or another). A partial listing of variables can be found in the appendices at the end of this document.
What to do in Case of Errors
I programmed DFQEdit to exit and notify the user when an error occurs. If DFQEdit exits suddenly with the message 'BUG:...' you should record the displayed information along with what you were doing at the time of the crash (what files were you editing) along with a brief description of your system (OS, memory, type, etc...). You than may e-mail email@example.com with the resultant bug report. Likewise, if the program crashes but doesn't give a BUG message, record what you can and send it in. These types of crashes are more serious as there is no detection for them in the program. Remember, only if I receive proper bug reports can I fix them.
In the DFQEdit's about window (and in the exit messages) there is a line giving the far heap's status. Now, without going into too much technical stuff, the heap is related to the memory available to the program for loading files and for variables (i.e., very important). The status of the heap _should_ return OK at all times. If the heap is corrupted it may result in crashes and data loss in DFQEdit (the heap is corrupted usually by some bug in the program or some option which was overlooked). If, when exiting or checking the About window, the heap status returns corrupted you should immediately exit the program, reboot and send in a bug report. The reboot is probably not necessary, but better to be safe (during debugging I used to get a corrupt heap every 5 minutes and only rarely did the system lock-up after exiting the program). If you wish to save the current quest, do so in a different file name as it may or may not be corrupted. If the program crashes (or other weird stuff) when you load it, the save file is corrupt and should be deleted.
Occasionally DFQEdit will not be able to free up all the memory allocated while it was running. This is a less serious bug but still should be reported. Include the difference between initial and final memory.
- Paths and filename lengths must be less than 80 characters. Any more than this and the program will notify you. This shouldn't be a problem for most people, however if you find this objectionable talk to me. It shouldn't crash the program, however you won't be able to load/save any filenames in those long paths.
- There may be problems related to accessing disks in the floppy drives (or more specifically, floppy drives with no disks in them) I rewrote the DOS error handler to better handle it and it appears to work...but no promises.
- Occasionally not all memory will be freed on an exit. Usually this only happens after loading and editing several quest files. This isn't a serious bug and I believe I can blame most of it on the compiler used since I have this problem in all of my large programs and have never been able to track it down. It occurs when I delete some allocated memory yet the freed memory does not become available to the program. In other programs I can correct this by altering the order of variable allocation and deletion, something I shouldn't have to do. Anyways, if any programmer out there has any ideas let me know...please.
A number of people have contributed invaluable information concerning the format of quest files. Many thanks go to the following...
This program also uses 3rd party keyboard and mouse routines which have saved me much time from writing and debugging them myself.
- INT9 (IRQ1) keyboard handler #9 by Patch (firstname.lastname@example.org)
- MOUSE Routines by Michael Chen (email@example.com)
To contact the creator of DFQEdit E-Mail Dave Humphrey at firstname.lastname@example.org
For latest version updates of DFQEdit, The ESP: Daggerfall Files
For the Quest Editing Guide, The ESP: Quest Editing Guide
If there's any other sites you think should be included here, feel free to suggest them.
|GUILDS.DAT||Contains listing of guilds/factions|
|MSG.DAT||Contains listing of variable names|
|ITEMS.DAT||Contains listing of items and their codes|
|MOBS.DAT||Listing of known human and non-human monsters|
|SEC43.DAT||Listing of values for the three unknown fields of QBN section 4|
|SEC71.DAT||Listing of values for the unknown field of QBN section 7|
|LOC.DAT||Listing of known locations|
|DFQEDIT.TXT||Program documentation (this file)|
|DFQFAQ.TXT||Quest hacking guide|
|Source Code||Is not included in archive due to size, but is freely available if you want it.|
- v0.30 Beta - Current Version
- Released 20 April 1997
- Fixed a NULL pointer bug in the editor which caused crashes
- Fixed several memory allocation errors which caused crashes
- The mouse pointer disappears/appears when it's supposed to when saving/loading files in the editor.
- Can now double-click on file/directory names to load or change directories..
- Added the ability to sort lists. File lists and some others are now sorted alphabetically for your convenience.
- Improved the doubly-linked list add_item code. Now takes up much less space, is easier to use and should be more reliable.
- Can now edit all of the Items and some of the NPC sections in the QBN file. We don't understand all of the sections do yet but feel free to explore.
- v0.20 Beta
- Released 28 March 1997
- Changed name to DFQEdit due to trademark violation...oops!
- Rewrote much of the code (such as the buttons and lists etc...) and it is much more elegant and easier to code.
- v0.10 Beta
- First release - ? December 1996
- Future Versions
- Change more quest parameters (monster type, item type, quest location, house/dungeon type, etc...)
This program is considerable larger and more complicated than the other Daggerfall utilities I've released (DAGPIC and DAGREFL). It uses several source files and some old code I've used for a while (like the text editor base I created about a year ago). It also uses 3rd party keyboard and mouse routines which have saved me much time from writing and debugging them myself.
- INT9 (IRQ1) keyboard handler #9 by Patch (email@example.com)
- MOUSE Routines by Michael Chen (firstname.lastname@example.org)
Also, a number of people have contributed invaluable information concerning the format of quest files. Many thanks go to the following...
- Peggy S Hanks (email@example.com) - General info
- Lord Phoenix (firstname.lastname@example.org) - General info
- Michael P. Schneider (email@example.com) - Much information on the file formats, variable names. Has his own quest editor for any 32bit Windows system (Win32s, Win95, WinNT).
Although this program has not ever caused any sort of damage to my computer (short of the odd lock-up/reboot) in the many hours of testing and debugging, there is no guarantee that it won't. I cannot be held responsible for any software or hardware damage incurred through the use of this program.
I am in no way connect with BETHESDA, the computer gaming company who created TES: Daggerfall. This is completely a third party hack of the quest files.
All files in the above file list are free domain software and can be copied, duplicated, at will. If you wish to use the source for a project of your own, I would consider it a courtesy to tell me and give credit somewhere.
Appendix A - Listing of %string Variables
Appendix B - Listing of _string_ Variables
Appendix C - Listing of =string_ Variables
Appendix D - Included Data Files (*.DAT)
When DFQEdit runs it expects to find several data files in the current directory.
These files contain data for the various lists used in the program such as guild names and monsters. Having these values contained in files make the program much more flexible and it is easier to change any value(s) in these files. It is possible for one to modify these files to reflect any new information obtained through editing quest files or by any other means. For instance, through many hours of quest editing you figure out that the Giant Rat and Giant Bat in the MOB.DAT file are switched. You could edit the file (with any text editor) to swap these values. If you do come across errors or any additions for these files, make sure to let me know (firstname.lastname@example.org)
Dual List File Format
All data files except MSG.DAT are of the dual format. These files contain a number followed by a text description on one line.
- 1043 Does Weird Stuff
The number may be of binary (1001b), octal (0174), or hexadecimal (0x5Fa) as well as the usual decimal values. Each line of the data file contains exactly one record and the data is read until the end-of-file, there are no comment type characters. If after modifying one of these files the program unexpectedly crashes or the list outputs strange data, you probably made a mistake (I guess it's too late to mention back-ups...)
Single List File Format
At the moment, only the file MSG.DAT uses this format. In this format each line represents one list item. Again, there are no comment characters and the entire file is read.