ModXML Editor ALPHA Reference and Help Thread

primem0ver

Emperor
Joined
Jun 16, 2006
Messages
1,158
Location
Peoria, AZ
I will update this when I get the time. I have a few instructions for installing below.

See the "Thread Post" below for a brief explanation of what to do if you have issues (and what is contained in the log files). AFTER READING, please use the OTHER thread for posting BUGS, ERRORS and comments. THIS THREAD IS FOR QUESTIONS ON HOW TO USE THE EDITOR ONLY. This is a documentation thread.
 
See this thread to download!

Once downloaded, unzip and start the installer. It is a typical program installer that will walk you through setup. It should be on your start menu after that.
 
Your Start Menu

Here is what you should see on your start menu.


Notice the log files. I will post give a detailed post on how to read/skim through the log files to locate an issue a little later. The log file I have highlighted here is the one you should look at first when a file fails to load.


The Splash Screen



This splash screen does not work or look like as it should at this time. There should be a drop down arrow to on the right side, of the status strip (that will open up a scrolling details view) and the single line status message that should be their currently is not being drawn. This is not high on my priority list of things to fix but hopefully I will get some time a little later.


The Full Editor Screen



Here is your full editor up and loaded. Currently the mod always loads the default file: CIV4UnitInfos.xml. I am going to change this soon so that it loads the file you were last working on. In the case that it cannot open, it will open this particular file.


A Quick Walk-through of Menus and Controls
Currently, the Task, Mods, Infos, and Options menus are the only menus that will actually drop something down.

The Task Menu and the Options Menu



The task menu is where you pick the version of Civilization IV that you want to mod, save your current work, edit your mod settings, and exit the program. The options menu is for setting editor options and is currently non-functional because I have not added handlers (subroutines) for changing settings. This is coming soon.


The Mod and Info Menus



The Mods menu is where you can load any existing mod for the version you are editing. The Info menu is what you use to load the different XML files that exist. All active XML Files are normally accessible here and categorized by folder.

NOTE: These are not in alphabetical order. They are in order of appearance. I may add a sorting (alphabetizing) feature later.

Important:Folders are currently case sensitive. If you have used non-original "casing" in your mod for the folder names, the files within that folder will NOT be listed and you will be unable to load them. You can temporarily fix this problem by renaming the folders using original casing. I am hoping to fix this bug soon.


The Tool Bar


The toolbar can be used to search your file for tags and text. It also shows you what is currently on the clipboard. (Right now there is nothing on my clipboard). Details on how to use the clipboard will be given in one of the posts below.


The Status Bar


The only functioning item on the status bar is the "Loaded File:" item. This shows you the currently loaded file and is color coded by the Edition that last made an update to this file. (See Color Key section below).

The "Line" item will probably removed. This was supposed to let you know what line in the file you are on but unfortunately the node index property available in .NET is relative. It does not actually give you the position in the file. Only the position in the current node. Keeping track of the actual line is possible... but complicated since cutting and pasting entire containers of nodes will make this unpredictable and time consuming to calculate

Finally, although it is not shown in the picture, (it appears if you make the window wider/use a higher resolution desktop than I currently use): there is an CHANGED/UNCHANGED word that will let you know the saved/changed status of the file. This currently is non-functional (since it doesn't always appear and it is low on my priority list).


The Quick-jump Panel



This panel will almost always show an alphabetized list of "info" items found in an info file. There are a few files where this turns up blank but I hope to improve that over time. Single clicking an item will open the corresponding node in the editing panel.


The Color Key

This is the color key to the tags and status bar colors that appear. In addition to the ones listed, comments are currently green, and the XML declaration at the top of the file is colored magenta. I will give sample screenshots of this in one of the posts below since I have reached the maximum.

The File/Info Properties or "Editing" Window
(Not Pictured Here... see below, or the full picture above).

Here is where you actually edit your XML.
 

Attachments

  • start-menu.png
    start-menu.png
    23.2 KB · Views: 514
  • faulty-splash.png
    faulty-splash.png
    181.6 KB · Views: 531
  • options-menu.png
    options-menu.png
    4.1 KB · Views: 507
  • task-menu.png
    task-menu.png
    7.9 KB · Views: 598
  • Info-menu.png
    Info-menu.png
    14.2 KB · Views: 491
  • mod-menu.png
    mod-menu.png
    9 KB · Views: 490
  • toolbar.png
    toolbar.png
    3.3 KB · Views: 489
  • status-bar.png
    status-bar.png
    4.5 KB · Views: 563
  • quickjump.png
    quickjump.png
    14.7 KB · Views: 495
  • color-key.png
    color-key.png
    1.6 KB · Views: 497
Current list of all working features is forthcoming.

Editing Features

The picture below shows you the two main features that allow access to editing functions:


The most obvious is the context menu. This changes some depending on the node you currently have selected. If the clipboard is empty or if the selected node is an illegal place to put what is on the clipboard, the paste/replace options will disappear.

If you will notice, there is also a little icon strip to the right of the selected node. The first icon (to the left) is always the edit icon. This will open an edit control for the currently selected node when clicked. The second icon (when it appears) will always be the "Copy" button (and will copy the item to the clipboard if it is "copyable"). The third icon is the paste icon. If the third icon does not appear, that means the currently selected node does not match the node type on the clipboard and so pasting would be inappropriate. Please Note: This icon is a "paste over" icon and will replace the node you have selected when clicked. I will eventually add two more icons: an up arrow and a down arrow for insert above and insert below respectively.

A similar (but smaller) context menu is available for value nodes/tags:


The 4th menu item above (below the separator) is a checkable item that allows you to remove the restriction (by unchecking) of pasting values over matching tag names. You will still have to be on a tag of the same type (such as boolean, integer, etc...)


Below are some pictures relating to the tool bar. They show how the Clipboard tool helps you know when you can paste or not:



In the first image above the selected node is not show. But notice the green color of the clipboard item. This lets you know that the selected node is of the same exact type as the node on the clipboard and pasting is allowed. In the second picture, the highlighted node is not of the same type as the item on the clipboard and so pasting/inserting has been disabled. As a result it is missing from the context menu shown.
 

Attachments

  • value-context menu.png
    value-context menu.png
    5.9 KB · Views: 486
A full manual/document will take some time to create but here are some quick how tos:


Introduction to the "Selection" or "Edit" Strip


This is a little gadget to give you a picture interface to editing. Each icon is a button. Here is an explanation of each button:

1. The first is the "edit" button. It currently doesn't really do anything for container nodes (since containers don't have actual values, they only have nodes inside them). In a future release, clicking this on a container will simply expand the container if it isn't already expanded.

