WorldScript Class

From Heroes of Hammerwatch wiki
Revision as of 13:20, 19 June 2019 by Miss (talk | contribs) (Created page with "Worldscript classes are defined using the <code>[WorldScript]</code> metadata: [WorldScript color="176 196 222" icon="system/icons.png;416;128;32;32"] class ScriptLink Pos...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Worldscript classes are defined using the [WorldScript] metadata:

[WorldScript color="176 196 222" icon="system/icons.png;416;128;32;32"]
class ScriptLink

Possible options for the metadata are:

  • color specifies the color that the editor will show this script as when placed in a level. This can be a hexadecimal color (if it starts with #) or an RGB pair.
  • icon contains the texture and coordinates of where the worldscript icon is that should be shown in editor, in the format filename;x;y;width;height.
  • alias is an optional string that can be used as an alternative name for the script. This is useful when a class name has changed, so that it can still be loaded by level files that reference the script by its old name. You can specify multiple names here, separated by commas.

Methods called from engine

The engine calls the following functions, if they exist:

  • void Initialize()
  • void Cleanup()
  • void Update(int dt)
  • void PostUpdate(int dt)
  • SValue@ ServerExecute()
  • void ClientExecute(SValue@)
  • void OnEnabledChanged(bool enabled)
  • void DebugDraw(vec2, SpriteBatch&)
  • SValue@ Save()
  • void Load(SValue@ save)