Types

Overview

“Types” let you share sets of attributes between objects. Instead of copying the attributes to the object, the object just references the underlying the type if it doesn’t have its own override for a attribute.

You can view all the attributes of an object using the Debugger, which is accessed via the Tools menu. Attributes from an inherited type are shown in grey.

Types are defined using a [ element](elements/type.html), and attributes are defined in the same way as for an object. Objects and types can both inherit from other types using an tag.

  <type name="food">
    <health type="int">0</health>
    <eat>It looks tasty, but you're not hungry right now.</eat>
  </type>

  <type name="fruit">
    <inherit name="food"/>
    <health>10</health>
  </type>

Default behaviour

If the ASLX defines a type called “defaultobject”, then it is applied to all objects – there is no need to specifically inherit from this type. Core.aslx uses this to define the default behaviour for objects:

See also Using inherited types in the tutorial.