2. Second is the "copy" button. This will copy the current node onto the clipboard and works on both container and value nodes.

3. The third is the "paste" button. This might be better described as "Replace" since it will replace the value (for value nodes) or the entire container (for container nodes). This button will only appear on container nodes if the node is an exact type match as what is on the clipboard. (i.e. the XML tags have the same name). For value nodes, this is also the default behavior but you can allow copying over any value nodes of the same type (such as integer, boolean etc...) by unchecking the tag match option in the value context menu (right click a value... see below on how to do this).

4. The fourth button is the "insert above" button. This only appears on expandable (container) nodes. It may also appear on value nodes that are repeatable (rare) but the functionality for this is not programmed yet.

5. Finally, the fifth button is the "insert below" button. This is essentially the same as the "insert above" button.


How to edit a basic value:
To open an edit control for the currently selected node, simply click the first icon on the strip to the right of the selected node or double click the/a node.

An edit control appropriate for the type of data being edited will open.
  • For integer values you can only enter numbers and the negative sign.
  • For float values (i.e. decimal values), you can use the same keys as with the integer value plus the period (decimal). If you have already put a decimal in the number, it will not allow you to add a second decimal. You will have to remove the first decimal before putting it somewhere else
  • For boolean (true/false) values, you will be given a drop-down only combo box that allows you to select true or false. The actual XML will read 1 and 0 respectively.
  • For text values you will be given a text box where any characters are accepted. Hitting enter/return however will end your edit and replace the value. . This will behave differently for large text boxes when I add them later on.
  • For recognized info-values (These are what I call "type-cast" values and show up as bold text in the editor), a drop-down only combo box will give you a list of all info types that are acceptable for the node you have selected. Currently you must unload and reload the mod if you add infos of the correct type before they will show up in this list. I hope to fix that in the future. If you are editing a node that is recognized as a TEXT info type, it will actually allow you to put in your own value. For this, the text entering feature of the combo box will be enabled since simply entering text here will still work.


How to search for text
You can use the toolbar at the top to search for text. I don't think the top nodes (the xml-declaration nodes, the opening comments, and the single root document node) are being searched right now. I hope to fix this bug in a later release. All other nodes below the top layer however will be searched, whether they are opened for viewing or not.

To search, simply enter the text you are looking for. NOTE: Using tag markup will not give you any results since the search feature looks at the text value of the node and markup is not part of the display. So if you are looking for a specific tag look for "bRivalTerritory" instead of "<bRivalTerritory>". You may perform both case sensitive and case insensitive searches. Although I recently discovered programming backward searches are possible, they are currently not supported.

The search results will HIGHLIGHT THE ENTIRE NODE CONTAINING THE TEXT and not just the text you are searching for. (Doing this will not be possible unless I create my own complicated node control that is going to take more time than it is worth right now).

How to copy, edit, paste, insert, values and nodes
There are two ways to do each of these. You may either right click the desired node and pick the desired operation or you may use the edit strip. The two white sheets is the copy button The clipboard is paste (over). The up arrow is insert up; and the down arrow is insert below. For "container" you can only paste or insert from the clipboard when the selected node is an exact type match of the node you have selected. For value nodes, the default behavior is the same. However, you can copy and paste values over any node of the same value type if you uncheck the tag match option.

For example. If you want to set all integer tags to 5, you would do the following:

1. Change one of them to 5 as shown (double click or click the edit icon on the strip)


2. Right click and uncheck "Restrict Pasting to matching tags"


