XmlTools: Difference between revisions

From OniGalore
Jump to navigation Jump to search
m (links)
(attempt at documenting usage, probably full of mistakes)
Line 2: Line 2:


==Overview==
==Overview==
XmlTools is a console modding tool that operates over xml files. It was developed in C# .net and works in both Windows and Mac OS. You can download it [http://mods.oni2.net/node/224 here].
XmlTools is a command-line modding tool that operates on XML files exported by [[OniSplit#XML|OniSplit]]. It was developed in C# and works in both Mac OS X (Mono required) and Windows (.NET required).


The initial version was written to help with the development of the Old China Mod.
The initial version was written to help with the development of the Old China level mod. It was then developed further for the purposes of the [[AE]].


It can be used exclusively alone or used as base for another tools ''e.g.'' [[AEI]] and [[Vago_(tool)|Vago]].
It can be used as a standalone tool or as a base for another tools.


===Features===
==Links==
*Download the tool package [http://mods.oni2.net/node/224 here] (actual program folder found inside the plain/xxx_only/Tools/ folder).
*XmlTools is used by the [[AEI]] to apply [[Making a patch mod|XML patches]], as explained [[Anniversary Edition/Framework#XML patching|HERE]].
*XmlTools is used along with OniSplit as the backend for the GUI tool [[Vago_(tool)|Vago]].


'''-Update a xml chain values''' (for example update all the positions of an OBAN animation).
==Features==
*'''Modify a chain of values''' (for example, to reposition an OBAN animation or adjust pelvis height for a TRAM).
*'''Invert a chain of values''' (for example, invert an OBAN animation).
*'''Add new values to XML elements''' (for example, add the 'unkillable' flag to some characters in a level).
*'''Remove values from XML elements''' (for example, remove boss shields from characters in a level).
*'''Replace values in XML elements''' (for example, increase the health of characters by replacing the old HP value).
*'''Add custom XML to existing files (patch only)'''
*'''Remove XML from existing files (patch only)'''
*'''Patch file support''' allows the modder to list multiple commands in a file, on separate lines, to all be performed at once.


'''-Invert a xml chain''' (for example invert an OBAN animation).
==Using it==
The following actions are listed when calling XmlTools with no options passed in. You can get the version with the argument "version".
:The commands below must be preceded by either <tt>xmlTools.exe</tt> (Windows) or <tt>mono xmlTools.exe</tt> (Mac)
::If xmlTools.exe is not in the current folder, you can provide the full/relative path to it or set the path variable.
:::On the Mac, be sure to use / rather than \ in paths. The following instructions are for Windows by default.


'''-Add new values to xml elements''' (for example add unkillable flag to some characters in a level).
===Universal arguments===
You must use these arguments with each command listed in the next section:
{|
|<tt>-filename:<XML file></tt>||Specifies file to modify (backup made by default)
|-
|<tt>-element:<XML tag></tt>||Specifies XML tag to look for in the file
|-
|<tt>-parelement:<XML tag></tt>||'''Optional'''; specifies XML tag that contains -element tag to avoid potential confusion, e.g. "Heights" is an array in a TRAM XML that contains "Height" tags
|-
|<tt>-nobackups</tt>||XmlTools will not create a backup file (speeds up operations)
|-
|<tt>-debug</tt>||???
|}


'''-Remove values to xml elements''' (for example remove boss shields to characters in a level).
===Command-line operations===
<tt>updatechainvalues -newvalue:<quoted string> [-valpositions:<quoted string>] [-valrelation:<quoted string>]</tt>
:Supply new value for an element;
:<tt>-valpositions</tt> (optional) is zero-indexed and can be a single value or a space-separated list, e.g. <tt>-valpositions=0 1 4</tt>;
:<tt>-valrelation</tt> (optional) means ???


'''-Replace values in xml elements''' (for example increase the health of characters replacing the original one).
<tt>invert</tt>
:Inverts (how???) values of an element


'''-Add custom xml to existing files (patch only)'''
<tt>addvalue -value:<quoted string></tt>
:Adds value or space-separated list of values into an element


'''-Remove xml to existing files (patch only)'''
<tt>removevalue -value:<quoted string></tt>
:Removes value or space-separated list of values from an element


'''-Patch file support''', allows to operate in xmlfiles using a patch file. The patch file may contain any of the above features.
<tt>replacevalue -oldvalue:<string> -newvalue:<string></tt>
:Replaces specified old value, if found, with new value


By default it also backups any modified file.
<tt>replaceall -value:<string> [-valpositions:<quoted string>]</tt>
:Replaces value in element with new value, no matter its previous value


<tt>patchfile [-forceinfiles:<file names>]</tt>
:Changes <tt>-filename</tt> argument to refer to a patch file and applies this patch to either all XML files in current folder,
:or to named files with <tt>-forceinfiles</tt> argument (allows wildcard '*'); see below for patch commands
===Patch file operations===
To create a list of commands within one file that you can pass to XmlTools to execute all at once, create a plain-text file that uses the following commands and pass it to XmlTools using the <tt>patchfile</tt> command documented above. See [[Making a patch mod|HERE]] for instructions on making a patch mod for the AE.
<tt>@ADDTO Element <quoted tag name> [ParentElement <quoted tag name>]</tt>
:Adds the raw XML that follows to the named array tag, e.g.:
@ADDTO Element "Particles"
<xml>
    <Particle>
      <Start>0</Start>
      <End>45</End>
      <Bone>Head</Bone>
      <Name>glass_break</Name>
    </Particle>
</xml>
<tt>@REMOVE Element <quoted tag name> ParentElement <quoted tag name></tt>
:Removes named element from the array tag named by ParentElement
<tt>@COMMAND <quoted string></tt>
:Runs any of the commands available under "Command-line operations" above. Use standard CLI syntax described in that section, including <tt>-filename</tt>, e.g.:
@COMMAND "invert -element:Height -parelement:Heights -filename:test.xml"


[[Category:Bi-platform modding tools]][[Category:Completed modding tools]]
[[Category:Bi-platform modding tools]][[Category:Completed modding tools]]

Revision as of 15:14, 14 April 2013

Unfinished building-60px.jpg

This page is unfinished. Can you fill in any missing information?
If it is not clear which part of the page is unfinished, ask on the talk page.

Overview

XmlTools is a command-line modding tool that operates on XML files exported by OniSplit. It was developed in C# and works in both Mac OS X (Mono required) and Windows (.NET required).

The initial version was written to help with the development of the Old China level mod. It was then developed further for the purposes of the AE.

It can be used as a standalone tool or as a base for another tools.

Links

  • Download the tool package here (actual program folder found inside the plain/xxx_only/Tools/ folder).
  • XmlTools is used by the AEI to apply XML patches, as explained HERE.
  • XmlTools is used along with OniSplit as the backend for the GUI tool Vago.

Features

  • Modify a chain of values (for example, to reposition an OBAN animation or adjust pelvis height for a TRAM).
  • Invert a chain of values (for example, invert an OBAN animation).
  • Add new values to XML elements (for example, add the 'unkillable' flag to some characters in a level).
  • Remove values from XML elements (for example, remove boss shields from characters in a level).
  • Replace values in XML elements (for example, increase the health of characters by replacing the old HP value).
  • Add custom XML to existing files (patch only)
  • Remove XML from existing files (patch only)
  • Patch file support allows the modder to list multiple commands in a file, on separate lines, to all be performed at once.

Using it

The following actions are listed when calling XmlTools with no options passed in. You can get the version with the argument "version".

The commands below must be preceded by either xmlTools.exe (Windows) or mono xmlTools.exe (Mac)
If xmlTools.exe is not in the current folder, you can provide the full/relative path to it or set the path variable.
On the Mac, be sure to use / rather than \ in paths. The following instructions are for Windows by default.

Universal arguments

You must use these arguments with each command listed in the next section:

-filename:<XML file> Specifies file to modify (backup made by default)
-element:<XML tag> Specifies XML tag to look for in the file
-parelement:<XML tag> Optional; specifies XML tag that contains -element tag to avoid potential confusion, e.g. "Heights" is an array in a TRAM XML that contains "Height" tags
-nobackups XmlTools will not create a backup file (speeds up operations)
-debug ???

Command-line operations

updatechainvalues -newvalue:<quoted string> [-valpositions:<quoted string>] [-valrelation:<quoted string>]

Supply new value for an element;
-valpositions (optional) is zero-indexed and can be a single value or a space-separated list, e.g. -valpositions=0 1 4;
-valrelation (optional) means ???

invert

Inverts (how???) values of an element

addvalue -value:<quoted string>

Adds value or space-separated list of values into an element

removevalue -value:<quoted string>

Removes value or space-separated list of values from an element

replacevalue -oldvalue:<string> -newvalue:<string>

Replaces specified old value, if found, with new value

replaceall -value:<string> [-valpositions:<quoted string>]

Replaces value in element with new value, no matter its previous value

patchfile [-forceinfiles:<file names>]

Changes -filename argument to refer to a patch file and applies this patch to either all XML files in current folder,
or to named files with -forceinfiles argument (allows wildcard '*'); see below for patch commands

Patch file operations

To create a list of commands within one file that you can pass to XmlTools to execute all at once, create a plain-text file that uses the following commands and pass it to XmlTools using the patchfile command documented above. See HERE for instructions on making a patch mod for the AE.

@ADDTO Element <quoted tag name> [ParentElement <quoted tag name>]

Adds the raw XML that follows to the named array tag, e.g.:
@ADDTO Element "Particles"
<xml>
   <Particle>
      <Start>0</Start>
      <End>45</End>
      <Bone>Head</Bone>
      <Name>glass_break</Name>
   </Particle>
</xml>

@REMOVE Element <quoted tag name> ParentElement <quoted tag name>

Removes named element from the array tag named by ParentElement

@COMMAND <quoted string>

Runs any of the commands available under "Command-line operations" above. Use standard CLI syntax described in that section, including -filename, e.g.:
@COMMAND "invert -element:Height -parelement:Heights -filename:test.xml"