MWEdit v0.5.5 - Using Guide


Contents

1. Introduction
2. Backing Up Plugins
3. What It Can't Do (Yet)
4. Loading Plugins
5. The Main View
6. Record Windows
7. Scripting
8. Dialogue
9. Containers, Levelled Lists
10. Find Text
11. Cleaning Records
12. Submitting Bugs
13. CSV Export/Imports
14. Script Templates


1. Introduction

MWEdit is an alternate editor for the Elder Scrolls: Morrowind RPG from Bethesda. While it is similar in appearance and design to the official Construction Set editor, it introduces new features that make creating plugins easier.

This document explains some of the new features and the major differences from the official editor.

Comments and suggestions are always welcome...visit the SourceForge site at mwedit.sf.net to add bug/features, contribute to the forums, or simply e-mail me at uesp@sympatico.ca.


2. Backing Up Plugins

A common concern when using any unofficial editor such as MWEdit is the possible corruption of the file data (plugins in this case), especially for an editor still in alpha/beta release. As when working with any data, it is reccommended that you back up your plugin files regularily.

Fortunately, MWEdit automatically backs up your plugin when you save it. The first time the plugin is backed up, the backup will be named "Plugin.esp.001". Subsequent back ups will be "Plugin.esp.002", "Plugin.esp.003", etc... MWEdit will never overwrite an existing plugin which means that if you save often, you'll have an almost complete history of changes in your plugin. This is useful if you accidently saved something you didn't want or need to revert to an earlier version for debugging.

Note that for large plugins, you may wish to delete the backups occasionally if you are low on disk space.


3. What It Can't Do (Yet)

MWEdit is by no means a complete plugin editor, and might not ever be depending on the amount of support and feedback I receive. The specific major areas that are currently missing are:
  1. 3D view (so you cannot add/edit cell references)
  2. Region paint
  3. Animations
  4. Path grid
  5. Cell reference information edit


4. Loading Plugins

The load dialog window has been improved slightly as it includes the last modified date of each plugin, can be sorted, and displays ESS save game files as well. It is important to note that all ESM master files will only be loaded once each session, greatly increasing the load speed for subsequent loads. If you need to reload a master file simply quit the program and restart it.

It is also possible to load a plugin without having to load the required master files. This is particular helpful for quickly testing plugins or for debugging. It is important to note that if you do load a plugin without it's master(s) it is possible to 'lose' some information. For instance say an item in the plugin uses some script that is in the master file. If you edit and save that item the script field will be reset since the script doesn't exist. This may be fixed in a later version.

MWEdit uses a standard Multiple Document Interface (MDI) which allows you to edit several plugins at the same time. You can use this to copy content from one plugin to another (simply drag records from the main view from one document to the other).


5. The Main View

MWEdit's main view contains the same large item list but the tab control of record types has been changed into a list on the left side of the window. The alphabetically sorted list allows you to more quickly select the desired type rather than having to find the type in the tab bar (which tends to keep changing the tab positions).

You'll also notice that all record types are in the record type list rather than having some items in the list and some accessed from the menu (like scripts, globals, etc... in TESCS). Currently the only thing not in the list is the plugin info (author and description text).

The list's columns are also slightly different, such as with the addition of the "Mod" column for all record types. This allows you to easily view all the active and deleted records by simply sorting by "Mod". Other record types have addition columns added as well. The last sort column as well as the column widths are saved and restored when you switch record types.

The record list is color coded to quickly identify active (green) and deleted (red) records. You can use the View-View Changed menu item to display only the current active records. Right-click on the item list to display commands such as Copy, Rename, etc... New, and hopefully clearer, icons have been created for all record types.

Note that all record lists in the game generally function identically. For instance, in the container item list you can double-click to display and edit that item.


6. Record Windows

There are number of important notes to mention in general about the windows used to edit individual records. The records are all similarily designed with a Save and a Cancel button in the same place. Changes to a record are never permanently saved until you press the Save button. If you close the window or pressing the Cancel button you will lose any changes made since you opened that window. This goes for the dialogue record window as well. Changes to any infos in a dialogue will not be recorded until the Save button is pressed. Note that if you save the plugin with open record windows, the changes made in those windows will not be stored in the file.


