What's zero-based index?


Zero-based index is a zero-based integer to represent the element's position in order of appearance of the same type of elements. Take a look at the following example.

In the above example, the zero-based index of WEAPON element "Sword", "Mace" and "Lance" is 0, 1 and 2 respectively.

Tips

Sometimes it's hard to get the zero-based index of a specific element from a long list of similar elements. In this case you can use attribute to help you index all the elements.

An element can optionally contain one or more attributes. An attribute is a name-value pair separated by an equal sign (=).

<CITY ZIP="01085">Westfield</CITY>

In this example, ZIP="01085" is an attribute of the <CITY> element. You are free to create any attributes of any names and values to help you identify and give additional info to an element in RPGDML. The following example use an attribute to give additional info to a WEAPON element.

  • <WEAPON info="This weapon is for Cloud">
    • <NAME>Ultima Sword</NAME>
    • ......
  • </WEAPON>

Please note that the use of attributes in RPGDML is for your own reference only. They work like comments in HTML and programming languages and do not affect the element itself in any way. You can use attributes to help you index the elements. Check out the following example.

  • <WEAPONS>
    • <WEAPON index="0">
      • <NAME>Sword</NAME>
      • ......
    • </WEAPON>
    • <WEAPON index="1">
      • <NAME>Mace</NAME>
      • ......
    • </WEAPON>
    • <WEAPON index="2">
      • <NAME>Lance</NAME>
      • ......
    • </WEAPON>
    • ......
    • <WEAPON index="99">
      • <NAME>Ultima Weapon</NAME>
      • ......
    • </WEAPON>
  • </WEAPONS>