-----------------
DLGEditor v2.3.2
-----------------

Version history
---------------------------------
v1.0.0   Sep 13, 2004  Initial Release
v1.0.1   Sep 13, 2004  Fixed Stuntlist-DelayEntry bug
v1.0.2   Sep 17, 2004  Extra error checking, removal of extraneous dialog boxes
v1.0.3   Sep 18, 2004  Fixed comment bug and startinglist bug, allow paste onto
                       root node
v1.0.4   Sep 20, 2004  Modified for some unicode accommodations
v1.0.5   Oct 13, 2004  Made more compatible with dialogs edited by KotOR Tool
v1.0.6   Nov 21, 2004  Fixed Animation List bug
v1.0.7   Dec  4, 2004  Coercion of unicode to Ascii character equivalents
v1.0.8   Jan  4, 2005  Added Auto-Apply feature to Edit menu
v2.0.0   Mar  1, 2005  Initial (unreleased) version with TSL support
v2.1.0   Mar  6, 2005  New features added, bugs fixed and first beta release
v2.1.1 - Mar  7, 2005  Added TSL specific field creation for Add Entry
                       and Add Reply functions; improved Go To Node Index...
v2.1.2   Mar  7, 2005  Polished up so many things I don't remember now. First
                       public release. :-)
v2.1.3   Mar 13, 2005  Added CameraID field to branch nodes
v2.1.4   Apr  3, 2005  Added Listener fields for Entry branches
                       Fixed bug where Script2 was being generated as a
                         CExostring instead of CResref
v2.1.5 - Apr 27, 2005 - Added new animations for TSL
                      - Fixed the "Paste as New was really pasting as copy until reverted" bug
                      - Paste node now also pastes conditionals (conditionals pasted as new)
                      - Added Enable/Disable Undo feature for speed
v2.1.6 - May  1, 2005 - Added adjuster widget to allow resizing of the upper pane
v2.1.7 - Jun 20, 2005 - Added better support for characters with ASCII codes between 0x80 and 0xFF
v2.2.0 - Jul 7, 2005  - Improved response to mouse clicks after using context menu.
v2.2.1 - Jul 31, 2005 - Added Search by StringRef, Text (F9, F10)
v2.2.2 - Sep 19, 2005 - Fixed duplication of Listener fields in EntryList
                        Fixed duplication of Active/Index/IsChild fields during Paste as Copy
                        (thanks stoffe -mkb-!)
v2.2.3 - Oct 19, 2005 - Added most recently used list to File menu
v2.2.4 - Nov  3, 2005 - Added support for CameraAnimation field
v2.2.5 - Jan 16, 2006 - Fixed a bug in Paste as Copy that was dropping the Conditional script
                        Added option to cascade changes made to conditional node parameters
v2.2.6 - Feb 25, 2006 - Added ability to detect orphans as they occur
                        Added Edit menu item: Delete All Orphans
