Class PrivContext
Sleep/timing utilities are on the Time class (static, Unethicalite-style).
Thread-safe game access is handled by GameThread — hooks use it internally
so scripts never need to think about threading.
Each field is a facade ("hook") over one area of the game. Reads marshal through
GameThread.ensure(Supplier) and may return null, -1 or an empty
result when the client cannot answer: unreadable is not a negative answer. Action verbs
return true when the dispatch was accepted, which is not proof the action happened;
confirm the state change with a later read. Blocking helpers (waits, travel) belong on the
script worker, never on the client thread.
One instance per plugin injector (Singleton); the constructor also calls
GameThread.init(net.runelite.api.Client, net.runelite.client.callback.ClientThread).
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ActionsFactories for worker-polled action-confirmation trackers; each plugin owns its own.final BankBank interface: open, withdraw, deposit and bank contents (ctx.bank).final CapabilitiesWhat the unified API supports on this server (privbot/api/capabilities.json).final CapturePassive recording to~/.privbot/captures; writes nothing untilstart.final ChatChatbox reads and sending chat lines or commands.final CombatAttacking, special attack and combat-state reads.final DialogueChat dialogues: continue, options and dialogue text.final EffectsCreates plugin-owned effect trackers; event forwarding stays with the plugin lifecycle.final EquipmentWorn items: snapshots, queries and counts.final EventsPolling-backed typed events (projectile, hitsplat, animation, local death, graphic, var, chat).final FriendsFriends list reads.final GameGame-wide state: login, tick count, instance, side tabs, run toggle, server name.final GraphicsObjectsScene graphics objects (spot animations drawn in the world).final GroundItemsGround item queries and pickup (ctx.groundItems.query()).final HazardsDodging: a hazard map plus the nearest reachable tile out of it.final HotkeysQueued user key presses; start and stop with the plugin.final IdsOSRS id to this server's id (and back) for animations, graphics and varbits; empty when unknown.final InventoryCarried items: snapshots, counts and item actions (ctx.inventory).final LoadoutsEquip an in-game loadout preset (Impact; unsupported elsewhere).final LootCollects wanted ground items as a multi-tickJob, each pick proved by the inventory count.final MagicSpell casting.final BlackboardRun-scoped key-value scratchpad; not game state (seevarsfor that).final NPCsNPC queries and NPC interactions (ctx.npcs.query()).final GameObjectsScene object queries and interactions (ctx.objects.query()).final PlacesNamed-location registry (banks, NPC anchors, areas) shared withtravel.final LocalPlayerThe local player as tri-state reads (name, tiles, animation, HP, interacting target).final PlayersHookOther players in the scene.final PrayerPrayer state reads and prayer toggles.final ProductionProduction (make-X) interfaces for skilling.final PvpA detached per-tick snapshot of a PvP fight (opponents' overheads, skulls, HP bars, animations, graphics, worn ids, tiles and targets), plus spell-effect trackers in this server's ids.final RecoveryDeath recovery (Impact reclaim; unsupported elsewhere).final RestockGo home and re-gear (Impact restockAtHome; Elorin RestockRunner; unsupported elsewhere).final ShopNPC shops: open and sell.final SkillsSkill levels and experience.final SustainKeeps hitpoints, prayer and stat boosts up (eat, brew, restore, dose), each consume proved by the count.final TargetsPicking a target: a sticky lock over a snapshot's NPCs, and a safe way back to the live NPC.final TeleporterTeleport spells, tabs and item teleports.final TeleportsTeleport to a named destination (Impact fairy trees; the movement catalog elsewhere).final ThreatsA detached per-tick snapshot of the fight (NPCs, projectiles, graphics, HP, chosen prayers) for the pure planners inprivbot.mechanics.final TradePlayer-to-player trade.final TravelGetting to a place: walking, transports and teleports.final UserLocal-player state: position, movement, animation, hitpoints, levels, overhead prayer.final VarsRaw varbit and varp reads.final WidgetsWidget queries and widget clicks (ctx.widgets.query()).final WorkflowsRuns saved Builder workflows from a plugin (ctx.workflow.run(...)). -
Method Summary
Modifier and TypeMethodDescriptionnet.runelite.api.ClientThe client this context was built with.<T> TonClientThread(Supplier<T> fn) Runsfnon the client thread and returns the result.<T> TBatch a read-only decision in one client callback, reusing snapshots until it returns.voidRunsron the client thread (fire-and-forget); inline when already there.server()The server this client runs on, derived from the injected adapter.
-
Field Details
-
inventory
Carried items: snapshots, counts and item actions (ctx.inventory). -
bank
Bank interface: open, withdraw, deposit and bank contents (ctx.bank). -
npcs
NPC queries and NPC interactions (ctx.npcs.query()). -
objects
Scene object queries and interactions (ctx.objects.query()). -
graphics
Scene graphics objects (spot animations drawn in the world). -
groundItems
Ground item queries and pickup (ctx.groundItems.query()). -
equipment
Worn items: snapshots, queries and counts. -
players
Other players in the scene. -
prayer
Prayer state reads and prayer toggles. -
combat
Attacking, special attack and combat-state reads. -
skills
Skill levels and experience. -
magic
Spell casting. -
teleporter
Teleport spells, tabs and item teleports. -
trade
Player-to-player trade. -
shop
NPC shops: open and sell. -
widgets
Widget queries and widget clicks (ctx.widgets.query()). -
dialogue
Chat dialogues: continue, options and dialogue text. -
user
Local-player state: position, movement, animation, hitpoints, levels, overhead prayer. -
game
Game-wide state: login, tick count, instance, side tabs, run toggle, server name. -
chat
Chatbox reads and sending chat lines or commands. -
friends
Friends list reads. -
vars
Raw varbit and varp reads. -
workflow
Runs saved Builder workflows from a plugin (ctx.workflow.run(...)). -
places
-
travel
Getting to a place: walking, transports and teleports. Blocking variants must run off the client thread. -
production
Production (make-X) interfaces for skilling. -
memory
Run-scoped key-value scratchpad; not game state (seevarsfor that). -
effects
Creates plugin-owned effect trackers; event forwarding stays with the plugin lifecycle. -
actions
Factories for worker-polled action-confirmation trackers; each plugin owns its own. -
capabilities
What the unified API supports on this server (privbot/api/capabilities.json). A capability with no evidence isSupport.UNKNOWN, never UNSUPPORTED. -
ids
OSRS id to this server's id (and back) for animations, graphics and varbits; empty when unknown. -
player
The local player as tri-state reads (name, tiles, animation, HP, interacting target). -
events
Polling-backed typed events (projectile, hitsplat, animation, local death, graphic, var, chat). -
teleports
Teleport to a named destination (Impact fairy trees; the movement catalog elsewhere). -
loadouts
Equip an in-game loadout preset (Impact; unsupported elsewhere). -
restock
Go home and re-gear (Impact restockAtHome; Elorin RestockRunner; unsupported elsewhere). -
recovery
Death recovery (Impact reclaim; unsupported elsewhere). -
threats
A detached per-tick snapshot of the fight (NPCs, projectiles, graphics, HP, chosen prayers) for the pure planners inprivbot.mechanics. Call from the runner worker or a node; it marshals its own read. -
pvp
A detached per-tick snapshot of a PvP fight (opponents' overheads, skulls, HP bars, animations, graphics, worn ids, tiles and targets), plus spell-effect trackers in this server's ids. Call from the runner worker or a node. -
hotkeys
Queued user key presses; start and stop with the plugin. -
loot
Collects wanted ground items as a multi-tickJob, each pick proved by the inventory count. -
sustain
Keeps hitpoints, prayer and stat boosts up (eat, brew, restore, dose), each consume proved by the count. -
hazards
Dodging: a hazard map plus the nearest reachable tile out of it. -
targets
Picking a target: a sticky lock over a snapshot's NPCs, and a safe way back to the live NPC. -
capture
Passive recording to~/.privbot/captures; writes nothing untilstart.
-
-
Method Details
-
server
The server this client runs on, derived from the injected adapter.UNKNOWNwhen undetected. -
getClient
public net.runelite.api.Client getClient()The client this context was built with. Raw client reads are not marshalled; wrap them inonClientThread(Supplier)orread(Supplier)when calling from a worker. -
onClientThread
Runsfnon the client thread and returns the result. Delegates toGameThread.ensure(Supplier), so it runs inline when already on the client thread and returnsnullwhen the read was dropped (timeout, interrupt or exception). -
read
-
runOnClientThread
Runsron the client thread (fire-and-forget); inline when already there. Delegates toGameThread.invokeLater(Runnable).
-