7. Scripting

One of the major reasons for creating MWEdit is to improve the ease of creating and debugging scripts which are probably one of the most difficult aspects of plugin creation.

A completely new script compiler has been created from scratch which records many more error messages and warnings than the TESCS compiler. An error message will prevent the script from compiling successfully while a warning message will not (although the compiler script may not work as expected). Some of what the new compiler checks include:

  1. Object types used in functions are checked more rigourously. If the function expects an NPC ID, you'll receive an error/warning if you use another type.
  2. Functions that are known to be broken will result in a compiler message.
  3. Compiler does not permit the use of reserved words as local variables (such as END, X, Y, etc...).
  4. Required spaces in IF and SET statements (spaces are added if missing)
  5. Checks for missing or extra function arguments.
  6. Does not allow the use of multiple objects references on one line.
  7. Checks the number of buttons/variables used in the MessageBox function.
  8. Warns for missing function commas.
  9. Warns for local/global ID conflicts.
  10. Checks if the function accepts variables or not.
  11. Checks maximum length of variables, IF, SET statements, etc...
  12. Checks for unknown or incorrect syntax.
When you compile a script, all warning and error messages are displayed in a splitter list at the bottom of the script window. You can double-click a message to jump to that point in the script where the error occurred, or right-click the message to display more options such as viewing details of the message including any function information if available.

There are three levels of recording warning/error messages: Weak, Default, and Strong, allowing you to set how many warning/error messages are recorded during a compile.

The script text is color coded which allows you to easily identify functions, numbers, keywords, etc... A default white or blue color scheme is available or define your own custom colors which are saved in the registry. The color formatting can also be disabled. The font used in the script window can also be selected.

Complete help on all the script functions is available from the help menu. The help describes all the function parameters, the return value, and function description as well as any special function notes (such as whether it is a Tribunal function, etc...).

Other script commands include the ability to export and import scripts to/from text files and the compiling of scripts on save automatically (no warrning/errors displayed). The Import/Export option is available from the File menu. Exporting a script will output the entire script(s) to a text file with the same name as the script (existing script files are overwritten). When you import a script the script name will be taken from the script name within the file (i.e., begin scriptname).


8. Dialogue

Editting dialogue topics and INFOs is another difficult part of creating plugins which MWEdit attempts to improve upon. Like the other record types, all changes you make to INFOs in a dialogue are not saved until you press the Save button. Otherwise, all additions, deletions, and modifications are cancelled.

When copying or renaming dialogue topics you will also create a copy of all child INFOs. You can similarily create a copy of INFO records within a dialogue topic (select the records and right-click on the list).

The INFO list in the dialogue window displays more information than that in TESCS. If the INFO uses any functions the entire function description (ex: 'GameHour >= 18') will appear in the list allowing you to more quickly determine which INFO you wish to edit.

Other options include being able to easily change the order of INFO records and the standard filtering by NPC.

The INFO record IDs are generated slightly differently than in TESCS in a manner which virtually guarantees that the ID is unique. The ID is an up to 30 digit number such as 610641915360541333977 with the following format:

Bytes 0- 9: Current system time in seconds since midnight, January 1, 1970
Bytes 10-19: Drive c: serial number (or clock ticks if serial number is not available)
Bytes 20-29: Incremented counter per application session starting at 1
Thus, it is highly unlikely that two people will ever generate the same INFO ID.


9. Containers and Levelled Lists

MWEdit makes it easier to work with containers and levelled lists. Items can dragged into these lists from the main view or from other containers/lists as in TESCS. Records can also be editted directly from the container/list by double-clicking them. You can modify the item count in containers (or the level in levelled lists) by selecting one or more items and using the + and - keys to easily increment/decrement the value.


10. Find Text

MWEdit has the same Find Text command as TESCS in the Edit menu. The command searches through all currently loaded records for an exact match to the given text string (not case sensitive). The find results are improved in that they are all displayed in a single result list along with their ID and type (all of which can be sorted to quickly find the desired record). Double-click any record in the list to edit that record (including INFO records which will open the parent dialogue topic as well as the INFO edit window).


11. Cleaning Records

