Skip to main content

GameVars

GameVars (com.n3plugins.sdk.client) reads client varbits and varplayer values with no InteractionApi dependencies.

Methods:

  • GameVars.getVarbit(int varbitId) - reads a varbit; returns 0 if the client is null
  • GameVars.getVarPlayer(int varPlayerId) - reads a varplayer; returns 0 if the client is null
  • GameVars.getVarPlayerBit(int varPlayerId, int bitIndex) - reads a single packed bit from a varplayer value; returns false if the client is null

Example:

// Quest stage stored in a varbit
int stage = GameVars.getVarbit(7334);

// Packed config flag in a varplayer
boolean autoRetaliate = GameVars.getVarPlayerBit(1, 0);

GameVars does not depend on GameStateGuard or any InteractionApi class - it sits entirely within sdk.client and only needs a non-null N3Client.getClient(). Use it when you need raw game state not exposed by a named action class.

For named varbits, prefer net.runelite.api.Varbits constants as the int argument. For named varplayers, use net.runelite.api.VarPlayer.