3. Notice than when you do this, the clipboard viewer switches from "Item on clipboard:" to "Value on Clipboard:"



4. Copy over the desired values by clicking the clipboard (3rd) icon or by right clicking and clicking on copy over. Here is the end result:



NOTE: There is currently a bug that may allow you to retain the clipboard items between files. Although selecting a different type of info will NOT allow you to paste, selecting a node in a different version of the same file might allow this. It will probably crash the program if tried. (Not than anyone would want to do that...)

More to come.
 

Attachments

  • item-unmatched-clipboard.png
    item-unmatched-clipboard.png
    1.6 KB · Views: 468
  • change.png
    change.png
    1.2 KB · Views: 470
  • value-matched-clipboard.png
    value-matched-clipboard.png
    1 KB · Views: 466
  • tag-match.png
    tag-match.png
    5.4 KB · Views: 467
  • copy-value.png
    copy-value.png
    4.9 KB · Views: 464
  • selection-strip.png
    selection-strip.png
    1.5 KB · Views: 451
More to come.

An explanation of the log files and the loading process:

There are basically two things (well... actually three things) that happen when the editor loads. First it analyzes the schemas in each of the folders and creates data types for every single tag found in the schemas. This is reported in Debug.log (still using the original name... after I decided to separate it from the next logged part). The second thing it does doesn't get reported. It analyzes all the types and files it has found in each edition's folders, figures out which folder to load "missing" files from (for the current edition), and maps tags to info types when and wherever possible. This entire section goes unreported. The third step is to load the current edition's info file(s). (Right now it always loads the default...UnitInfos.xml. Soon it will load whichever file you were working on last). Any logging that occurs during this third step is saved to the InfoRead.log file.

All three of these steps are repeated separately when you load a mod. So if a mod fails to load, the reason could be logged in either file. However, the first file you should check is InfoRead.log.

Inside this file you will find two basic reports... A series of two line reports (logged when it is skimming through all the files looking for Infos to use when filling up a Type Casted combo box for bolded items) followed by the report of the detailed read of the main file it is trying to load. This section will have a series of "Reading Info with label: ...." lines. Unless you unload the mod, or reload another mod, the two lined reads will be only seen once in a rare while. Each time another file is loaded for editing, its log will immediately follow the last read section (unless of course you unload your mod or switch editions again).


What to do if you have an issue loading a mod:

First, write down the "exception" type you are getting, including the details (though not necessarily the stack dump). This will let me know what part of the loading process is causing the problem.

Next, look at the log files starting with the InfoRead.log file. If you can make an educated guess by looking at the log files, particularly the inforead.log file, then post your guess in the other thread. This thread is mainly for questions on how to use the editor or problems when using editing features. I will of course answer problems in both forums... but this is mainly a documentation thread.

If you can't make an educated guess, then tell me which mod is giving you trouble in an email; attach both log files, and send the file to me at imtsoftware@live.com
 
Having trouble getting this to load for the Fall from Heaven mod. Here is the final part of the debug log, though I can't really tell what the problem is.

Code:
Creating new variable class: SpellInfo -- of type CONTAINER
   Created SpellInfo variable instance entitled SpellInfo
Creating new variable class: SpellInfos -- of type CONTAINER
   Created SpellInfos variable instance entitled SpellInfos
Creating new variable class: Civ4SpellInfos -- of type CONTAINER
 
I am going to have to post a brief explanation of the log files before I rest for a good part of the day. You need to take a look at the InfoRead.log file. I will post the explanation in a few minutes.

EDIT: I just took a second look at what you posted from the file. FfH mod is a SERIOUS modification with its own Info files (probably even more in depth than the Genetic Era Mod was). If they didn't follow the standard XML schema format used by Civ4 files then that could be an issue. I had issues loading the new info types as well with the Genetic Era too the first time I tried to load them. This was partly due to errors in the XML as well as my having to work out some bugs in order to get them to work. I will probably have to download that mod myself. In the meantime, follow the instructions above.

2ND EDIT: Are you talking the BtS version or FfH2? THere is an issue with folder names. Folder names are currently case sensitive and if the traditional spelling (case wise) isn't followed, there are issues. I will have to make folder case-insensitive in the next update. Once I renamed the folders for the BtS version, I didn't have any problems.
 
I am having a problem opening my mod. I thought it was my mod, but also I can not open the standard Road to War that comes with Beyond the Sword.
 
I am checking into it. I will get back with you and post a fix with the update if I can in the amount of time I have.
 
One question: is your mod giving you the same error as loading the shipped mod?
 
I have fixed the error with loading the Road to War Mod... was a simple issue of not being able to import foreign characters in the default xml reader (shipped with .NET). Not sure why though since the error occurred at a spot without foreign characters. But I won't worry about it since using the system default rather than the .NET default fixed the problem.

Please let me know that you are getting the same error with your mod though because I want to make sure this addressed your issue as well before I post the update.

ALSO... from now on post editor bugs here. This thread is strictly for issues USING the program (not bugs). (In other words if you need to know how to use a particular feature or editing something isn't working right... post it here.)
 
Top Bottom