Difference between revisions of "SValue Loaders"

From Heroes of Hammerwatch wiki
Jump to: navigation, search
(Created page with "SValue loaders are script functions that deserialize sval files at the gamemode initialization step. They are defined in sval files like this: <loader>SomeFunction</loader>...")
 
Line 17: Line 17:
  
 
You can also specify an <code>order</code> attribute to specify the order in which they are loaded. This is required for sets for example, as they depend on items to exist.
 
You can also specify an <code>order</code> attribute to specify the order in which they are loaded. This is required for sets for example, as they depend on items to exist.
 +
 +
Only one loader tag may exist per file.
  
 
== Built-in loaders ==
 
== Built-in loaders ==

Revision as of 13:58, 26 September 2018

SValue loaders are script functions that deserialize sval files at the gamemode initialization step.

They are defined in sval files like this:

<loader>SomeFunction</loader>
<dict>
  <string name="example">example</string>
</dict>

And loaded by scripts like this:

void SomeFunction(SValue@ sval)
{
  string example = GetParamString(UnitPtr(), sval, "example");
  print("SomeFunction example: \"" + example + "\"");
}

You can also specify an order attribute to specify the order in which they are loaded. This is required for sets for example, as they depend on items to exist.

Only one loader tag may exist per file.

Built-in loaders

The following loaders are built-in to Heroes of Hammerwatch:

  • AddItemFile Used for loading item definitions.
  • AddSetFile Used for loading item set definitions.
  • AddDrinkFile Used for loading tavern drink definitions.