A new command, Clean, is available for most record types (including INFOs) and some sub-record types (such as individual cell references). To access the clean command select and right-click one or more records. The clean command attempts to permanently remove the given record from the current active file. Note that once you clean a record you cannot undo the clean (not yet anyways), other than reloading the plugin. This allows you to easily remove unwanted edits/references or revert a record to its original state. Previously this had to be done by a seperate utility such as TESAME.

It may not be possible to clean some INFO records depending on their contents. INFO records use a doubly linked list structure which, if a record is cleaned, can be permanently messed up resulting in lost INFO records or an infinite looping structure. Generally you can clean INFO records unless you move or add new ones. You'll receive a warning message if you cannot clean a particular INFO.


12. Submitting Bugs

Bug/error reports and feature requests are gladly welcome and can be either submitted on the MWEdit SourceForge Project Page or by E-mailing Me. You can find handy links in the Help menu as well on the toolbar for quickly displaying the bug reporting page on the SourceForge project site.


13. CSV Import/Export

Many items have the option of being imported and exported from regular CSV (Comma Seperated Value) text files which can be output by most spreadsheet programs. This allows you to easily and quickly create a large number of items. You can import/export files by from the commands under the File menu.

Unlike the files output by the TESCS the supported CSV format is flexible and allows more record data to be imported or exported. The first line in the CSV file gives the column names for the subsequent data. In order for a CSV file to be successfully imported, these column names much match that as listed in the table below. The columns can appear in any order and all but the ID and ItemType columns are optional.

