Skip to content

Definitions

Greg edited this page Feb 20, 2024 · 1 revision

Definitions are collections of data stored in the game Cache, they often store data about a specific Entity, Interface or other game engine system.

Tip

You can find the full list of definitions in ./engine/data/definition/

Definitions can be accessed in scripts with injection:

val itemDefinitions: ItemDefinitions by inject()

Or in functions with:

val itemDefinitions: ItemDefinitions = get()

Definition Extras

Void goes beyond standard definitions and links YAML configuration files to each definition making it easy to define String Identifiers and additional data.

Anything added to an npc beyond the integer id is added to the respective definitions.extras map where they can later be accessed in a similar way to Variables.

hans:
  id: 0
  wander_radius: 4
  race: human
  examine: "Servant of the Duke of Lumbridge."
val race = npc.def["race", ""] // Get or default return empty string

val examine: String = npc.def["examine"] // Get unsafe with type

val radius: Int? = npc.def.getOrNull("wander_radius") // Get if exists else return null value

Note

This applies to all definitions, objects.yml -> ObjectDefinition, interfaces.yml -. InterfaceDefinition, fonts.yml -> FontDefinition, etc...

Clone this wiki locally