(changed category to GUIXML)
|Line 54:||Line 54:|
* [[Common problems]]
* [[Common problems]]
Revision as of 15:27, 4 November 2011
XML is an HTML-like language which is used to define the primary graphical user interface (also known as "GUI Controls" -- pronounced "gooey") of the game. When a window pops up, the XML language was used to define that window, and the buttons, icons, and checkboxes upon it. Each of those buttons or other objects is a separate node, of the archetype
GUIControl. Just like other nodes, they have classes and fields, with data in those fields. Scripts can also be attached to these nodes that trigger on GUI Events (such as a
MouseClick). So when a user clicks on a button, that button can then call a script which will affect other things in the game, change the window's appearance, or even create other windows.
Creating a GUIXML File
Just as scripts have a
.hsl extension and are placed in a repository's HeroScript folder, GUIXML files have a
.xml extension, and are placed in a repository's GUIXML folder. Ways of adding new GUIXML are as follows:
- Creating an GUIXML file from scratch, using the script editor
- Using the GUIEditor to graphically create a new Control, which automatically generates a new GUIXML file.
It is also possible to use HSL to create a node based on an existing GUIXML prototype, and then modify its various properties in the script. For example, creating a button from a button prototype, and then changing the color that it turns when the mouse hovers over it, from its default color, to red.
The Structure of a GUIXML File
GUIXML files are comprised of a primary building block: The building of control elements. An element might be a button, checkbox, text input box, radio button, panel with several buttons, or even an entire window which has several of the other elements upon it.
Many of the core elements have already been defined in
GUIXML.xml files, and new files can be created as needed. All of the Clean Engine .xml files are listed in
_HEGUIXML.lst (which can be viewed via the Script Editor in the GUIXML category). Game-specific GUIXML files should be listed in the
There are several predefined classes which can be used. For more information on the classes and fields, please see the GUI Controls page.
Examining a GUIXML File
To look at the GUIXML of a current prototype, use the script editor. For example:
- In HeroBlade, type Ctrl-H to open the editor.
- Use File/Open, but instead of a client or server script, choose GUI XML. This will give you a list of existing prototypes.
- Open one of the files. For example,
Be careful not to make any changes!
The core elements of the GUIXML file start with a
< tag, and end with a
/> tag. For example:
<size x='100' y='29'/>
Sometimes there will be subfields that need to be set, in which case the first line opens the structure, and the last line closes it. For example:
<label name='text' dockMode='FILL' text="Button A"> <textFormat center='true' vcenter='true' wordBreak='false' singleLine='true'/> </label>
In most cases though, you will not need to modify the GUIXML directly unless there is a problem. Simply use the GUIEditor, and let it handle the GUIXML changes.
Quotes can be either single-quote (') or double-quote ("), as long as both opening and closing quotes match.