Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Character Variables

Greg edited this page May 1, 2025 · 14 revisions

Both Players and NPCs have a Variables container for storing variables and information.

By default variables are only stored temporarily and will be lost/reset when the npc dies, player logs out, or the game restarts.

Variable names should use lower camel case. e.g. "in_combat" not "inCombat"

Getters

Characters have extension functions to simplify accessing Variables

The following safe version will return false if the value is unset.

val burrow = giantMole["burrow", false]

Tip

Providing a default is the recommended way of accessing values.

val burrow: Boolean = giantMole["burrow"]

Warning

This is the unsafe version and will throw an exception is the value hasn't previously been set and doesn't have a default listed in the variables config file.

Setters

Setting a value is straight-forward, it's important to use descriptive names to make sure values don't conflict with other content.

giantMole["burrow"] = true

Player variables

Variables which a player has often need to be sent to the client to change something or display the value. Client variables are split into one of 4 categories:

  • varp - Player Variable
  • varbit - Variable Bit (part of a varp)
  • varc - Client Variable
  • varcstr - Client String Variable

Any variables which need storing but don't have a known id should be stored in *.vars.toml

For more details read Runelites page on the subject

These variables will need specifying in the relevant .vars.toml config file in ./data/. Along with their id and type.

[cooks_assistant]     # The string name of the variable
id = 29               # The variable id to send to the cleint
persist = true        # Save the value on logout
format = "map"        # The format the value is stored in (might differ from the format sent to the client)
default = "unstarted" # The default value if left unset
values = { unstarted = 0, started = 1, completed = 2 } # Map for converting values before sending to client

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.