WalkerV2

This file is responsible for the walking system. It is heavily inspired in the original TRSWalker by Slacky and it’s future iterations made by Olly.


PRSWalkerV2

TRSWalkerV2 pointer.


TRSWalker_OnWalkEvent

Callback object method to use while walking. This can be used to perform custom tasks while walking.

Example:

procedure TRSWalker.WalkerTasks(Walker: PRSWalker; Position: TPoint; Destination: TPoint);
begin
  Antiban.RandomTab();
end;

var
  rsw: TRSWalker;
begin
  rsw.Setup('world');
  rsw.OnWalkingEvent := @rsw.WalkerTasks;
end;

TRSWalkerV2.Setup

procedure TRSWalkerV2.Setup(
  position: function (): TPoint of object;
  height: function (p: TPoint = [-1,-1]): Single of object;
  getLocal: function (tpa: TPointArray; offset: TPoint = [0,0]): TPointArray of object;
  graph: ^TWebGraph;
  mapImage: TMufasaBitmap
);

Setup method for TRSWalkerV2.

Only position is a hard requirement of this method, all others can be nil if you don’t need them.

graph is only required if you plan on doing webwaking and should point to your webgraph. getLocal and mapImage are just for webgraph debugging if webwalking crashes.

height is only required if you want to pass in tile heights information to TRSWalkerV2.

Example:

Walker.Setup(@MyCustomPositionSystem, nil, nil, nil, nil);

TRSWalkerV2.InRange

function TRSWalkerV2.InRangeEx(me, coordinate: TPoint; distance: Int32 = 4): Boolean;
function TRSWalkerV2.AnyInRangeEx(me: TPoint; coordinates: TPointArray; distance: Int32 = 4): Boolean; overload;
function TRSWalkerV2.InRange(coordinate: TPoint; distance: Int32 = 4): Boolean;
function TRSWalkerV2.AnyInRange(coordinates: TPointArray; distance: Int32 = 4): Boolean; overload;

Method used to quickly check if we are within distance of a certain coordinate. This distance is measure in pixels and in a radial way. You can optionally pass in a TPA to check if the closest point is within distance.


Walker.CheckRunEnergy

procedure TRSWalkerV2.CheckRunEnergy();

Internal method used to check and enable the player run. You will probably never need to call this directly.

The values used are hardcoded and if you don’t like them, it’s recommended you override the method. The following example shows how one could override the function to enable run at 50% energy everytime, keep in mind though, you shouldn’t do this, you should add randomness to it!


Walker.AdaptiveWalkCheck

procedure TRSWalkerV2.AdaptiveWalkCheck(position: TPoint);

Internal method used to check if adaptive walk should toggle and toggle TRSWalkerV2.ScreenWalk. You will probably never need to call this directly.


Walker.DoMouseAhead

procedure TRSWalkerV2.DoMouseAhead(position: TPoint; forced: Boolean = False);

Internal method used to pre-hover the next walking step. You will probably never need to call this directly.


Walker.WaitMoving

procedure TRSWalkerV2.WaitMoving(destination: TPoint; waitUntilDistance: Int32);

Internal method used to wait while we are moving using walker. You will probably never need to call this directly.

This is where TRSWalkerV2.OnWalkingEvent are called.


Walker.Click

function TRSWalkerV2.Click(minimapPoint: TPoint; Randomness: Int32): Boolean;

Internal method used by walker to handle clicking while walking. You will probably never need to call this directly.

If you wish to modify certain walker behaviors, it can be a good approach to override this function.


Walker.WalkStepHelper()

function TRSWalkerV2.WalkStepHelper(playerPoint, walkerPoint: TPoint; out minimapPoint: TPoint): Boolean;

Internal method used by walker to help walking steps. You will probably never need to call this directly.


Walker.WalkFinalStep

function TRSWalkerV2.WalkFinalStep(playerPoint, walkerPoint: TPoint; WaitUntilDistance: Int32): Boolean;

Internal method used by walker when finishing walking a path. You will probably never need to call this directly but it can be used to take a single step.


Walker.WalkStep

function TRSWalkerV2.WalkStep(playerPoint, walkerPoint: TPoint): Boolean;

Internal method used by walker while walking a path. You will probably never need to call this directly.


Walker.IsWalkable

function TRSWalkerV2.IsWalkable(walkerPoint: TPoint; playerPoint: TPoint; Angle: Double): Boolean;

Internal method used by walker to decide if the destination point is within 1 click reach. You will probably never need to call this directly.


TRSWalkerV2.WalkPath

function TRSWalkerV2.WalkPath(Path: TPointArray; WaitUntilDistance: Int32 = 0): Boolean;

Walks a path of points taken from the loaded map. We advice that WaitUntilDistance is not 0.

Parameters:

  • Path Array of points taken from the loaded map to walk. Must be ordered from start to finish.

  • WaitUntilDistance Determines when the method returns once the final point has been clicked. Default value: 0. | WaitUntilDistance=0 waits until the player has reached the final point. | WaitUntilDistance=20 waits until the player is within 20 pixels of the final point.

Example:

Walker.WalkPath([[100,100],[120,120],[140,140],[160,160],[180,180]]);

TRSWalkerV2.WalkBlind

function TRSWalkerV2.WalkBlind(Destination: TPoint; WaitUntilDistance: Int32 = 0): Boolean;

“Blindly” walks to a point taken from the loaded map. A straight line is generated between the player’s position and destination which is then walked.

Parameters:

  • Destination Destination point taken from the loaded map.

  • WaitUntilDistance Determines when the method returns once the final point has been clicked. Default value: 0. | WaitUntilDistance=0 waits until the player has reached the final point. | WaitUntilDistance=20 waits until the player is within 20 pixels of the final point.

Example:

Walker.WalkBlind([300, 300]);

TRSWalkerV2.GetClosestPoint

function TRSWalkerV2.GetClosestPointEx(me: TPoint; destinations: TPointArray): TPoint;
function TRSWalkerV2.GetClosestPoint(destinations: TPointArray): TPoint;

Method used to get the closest Point to the Player out of a TPA.


TRSWalkerV2.WebWalk

function TRSWalkerV2.WebWalkEx(me: TPoint; destination: TPoint; waitUntilDistance: Int32 = 0; pathRandomness: Double = 0): Boolean;
function TRSWalkerV2.WebWalk(destination: TPoint; waitUntilDistance: Int32 = 0; pathRandomness: Double = 0): Boolean;
function TRSWalkerV2.WebWalk(destinations: TPointArray; waitUntilDistance: Int32 = 0; pathRandomness: Double = 0): Boolean; overload;

Web walks to the destination point on the loaded map. Does not handle any obstacles.


TRSWalkerV2.MakePointVisible

function TRSWalkerV2.MakePointVisible(p: TPoint): Boolean;
function TRSWalkerV2.MakePointVisible(tpa: TPointArray): Boolean; overload;

Wrapper function used to attempt to make a Point visible on the MainScreen.