v2.2.7 - Mar  8, 2006 - Fixed bug where right-click Break Link With Parent caused error
v2.2.8 - May 11, 2006 - Fixed bug where View Orphan + View Conditional caused Can't call
                        method "get_field_ix_by_label" on unblessed reference (thanks Dashus)
                      - changed bindings: Ctrl-End and Ctrl-Delete now bound to treeview;
                      - changed bindings: F2, F3, F4, F5, F11, F12 now bound to main window
                      - Fixed Ctrl-z keystroke binding (wasn't working)
                      - Fixed bug associated with TSL animations whose descriptions had '-'
                        characters in them *doh!* (thanks jinger)
v2.2.9 - May 23, 2006 - Added handling for unknown animations (will appear prefixed with "???_")
v2.3.0 - Sep 5, 2006  - Fixed bug where undoing an add of a reply to a reply or an entry to an
                        entry would not undo the creation of the implied entry or reply. 
                        Thanks to Dashus for this. 
                      - Fixed bug where Edit:Delete All Orphans was not enabled right after a 
                        File:Open command (again, thanks Dashus)
                      - Animations can now be added without having to select from the list 
                        (they can be typed by number)
v2.3.1 - Feb 5, 2008  - Recompiled with PerlApp 7.1 (now supports Windows profiles that contain 
                        Unicode chars)
v2.3.2 - Apr 30, 2008 - Changed the order of variable declaration to prevent program from 
                        crashing if the registry hadn't been set correctly and no dlgeditor.ini
                        existed.  Also fixed a bug that wouldn't allow you specify a dialog.tlk
                        file (via Ctrl+T) if the dialog.tlk was capitalized.  Compiled w/ PerlApp
                        7.2

Overview:
----------
DLGEditor is a GUI based dialog viewer and editor for Star Wars: Knights of the
Old Republic and Star Wars: Knights of the Old Republic II: The Sith Lords.
The editor is divided into two panes.  The upper pane contains the treeview
portrayal of the dialog with NPCs speaking in red (Entries) and PC replying in
blue (Replies).  Upon highlighting the nodes of the tree, detail widgets appear
in the lower pane containing node-specific information which can be edited.

DLGEditor's Menubar
----------------------

---[FILE]---

File: New -  This will create a new dialog with only the root node.

File: Open... - Allows user to browse for a dialog file to open.

File: Revert - This will cause the current dialog to lose all changes since its
               last save.

File: Close - Closes the current dialog.  Treeview will be cleared.

File: Save - Saves dialog with current name.

File: Save As... - Displays a Save As dialog allowing user to browse and
                   specify the path name.

File: Change TLK File Paths... - Brings up a popup window containing the
                                 current paths specified for KotOR and TSL
                                 dialog.tlk files.  The [...] buttons allow the
                                 user to browse for the dialog.tlk file(s) they
                                 wish to use with DLGEditor.

File: Launch in GFF Editor - If GFFEditor.exe is present in the current
                             directory, it will be launched with the current
                             dialog passed as a parameter.

File: Launch in DLGEdit - If DLGEdit.exe is present in the current directory,
                          it will be launched with the current dialog passed as
                          a parameter.

File: Exit - Terminates DLGEditor


---[EDIT]---

Edit: Undo - 4 levels of undo are supported.

Edit: Add New Entry -  Adds an Entry (red) dialog branch to be spoken by the
                       NPC. If the Root Node or a Reply is highlighted when
                       this menu command is selected, the new Entry will appear
                       directly under the highlighted node and will become
                       highlighted.  If an Entry is highlighted when this menu
                       command is selected, a new Reply branch will be added and
                       the new Entry will be attached to it.

Edit: Add New Reply -  Adds a Reply (blue) dialog branch to be spoken by the PC.
                       If an Entry is highlighted when this menu command is
                       selected, the new Entry will appear directly under the
                       highlighted node and will become highlighted.  If the
                       Root Node or a Reply is highlighted when this menu
                       command is selected, a new Entry branch will be added
                       and the new Reply will be attached to it.

Edit: Break Link With Parent - This will sever the parent-child relationship
                               between two branches.  If there is no other link
                               to the severed child branch, it will become an
                               Orphan.

Edit: Delete Node Completely - This will remove the Entry or Reply node
                               completely from the dialog, severing all parent-
                               child relationships (which may cause other child
                               branches to become Orphans.)

Edit: Automatically Apply Changes - Turning this menu option on will cause the
                                    treeview and internal memory representation
                                    of the dialog to be updated each time a
                                    node is selected.  Turning this option off
                                    will create an Apply Changes button in the
                                    lower pane that must be pressed to update
                                    the treeview and the memory structure.
                                    This menu option is by default turned on.

Edit: Cut Node - This will cause a Break Link With Parent at the current node,
                 but will store the broken branch in an internal buffer.

Edit: Copy Node - Similar to Cut Node but without causing the current node to
                  be broken from its parent.

Edit: Paste Node as Copy - This will paste a symbolic link to the branch that
                           was previously stored via Cut Node or Copy Node.
                           The index of the node pasted will be the same as the
                           index of the copied or cut node.

Edit: Paste Node as Copy - This will create a new branch identical to the
                           branch that was previously stored via Cut Node or
                           Copy Node.  The index of the node pasted will be
                           different from that of the copied or cut node.

Edit: Delete All Orphans - This menu item will be enabled if orphans are present
                           in the current dialog. When clicked, it will turn on
                           View Orphans and recursively delete each orphan node
                           including orphans from orphans.

---[MODE]---

Mode: Toggle Mode: KotOR - In KotOR dialog mode, DLGEditor will switch to the
                           KotOR dialog.tlk file and show only KotOR supported
                           dialog fields in the lower pane.  If no KotOR
                           dialog.tlk file is available, DLGEditor will generate
                           an error message and will toggle back to TSL mode.

Mode: Toggle Mode: TSL - In TSL dialog mode, DLGEditor will switch to the TSL
                         dialog.tlk file and show all KotOR and TSL supported
                         dialog fields in the lower pane. If no TSL dialog.tlk
                         file is available,  DLGEditor will generate an error
                         message and will toggle back to KotOR mode.

Mode: Language Settings - This specifies the language ID to be used when
                          storing localized dialog strings.  Upon selecting a
                          new language, all localized strings will have their
                          settings changed in memory. KotOR and TSL require the
                          correct language specification to display dialog text
                          properly in-game.

Mode: Resolution - Setting the screen resolution will make the fonts and
                   widgets appear larger or smaller.  Changes will not occur,
                   however, until DLGEditor is closed and reopened.  The Use
                   Default option will revert the scaling back to normal size
                   upon reopening DLGEditor.


---[VIEW]---

View: Show Conditionals in Tree - This will display conditional scripts in the
                                  Treeview pane.  These are the scripts that
                                  are run to determine whether the branch will
                                  be displayed as a dialog option in-game.
                                  Conditional scripts will appear in angle
                                  brackets prepended to the text for each node.
                                  If no conditional is present, empty angle
                                  brackets will appear.  Note: TSL has two
                                  possible conditions per node and will
                                  therefore show two sets of angle brackets
                                  prepeneded to each branch.

View: Show Scripts in Tree - This will display conditional scripts in the
                             Treeview pane.  These are the scripts that are run
                             to when the dialog option is selected in-game.
                             Scripts will appear in angle brackets appended to
                             the text for each node. If no script is present,
                             empty angle brackets will appear.  Note: TSL has
                             two possible scripts per node and will therefore
                             show two sets of angle brackets appended to each
                             branch.

View: Show Indices in Tree - This will display each node's index in the
                             Treeview pane.  Indices are listed as E# or R#
                             depending on whether they are Entries or Replies.
                             Each # represents a unique branch of the dialog.
                             The treeview may show the same branch more than
                             once in case of multiple points of branch entry.
                             Indices appear in square brackets prepended to
                             the text of the branch.

View: Show Orphaned Replies/Entries - Orphan nodes will normally not appear in
                                      the Treeview since they have no branch
                                      entry point; that is, they have no parent
                                      and will not appear in-game.  When this
                                      option is selected, Orphan nodes will
                                      appear as purple and will be listed
                                      underneath the Root Node.  If this value
                                      is turned off and orphans do exist, a
                                      popup box will appear one time to alert
                                      you to that fact.

Expand All: Opens up all branches for viewing. Nodes will appear with the [-]
            indicator.

Fold All: Hides all branches except those under the Root Node.  Nodes will
          appear with the [+] indicator.

Go to Index: This menu option allows the user to jump to a specific index in
             the dialog.  Indexes must be within the valid range listed and
             must be of the syntax E# or R#.  If the selected index represents
             an Orphaned node and Show Orphaned Replies/Entries is not turned
             on, the user will be prompted to do so.

Search by StringRef: A popup box will appear allowing the user to specify a
                     StringRef number.  The dialog will be searched starting
                     with Entry structures followed by Reply structures in
                     numerical order.  If found, the tree node will be
                     highlighted and displayed.  If more than one instance is
                     found, a popup box will ask the user whether to display
                     the next instance.  If the search fails, a popup box will
                     inform the user.

Search by Text: Similar to search by StringRef except a portion of text will
                be used as the search term.  The search will be applied to both
                localized strings and dialog.tlk strings.

---[HELP]---

Help: About DLGEditor... - Displays version and author information.



Using DLGEditor
-----------------------

Upon startup DLGEditor will attempt to locate dialog.tlk files for both KotOR
and TSL.  If it detects both files, startup will occur without any message box.
If only one of the two dialog.tlk files is found, a message box will appear
indicating this and suggesting that you choose File: Change TLK File Paths...
(Ctrl+T) to manually select the missing TLK file if necessary.  If neither
dialog.tlk file is found, DLGEditor will bring up the
[File: Change TLK File Paths...] dialog box immediately. If the user is not
able to specify the location of at least one dialog.tlk, DLGEditor will exit.
(If you are trying to work completely offline on a fully custom dialog with no
dialog.tlk references, simply fool DLGEditor by renaming any file to dialog.tlk
and pointing DLGEditor at it for both KotOR and TSL paths.)  The current
dialog.tlk file is always displayed in the lower left corner of the lower pane.

Begin using DLGEditor by opening an existing .dlg file or by creating a new one
from scratch.  The .dlg files from KotOR and TSL can be extracted using KotOR
Tool.  When opened, DLGEditor will attempt to determine whether the .dlg is a
KotOR or TSL dialog file and will automatically switch to KotOR or TSL Mode (as
can be seen in the Mode menu).  If, however, the mode cannot be switched to due
to lack of that dialog.tlk file, the user will be informed via message box.

Dialogs will appear in the upper pane as a treeview.  A node on the tree can be
highlighted by single-clicking on it.  Highlighting a node will display the
nodes properties in the lower pane.  The user may then edit these properties.
Right clicking on a node will bring up a context menu for quick editing
options.  Double-clicking on a tree branch whose text says "(already listed)"
will jump to the original listing of that entry or reply.

The Root Node is a special node that contains the general properties of the
dialog.  These properties affect the entire dialog.  Branch nodes represent
Entry or Reply instances.  NPCs speak the Entry lines (shown in red); the PC
speaks the Reply branches (shown in blue).  The properties of Replies and
Entries are very similar.

Properties of the Root Node
-----------------------------

- Ambient Track: a Resref to a music file

- Camera Model: (?)a Resref

- Delay Entry: an integer describing how many seconds of delay before an NPC
               will respond to the PC

- Delay Reply: an integer describing how many seconds of delay before the PC
               will be allowed to give a response

- Script that fires when conversation ends: a Resref to a script that will fire
                                            when the dialog ends normally.

- Script that fires if conversation aborts: a Resref to a script that will fire
                                            if the conversation is aborted
                                            prematurely (eg. due to a battle).
                                            I'm not sure whether this occurs at
                                            all in KotOR/TSL.

- Skippable: A boolean value that means the dialog can be skipped through.

- UnequipHItem: (?)a boolean

- UnequipItems: (?)a boolean

- Voiceover ID: Voice-Over Identifier, a Resref.  For more info on this field
                see this tutorial on adding voice and lipsync to a dialog:
                http://www.lucasforums.com/showthread.php?s=&threadid=126746

- Conversation Type: Whether this is a person-to-person or a person-to-computer
                     conversation

- Computer Type: For Conversation Type=Computer, this is the appearance of the
                 computer

- AlienRaceOwner: References to rows in alienvo.2da for default droid or alien sounds.
                  Useful for dialogs that are primarily droid/alien.  (TSL only)

- RecordNoVO: When this is 1, it indicates, this dialog uses alien or droid sounds by
              in alienvo.2da using AlienRaceOwner as the default row. Useful for
              dialogs that are primarily droid/alien.  Nodes can vary the sound using
              Emotion or the node's own AlienRaceNode value.(TSL only)

- PostProcOwner: ? (integer) (TSL only)



Properties of the Branch Nodes in KotOR Mode
---------------------------------------------

- Speaker/Listener: Tag of NPC to do the speaking/listening.  If blank, it is
                    the NPC that started the dialog.

- Script that Determines Availability: This is a script to be evaluated by the
                                       dialog for this branch. The script must
                                       be declared as
                                       "int StartingConditional()"
                                       and return 0 or 1 upon completion.  This
                                       dialog branch will not be spoken or
                                       available if the script returns 0.

-  Script that fires when spoken:  This script will run when this branch is
                                   spoken.

-  VO_ResRef: Used for Voiceover and lipsync during dialog.

-  Sound: Used for alien and droids sounds to play during dialog instead of
          VO_Resref (KotOR only)

-  Sound Exists: Boolean

-  Delay: Delay before this branch is spoken (seconds?)

-  WaitFlags: ? (integer)

-  CameraID: use a predefined camera for this branch.  Cameras are defined in
             the .git file for each area under the CameraList field.

-  CameraAngle: an integer that specifies the camera angle to use when this
                Entry is spoken.

-  FadeType: an integer that specifies the type of fade in/fade out effect to
             use in this branch.

   / for more information on the next 4 fields see:                \
   \ http://www.lucasforums.com/showthread.php?s=&threadid=143372  /
-  Quest:  a reference to global.jrl  quest

-  QuestEntry: a entry in the quest to be added to the player's journal when
               this branch is spoken

-  PlotIndex: references the global.jrl quest

-  PlotXPPercentage: a multiplier for experience point reward upon completion
                     of the quest

-  Comment: this field is just to hold developer comments

-  StrRef:  If this value is 0 or greater, this value is a pointer to a
            dialog.tlk entry. If the value is -1, then the text is stored
            within the .dlg file itself (so most custom dialogs will have -1 in
            this field).

-  Text: The text to be spoken.  This will be a read-only field if StrRef is
         not -1.

-  Animations:  You can choose what animations the PC/NPC will perform during
                the dialog by dragging an animation from the Available
                Animations list to the Current Animations list and choosing the
                Participant.  The Participant can be the tag of an NPC or can
                be OWNER representing the main NPC speaker.  To make the PC
                animate, specify PLAYER as the Participant.


Properties of the Branch Nodes in TSL Mode
---------------------------------------------
(TSL supports all of the fields listed for KotOR plus the following fields.)

Conditional #1: This is the same as "Script that Determines Availability" above

Conditional #2: A secondary script for determining availability

Script #1: This is the same as "Script that fires when spoken" above

Script #2: A secondary script that fires when spoken.

P1 through P5:  TSL supports parameters that can be passed to scripts. P1-P5
                represent integer values that the scripts (both normal and
                conditional) can receive using the GetScriptParameter function.
String Param:   TSL supports parameters that can be passed to scripts. String
                Param represents a string value that the scripts (both normal
                and conditional) can receive using the GetScriptStringParameter
                function.
Not: Inverts the result of the Conditional Script

Logic: (?) Should be 0 if Conditional #2 is not specified.  Otherwise a 0 means
           the results of both conditionals will be evaluated, inverted as
           specified by their Not parameters and the results will be AND-ed
           together.  A 1 indicates the conditionals should be OR-ed together.
           Could be that a 2 indicates XOR operation.

Emotion:  Used for Alien/Droid voiceovers, this modifies the sound that is
          uttered. References the column in alienvo.2da

FacialAnim: (?) Not sure if this is was a scrapped idea or not, but the guess
                here is that certain models contained facial animations that
                this parameter would invoke.

AlienRaceNode: When RecordNoVOOverride=1 for this node, this value references
               the row in alienvo.2da to use for droid and alien sounds. See also
               Emotion property for this node.

PostProcNode: (?) Integer

NodeID: (?) Integer

CamVidEffect: Modifies the camera style during this branch of the dialog. Not
              certain how extensive this parameter has been implemented.

RecordNoVOOverride: When this is 1, this node will use droid or alien sounds
                    rather than VO_Resref. The value of this node's
                    AlienRaceNode and Emotion properties to look up the sound in
                    alienvo.2da.  Useful for when droids/aliens speak in otherwise
                    human dialog.

RecordVO: When this is 1, indicates that this node will use VO_Resref, even if
          RecordNoVO in General Properties equals 1. Useful for when humans speak
          during an otherwise droid/alien dialog.

Node Unskippable: Boolean value that overrides the Dialog-wide parameter of
                  Skippable (see Properties of the Root Node).

CameraAnimation: (?) WORD performs camera animations

Further Reading
-----------------------
For more information about the DLG file format see:
http://nwn.bioware.com/developers/Bioware_Aurora_Conversation_Format.pdf

For more information about modding KotOR and TSL visit
http://www.lucasforums.com/forumdisplay.php?s=&forumid=324

This utility is dedicated to all modders who wish to improve the Star Wars
gaming experience for themselves and others.


Contact Info
-----------------------
Author: tk102  <zxcvbnm6012@yahoo.com>
Please direct comments, suggestions, omissions, submissions, admissions,
confessions, and bugs to the email address listed here.