Record Field Description
Common Fields common to all, or most, record types.
ID The unique item ID. If you specify an existing ID that has the same type as the imported record, the existing record will be overwritten. If the existing record is of a different type, an error will occur.
ItemType The type of record to import. See the list of supported types below:
  • Activator
  • Alchemy
  • Apparatus
  • Armor
  • Book
  • Class
  • Clothing
  • Container
  • Enchantment
  • Global
  • Ingrediant
  • Light
  • Lock
  • Misc
  • NPC
  • Probe
  • Race
  • Repair
  • SoundGen
  • Sound
  • Spell
  • Static
  • Weapon
  • Name For records that have a displayed object name.
    Model The NIF model of the objects that have one.
    Icon Inventory icon for carryable objects.
    Script The script name for objects that can have them.
    Weight Floating point weight in game units
    Value Item value, unsigned, usually long (4 billion), sometimes short (65535)
    Persist Persistance flag, True/False, Yes/No
    Blocked Blocked (read-only) record flag, True/False, Yes/No
    Activator Activator objects
    Alchemy Potions
    AutoCalc Yes/No, True/False
    Weight  
    Value Unsigned long
    Apparatus Alchemy apparatus objects (Retorts, Calcinators, etc...)
    Quality Floating point (1.0 = default)
    Weight  
    Value Unsigned long
    AutoCalc Yes/No, True/False
    Armor Armor items
    Type Type of armor, one of:
    • Helmet
    • Cuirass
    • Left Pauldron
    • Right Pauldron
    • Greaves
    • Boots
    • Left Gauntlet
    • Right Gauntlet
    • Shield
    • Left Bracer
    • Right Bracer
    Rating Armor value, long
    Weight  
    Value Unsigned long
    Health Maximum condition of armor, long
    Enchant Enchantment ID string
    EnchantPts Available enchant points, long
    Book Books, scrolls, parchments, etc...
    Teaches Skill ID string
    Value Unsigned long
    Weight  
    Enchantment Enchantment ID string
    EnchantPts Available enchant points, long
    Class Custom class description
    Description Class description string
    Playable True/False, Yes/No
    Clothing All clothing objects
    Type Type of clothing, one of:
    • Pants
    • Shoes
    • Shirt
    • Belt
    • Robe
    • R. Glove
    • L. Glove
    • Skirt
    • Ring
    • Amulet
    Value Unsigned short
    Weight  
    EnchantPts Available enchant points, long
    Enchantment Enchantment ID string
    Container Any sort of container: chest, barrel, desk, etc...
    Weight  
    Organic True/False, Yes/No
    Respawn True/False, Yes/No
    Enchantment Enchantment description for use with items, potions, spells, etc...
    Type Type of enchantment, one of:
    • Cast Once
    • Cast Strikes
    • Cast When Used
    • Constant Effect
    Cost Cost to use the enchantment
    Charge Maximum charge
    AutoCalc True/False, Yes/No
    Global Global variable definition for use in scripts and dialogue
    Type Type of value, one of:
    • short
    • long
    • float
    Value Global variable value
    Ingrediant Ingrediant and foods
    Value Unsigned long
    Weight  
    Light Light object, both visible, carrayable, and invisible
    Value Unsigned long
    Weight  
    Sound Sound ID string
    Radius Unsigned long range in game units
    Lock Lockpicks
    Value Unsigned long
    Weight  
    Uses Number of uses, long
    Quality Floating point quality (default = 1.0)
    Misc Miscellaneous objects
    Value Unsigned long
    Weight  
    NPC NPC definition
    Level NPC level, short
    Race Race ID string
    Female True/False, Yes/No
    Class Class ID string
    Faction Faction ID string
    Rank Faction rank value, short
    AutoCalc True/False, Yes/No
    Respawn True/False, Yes/No
    Animation Alternate animation file
    Disposition Disposition value, short
    Blood Blood type, one of:
    • Default (Red)
    • Skeleton (White)
    • Metal (Gold)
    • Default
    • Skeleton
    • Metal
    • Red)
    • White
    • Gold
    Hair Hair bodypart ID string
    Head Head bodypart ID string
    Strength (Str) Attribute value, unsigned char (0-255). Ignored if AutoCalc is true.
    Agility (Agi) Attribute value, unsigned char (0-255). Ignored if AutoCalc is true.
    Speed (Spd) Attribute value, unsigned char (0-255). Ignored if AutoCalc is true.
    Endurance (End) Attribute value, unsigned char (0-255). Ignored if AutoCalc is true.
    Willpower (Wil) Attribute value, unsigned char (0-255). Ignored if AutoCalc is true.
    Intelligence (Int) Attribute value, unsigned char (0-255). Ignored if AutoCalc is true.
    Personality (Per) Attribute value, unsigned char (0-255). Ignored if AutoCalc is true.
    Luck (Luc) Attribute value, unsigned char (0-255). Ignored if AutoCalc is true.
    Item Inventory item ID. If you wish to add multiple items you need to have additional columns (ex: to add ten different items use ten Item columns).
    ItemEx Iventory item ID with the extended format:

    ItemID=Count

    such as “gold_001=1000” (any spaces are ignored).

    Spell Spell ID string. Similar to the Item field, use multiple Spell columns to add several spells.
    Skill Skill value (unsigned char) with the format:

    Skill=Value

    such as “Block=54”. Ignored if AutoCalc is true.

    Attribute Attribute value (unsigned char) with the format:

    Attribute=Value

    such as “Str=54”. Ignored if AutoCalc is true.

    Gold Amount of gold carried by the NPC (unsigned long)
    Health Maximum health value (long, ignore if AutoCalc is true).
    Fatigue Maximum fatigue value (long, ignore if AutoCalc is true).
    SpellPts (Magic) Maximum spell points value (long, ignore if AutoCalc is true).
    Probe Trap disarming probes
    Value Unsigned long
    Weight  
    Uses Number of uses
    Quality Floating point quality (default of 1.0)
    Race Custom race definition
    Description Race description string
    Playable True/False, Yes/No
    Repair Armorer repair item
    Value Unsigned long
    Weight  
    Uses Number of uses
    Quality Floating point quality (default of 1.0)
    SoundGen Creature sound generation record
    Type Type of sound, one of:
    • Left Foot
    • Right Foot
    • Swim Left
    • Swim Right
    • Moan
    • Roar
    • Scream
    • Land
    Sound Sound ID string
    Creature Related created ID string
    Sound Sound record
    MinRange Minimum range of sound in game units (0 to 255)
    MaxRange Maximum range of sound in game units (0 to 255)
    Volume Volume of sound (0.0 to 1.0)
    Spell Spell definition
    AutoCalc True/False, Yes/No
    PCStart Does the player start with this spell. True/False, Yes/No
    Type Type of spell, one of:
    • Spell
    • Ability
    • Blight
    • Disease
    • Curse
    • Power
    Cost Base cost of spell in spell points (unsigned long)
    Static Static object
    Weapon All weapon types
    Value Unsigned long
    Weight  
    Type Weapon type, one of:
    • Short Blades
    • Long Blade
    • Long Blade, 2-Hand
    • Blunt
    • Blunt, 2-Close
    • Blunt, 2-Wide
    • Spear
    • Axe
    • Axe, 2-Hand
    • Bow
    • Crossbow
    • Thrown
    • Arrow
    • Bolt
    ChopMin Damage, unsigned char (0-255)
    ChopMax Damage, unsigned char (0-255)
    SlashMin Damage, unsigned char (0-255)
    SlashMax Damage, unsigned char (0-255)
    ThrustMin Damage, unsigned char (0-255)
    ThrustMax Damage, unsigned char (0-255)
    IgnoreResist Ignore creature resistance, True/False, Yes/No
    Speed Higher is faster, floating point (default = 1.0)
    Reach Longer is farther, Floating point (default = 1.0)

    More supported records and fields will be added in the future. The easiest way to ensure a correct CSV file format is to export some sample records and load that file into your spreadsheet application. You can import multiple record types but exported files contain only the selected records of the currently displayed type in the main view.

    When importing records, any existing record with the same ID will be overwritten, assuming it is the same item type. This allows you to reimport the same CSV file several times as you fine tune your item list.


    14. Script Templates

    MWEdit v0.5.5 introduced the idea of Script Templates to help modders to quickly create any number of similar scripts from a source script and a CSV (Comma Seperated Value) files. The Script Template command can be found in the Edit menu.

    The script template file is a regular text file that contains the entire source script for the templates (from the begin to the end statements). The source script will also contain special template variables that will be replaced by values in the CSV file. Take the following simple source script as an example:

    begin [ScriptName]
    	short DoOnce
    
    	if ( DoOnce == 0 )
    		player->AddItem, [ItemID1], [ItemCount1]
    		set DoOnce to 1
    	endif
    end
    The template variables are surrounded in square brackets ([]) and in the above example include [ScriptName], [ItemID1], and [ItemCount1]. The [ScriptName] is the only special and required template variable and specifies the script name for the new script (otherwise all scripts would be created with the same name and overwrite each other). The other template variables can include any combination of letters/numbers (not case sensitive). When you loading a source script the template variables found in the script will be listed in the template variable list. The source script text can also be modified in the Template Text tab.

    The CSV file in a regular Comma Seperated Value file that can be output by most spreadsheet applications. It contains the values of template variables to insert into the scripts to be created. A sample CSV file matching the above source example is given below:

    	ScriptName, ItemID1, ItemCount1
    	dh_itemscr_01, gold_001, 1050
    	dh_itemscr_02, dh_item_test_01, 1
    	dh_itemscr_03, dh_levelist_01, 4
    The first row in the CSV file contains the template variables matching those in the source script (without the surrounding [] brackets). The columns can appear in any order and the template variable name is not case sensitive. When you load a CSV file you can check its contents in the CSV File tab to ensure it has been loaded successfully.

    There are several options available affecting the creation of script templates.

    Keep Quotes (CSV)
    When this option is checked, any quotes in the CSV file will not be removed from the CSV strings. This might be important if some of your IDs contain spaces. Depending on how your CSV file is created or exported, keeping quotes may result in an incorrect format for some values (like numbers). This option only takes affect for CSV files loaded after the setting change.

    Only Complete Rows (CSV)
    With the option checked only complete rows in the CSV file will be considered valid for script creation. Incomplete rows (rows will missing values) will be ignored.

    Auto Script Name
    With this option checked you can specify a script prefix to use when creating new scripts. The Script names will start with your prefix followed by an 4 byte number index (scriptname_0001, scriptname_0002, etc...). If this option is unchecked the script name will be taken from the ScriptName column in the CSV file.
    The Check button will check the current source script and CSV file and settings to ensure everything works reasonably well. You will be notified of any errors or warnings. A check is also automatically performed when you press the Create button which will actually create the new scripts from the current settings. Note that any existing script name will be overwritten.


    Last Modified: 15 November 2003 by Dave Humphrey