Class PrivTaskContext
java.lang.Object
privbot.task.PrivTaskContext
Base context for TaskNode-based scripts that exposes all PrivContext hooks directly.
Sleep/timing: use the convenience methods on this class, or call
Time directly (static, Unethicalite-style). Hooks are thread-safe
via GameThread, so conditions in sleepUntil just work.
Visible-action pacing: use human from execute() on the script thread —
not from shouldExecute().
Usage:
public boolean execute(MyCtx ctx) {
ctx.lobby.openRewardChest();
Time.sleepUntil(() -> !ctx.lobby.rewardChestAvailable(), 4000);
// or: ctx.sleepUntil(() -> !ctx.lobby.rewardChestAvailable(), 4000);
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ActionsSame object asPrivContext.actions.final BankSame object asPrivContext.bank.final CapabilitiesMirrorsPrivContext.capabilities.final CaptureSame object asPrivContext.capture.final ChatSame object asPrivContext.chat.final CombatSame object asPrivContext.combat.final DialogueSame object asPrivContext.dialogue.final EffectsSame object asPrivContext.effects.final EquipmentSame object asPrivContext.equipment.final EventsMirrorsPrivContext.events.final FriendsSame object asPrivContext.friends.final GameSame object asPrivContext.game.final GraphicsObjectsSame object asPrivContext.graphics.final GroundItemsSame object asPrivContext.groundItems.final HazardsSame object asPrivContext.hazards.final HotkeysSame object asPrivContext.hotkeys.final HumanThread-safe RNG and pacing for player-visible actions (script thread only).final IdsMirrorsPrivContext.ids.final InventorySame object asPrivContext.inventory.final LoadoutsMirrorsPrivContext.loadouts.final LootSame object asPrivContext.loot.final MagicSame object asPrivContext.magic.final BlackboardSame object asPrivContext.memory.final NPCsSame object asPrivContext.npcs.final GameObjectsSame object asPrivContext.objects.final PlacesSame object asPrivContext.places.final LocalPlayerMirrorsPrivContext.player.final PlayersHookSame object asPrivContext.players.final PrayerSame object asPrivContext.prayer.protected final PrivContextFull PrivContext reference.final ProductionSame object asPrivContext.production.final PvpSame object asPrivContext.pvp.final RecoveryMirrorsPrivContext.recovery.final RestockMirrorsPrivContext.restock.final ShopSame object asPrivContext.shop.final SkillsSame object asPrivContext.skills.final SustainSame object asPrivContext.sustain.final TargetsSame object asPrivContext.targets.final TeleporterSame object asPrivContext.teleporter.final TeleportsMirrorsPrivContext.teleports.final ThreatsSame object asPrivContext.threats.final TradeSame object asPrivContext.trade.final TravelSame object asPrivContext.travel.final UserSame object asPrivContext.user.final VarsSame object asPrivContext.vars.final WidgetsSame object asPrivContext.widgets.final WorkflowsSame object asPrivContext.workflow. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnet.runelite.api.ClientThe client fromPrivContext.getClient().<T> TonClientThread(Supplier<T> fn) GameThread.ensure(Supplier): runsfnon the client thread and returns its result, ornullwhen the read could not be served.priv()The underlying fullPrivContext(e.g.<T> TBatch a read-only decision; actions and waits belong outside this callback.voidGameThread.invokeLater(Runnable): fire-and-forget on the client thread.server()MirrorsPrivContext.server().booleansleep(int min, int max) Time.sleep(int, int): a random sleep in[min, max]ms.booleansleep(long ms) Time.sleep(long): false on the client thread or when interrupted.booleanTime.sleepTick(): waits for the next game tick.booleansleepTicks(int ticks) Time.sleepTicks(int): waits forticksgame ticks.booleansleepUntil(BooleanSupplier condition, int timeoutMs) Time.sleepUntil(BooleanSupplier, int): true once the condition holds, false on timeout.booleansleepUntil(BooleanSupplier condition, int pollingRate, int timeoutMs) Time.sleepUntil(BooleanSupplier, int, int)with a custom polling interval.booleansleepWhile(BooleanSupplier condition, int timeoutMs) Time.sleepWhile(BooleanSupplier, int): true once the condition turns false.
-
Field Details
-
privContext
Full PrivContext reference. -
inventory
Same object asPrivContext.inventory. -
bank
Same object asPrivContext.bank. -
npcs
Same object asPrivContext.npcs. -
objects
Same object asPrivContext.objects. -
graphics
Same object asPrivContext.graphics. -
groundItems
Same object asPrivContext.groundItems. -
equipment
Same object asPrivContext.equipment. -
players
Same object asPrivContext.players. -
prayer
Same object asPrivContext.prayer. -
combat
Same object asPrivContext.combat. -
skills
Same object asPrivContext.skills. -
magic
Same object asPrivContext.magic. -
teleporter
Same object asPrivContext.teleporter. -
trade
Same object asPrivContext.trade. -
shop
Same object asPrivContext.shop. -
widgets
Same object asPrivContext.widgets. -
dialogue
Same object asPrivContext.dialogue. -
user
Same object asPrivContext.user. -
game
Same object asPrivContext.game. -
chat
Same object asPrivContext.chat. -
friends
Same object asPrivContext.friends. -
vars
Same object asPrivContext.vars. -
workflow
Same object asPrivContext.workflow. -
places
Same object asPrivContext.places. -
travel
Same object asPrivContext.travel. -
production
Same object asPrivContext.production. -
memory
Same object asPrivContext.memory. -
effects
Same object asPrivContext.effects. -
actions
Same object asPrivContext.actions. -
capabilities
MirrorsPrivContext.capabilities. -
ids
MirrorsPrivContext.ids. -
player
MirrorsPrivContext.player. -
events
MirrorsPrivContext.events. -
teleports
MirrorsPrivContext.teleports. -
loadouts
MirrorsPrivContext.loadouts. -
restock
MirrorsPrivContext.restock. -
recovery
MirrorsPrivContext.recovery. -
threats
Same object asPrivContext.threats. -
pvp
Same object asPrivContext.pvp. -
hotkeys
Same object asPrivContext.hotkeys. -
loot
Same object asPrivContext.loot. -
sustain
Same object asPrivContext.sustain. -
hazards
Same object asPrivContext.hazards. -
targets
Same object asPrivContext.targets. -
capture
Same object asPrivContext.capture. -
human
Thread-safe RNG and pacing for player-visible actions (script thread only).
-
-
Constructor Details
-
PrivTaskContext
Copies every hook reference fromctxand creates a freshHuman. Subclass it to add plugin state and services; construct it once per plugin start.
-
-
Method Details
-
server
MirrorsPrivContext.server(). -
getClient
public net.runelite.api.Client getClient()The client fromPrivContext.getClient(). Raw reads on it are not marshalled. -
priv
The underlying fullPrivContext(e.g. for hooks not mirrored here, or to wrap into another context). -
sleep
public boolean sleep(long ms) Time.sleep(long): false on the client thread or when interrupted. -
sleep
public boolean sleep(int min, int max) Time.sleep(int, int): a random sleep in[min, max]ms. -
sleepUntil
Time.sleepUntil(BooleanSupplier, int): true once the condition holds, false on timeout. -
sleepUntil
Time.sleepUntil(BooleanSupplier, int, int)with a custom polling interval. -
sleepWhile
Time.sleepWhile(BooleanSupplier, int): true once the condition turns false. -
sleepTick
public boolean sleepTick()Time.sleepTick(): waits for the next game tick. -
sleepTicks
public boolean sleepTicks(int ticks) Time.sleepTicks(int): waits forticksgame ticks. -
onClientThread
GameThread.ensure(Supplier): runsfnon the client thread and returns its result, ornullwhen the read could not be served. -
read
Batch a read-only decision; actions and waits belong outside this callback. SeePrivContext.read(Supplier). -
runOnClientThread
GameThread.invokeLater(Runnable): fire-and-forget on the client thread.
-