Package net.openosrs.api.input.motion
Class PatternPredictor
- java.lang.Object
-
- net.openosrs.api.input.motion.PatternPredictor
-
@Singleton public class PatternPredictor extends java.lang.ObjectPredicts the next interaction from the ones observed before it.Repetitive tasks such as mining, woodcutting or dropping items follow a steady sequence. Counting which action tends to follow which lets the cursor start moving toward the likely next target before the plugin asks for it.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPatternPredictor.InventoryPatternstatic classPatternPredictor.Prediction
-
Constructor Summary
Constructors Constructor Description PatternPredictor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear learned transitions.voidconfirmTransition(java.lang.String context, java.lang.String from, java.lang.String to, long durationMs)Learn only after the caller observes completion, never from a submitted click.PatternPredictor.InventoryPatterndetectInventoryPattern(java.util.List<java.lang.Integer> slotHistory)Detect inventory pattern from a sequence of recent clicked slots.longgetConfirmedSamples()java.lang.StringpredictNext(java.lang.String from)Predict the most probable next state from the given state.PatternPredictor.PredictionpredictNext(java.lang.String context, java.lang.String from)Two matching outcomes seed prediction; uncertain transitions remain unlearned.java.lang.StringpredictNextAction()Predict the next action given the most recent action.intpredictNextInventorySlot(int currentSlot, PatternPredictor.InventoryPattern pattern)Predict the next inventory slot in sequence (0-27).net.runelite.api.PointprojectHeading(net.runelite.api.Point current, double headingRad, double speedPxTick, double leadTicks)Project a spatial lead point along the player's current heading vector.voidrecordAction(java.lang.String action)Record an action and update the transition counts.voidrecordTransition(java.lang.String from, java.lang.String to)Record an observed interaction transition.
-
-
-
Method Detail
-
confirmTransition
public void confirmTransition(java.lang.String context, java.lang.String from, java.lang.String to, long durationMs)Learn only after the caller observes completion, never from a submitted click.
-
predictNext
public PatternPredictor.Prediction predictNext(java.lang.String context, java.lang.String from)
Two matching outcomes seed prediction; uncertain transitions remain unlearned.
-
getConfirmedSamples
public long getConfirmedSamples()
-
recordTransition
public void recordTransition(java.lang.String from, java.lang.String to)Record an observed interaction transition.- Parameters:
from- previous action or target descriptorto- subsequent action or target descriptor
-
recordAction
public void recordAction(java.lang.String action)
Record an action and update the transition counts.
-
predictNextAction
public java.lang.String predictNextAction()
Predict the next action given the most recent action.- Returns:
- predicted next action label, or null if insufficient data
-
predictNext
public java.lang.String predictNext(java.lang.String from)
Predict the most probable next state from the given state.
-
predictNextInventorySlot
public int predictNextInventorySlot(int currentSlot, PatternPredictor.InventoryPattern pattern)Predict the next inventory slot in sequence (0-27).- Parameters:
currentSlot- current slot index (0 to 27)pattern- inventory traversal strategy- Returns:
- next slot index (0 to 27), or -1 if sequence finished
-
detectInventoryPattern
public PatternPredictor.InventoryPattern detectInventoryPattern(java.util.List<java.lang.Integer> slotHistory)
Detect inventory pattern from a sequence of recent clicked slots.
-
projectHeading
public net.runelite.api.Point projectHeading(net.runelite.api.Point current, double headingRad, double speedPxTick, double leadTicks)Project a spatial lead point along the player's current heading vector.- Parameters:
current- current screen coordinateheadingRad- angle in radians (0 = East, PI/2 = South, etc.)speedPxTick- movement speed in pixels per client tickleadTicks- number of ticks to project ahead- Returns:
- anticipated lead point
-
clear
public void clear()
Clear learned transitions.
-
-