Walker Objects¶
Methods to handle TWalkerObjects. TWalkerObject can be anything that you want to interact with on the mainscreen. They are divided in 2 main categories and one of them in 3 sub-categories but the usage is only limited by your imagination:
GameObjects (TWalkerObjects that don’t have a dot on the minimap)
MMDots: (TWalkerObjects that have a dot on the minimap) -RSNPCs -RSGroundItems -RSPlayers
How do they work?¶
TWalkerObjects are very customizable and can be used to interact with almost everything. For some niche use cases it might be worth do something custom or override some methods to get the behavior you want.
The default way they work is:
WaspLib checks if you are in the TWalkerObject.Coordinates range. If not and you used one of the Walk methods, it will walk to that location.
Being in the TWalkerObject location, then we check if our TWalkerObject is a TGameObject or a TMMDot. for a TGameObject we stick with the TWalkerObject.Coordinates, for TMMDots, the coordinates are changed to the minimap dots that within the radius specified when the TWalkerObject was setup.
WaspLib then convert the coordinate along with the TWalkerObject.ShapeArray information to a TCuboidArray on the mainscreen (https://en.wikipedia.org/wiki/Cuboid).
This TCuboidArray is the “bounds” of our targets. Each one should accurately surround each of our possible targets.
Then WaspLib runs MainScreen.FindObject() inside of each TCuboid. For more info on how this works read the TObjectFinder documentation (https://torwent.github.io/SRL-T/mainscreen.html#type-TObjectFinder).
An ATPA of the found colors inside each cuboid is then returned.
If the method used is related to hovering or clicking, we hover the closest target and then check if TWalkerObject.UpText matches the uptext.
If it does and we are using a clicking method, we click it.
If we use a select method, if the option is not in the uptext we right click the target and select that option.
This is the default behavior but TWalkerObjects are very customizable and functionality can be toggled on with TWalkerObject.Filter:
Filter.Walker: Disables walker for the TWalkerObject. Coordinates are ignored and still use the minimap dots that are visible on the minimap if we are talking about a TMMDot, otherwise only MainScreen.FindObject() is used.
Filter.MinimapDot: Disables the usage of minimap dots for TMMDots. TGameObjects have this off by default. Disabling this for TMMDots is only useful if the the Player, NPC or Item is in a fixed position.
Filter.Finder: Disables color checking. The returned cuboids by Walker and MM2MS are our targets. This is useful for things that are “invisible” like agility shortcuts and/or things that have colors that are just unreliable.
UpText: Ignore all uptext when hovering the targets
Filter.Skip: This is an internal filter that you probably don’t want to use directaly. Decides which TWalkerObjects setup is skipped during wasplib’s setup process.
Note
You cannot disable Filter.Walker, Filter.MinimapDot, Filter.Finder all at the same time. You need one of them enabled and keep in mind that TGameObjects already have Filter.MinimapDot disabled.
type TWalkerObject¶
TWalkerObject = record
Filter: record
Walker: Boolean;
MinimapDot: Boolean;
Finder: Boolean;
UpText: Boolean;
Skip: Boolean;
end;
ShapeArray: TMainScreenShapeArray;
Coordinates: TPointArray;
Finder: TObjectFinder;
UpText: TStringArray;
ActionUpText: TStringArray;
class var
CurrentUpText: TStringArray;
CurrentActionUpText: TStringArray;
RedClicked: Boolean;
end;
PWalkerObjectArray = array of Pointer;
PWalkerObject = ^TWalkerObject;
Parent record of all TWalkerObjects.
Walker.Click¶
function TWalker.Click(minimapPoint: TPoint; Randomness: Int32): Boolean; override;
You shouldn’t modify this unless you know what you are doing, otherwise you might break TWalkerObjects. This is overriden so if we redclick our current TWalkerObject target while mainscreen walking we disable walker. When we start the walking process towards a TWalkerObject, TWalkerObject.CurrentUpText is temporarily set so we know what we are looking for while walking. Once we click the target TWalkerObject.CurrentUpText is cleared.
TWalkerObject._Setup¶
procedure TWalkerObject._Setup();
Base internal TWalkerObject setup method. You probably won’t need to call this directly, it’s called by the next setup methods automatically.
TWalkerObject.Setup¶
procedure TWalkerObject.Setup(coordinates: TPointArray);
procedure TWalkerObject.Setup(upText: TStringArray); overload;
TWalkerObject setup methods. You usually need to call of this.
The method that takes in coordinates should be called first.
That is because TWalkerObject.Setup(coordinates: TPointArray) is where
we decide if TWalkerObject.Filter.Skip is going to be true or not.
Keep in mind if you don’t use a TWalker in your script and want to use TWalkerObjects, you will need to manually setup them in your script
because they will all be skipped.
So you need to set TWalkerObject.Filter.Skip := False and then call TWalkerObject.Setup(upText: TStringArray)
Normal usage in the following example.
Example:
//Example with walker:
var
rsw: TWalker;
obj: TGameObject; //This is a type of TWalkerObject.
begin
rsw.Setup();
obj.Setup([[200, 200]]);
obj.Setup(['My', 'uptext']);
end;
//Example without walker:
var
obj: TGameObject; //This is a type of TWalkerObject.
begin
obj.Setup(['My', 'uptext']);
end;
TWalkerObject.GetCuboidArray¶
function TWalkerObject.GetCuboidArray(): TCuboidArray;
Internal TWalkerObject method responsible for returning a TCuboidArray of our target on the 3D world (on mainscreen and outside of it).
You will probably never need to use this directly.
You can visually see this in action by using the Debug() methods, this is responsible for the white lines surounding the targets.
TWalkerObject.FindOnMainScreen¶
function TWalkerObject.FindOnMainScreen(cuboidArray: TCuboidArray): T2DPointArray;
Internal TWalkerObject method responsible for filtering a TCuboidArray by what’s visible in the mainscren. This is meant to filter TWalkerObject.GetCuboidArray() so targets that are outside of the mainscreen are filtered out. You will probably never need to use this directly.
TWalkerObject.OnMainScreen¶
function TWalkerObject.OnMainScreen(cuboidArray: TCuboidArray): Boolean;
Internal TWalkerObject method that returns true or false if we have TCuboids visible on the mainscreen. You probably don’t need to use this directly.
TWalkerObject._UpTextCheck¶
function TWalkerObject._UpTextCheck(out shouldExit: Boolean): Boolean;
Internal TWalkerObject helper method that is used by all hovering methods. You probably don’t need to use this directly.
TWalkerObject._WalkUpTextCheck¶
function TWalkerObject._WalkUpTextCheck(out shouldExit: Boolean): Boolean;
Internal TWalkerObject helper method that is used by all walking hover methods. You probably don’t need to use this directly.
TWalkerObject._ClickHelper¶
function TWalkerObject._ClickHelper(leftClick: Boolean): Boolean;
Internal TWalkerObject helper method that is used by other clicking methods. You probably don’t need to use this directly.
This is what’s responsible for deciding if we click a target we are hovering or not.
TWalkerObject._SelectHelper¶
function TWalkerObject._SelectHelper(action: TStringArray): Boolean;
Internal TWalkerObject helper method that is used by other select methods. You probably don’t need to use this directly.
This is what is responsible for deciding if we just left click a target we are hovering or right click it and choose an option.
type TGameObject¶
TGameObject = type TWalkerObject;
TGameObjectArray = array of TGameObject;
PGameObject = ^TGameObject;
PGameObjectArray = array of PGameObject;
TGameObjects are a type of type TWalkerObject. This are meant to be TWalkerObjects that do not have a minimap dot so TGameObject.Filter.MinimapDot is False by default and shouldn’t be changed.
TGameObject.Setup¶
procedure TGameObject.SetupEx(shape: Vector3; coordinates: TPointArray); overload;
procedure TGameObject.Setup(size, height: Double; coordinates: TPointArray); overload;
procedure TGameObject.Setup(height: Double; coordinates: TPointArray); overload;
All this extend the basic TWalkerObject.Setup(coordinates: TPointArray).
For TGameObjects this are the methods that should be used for setting them up initially.
In TGameObject.Setup(shape: Vector3; coordinates: TPointArray), shape should be a vector3 of the object shape in number of tiles:
shape.X: number of tiles of the object from west to east.
shape.Y: number of tiles of the object from north to south.
shape.Z: object height, this value has to be guessed, I recommend you try several values and debug it until it looks good to you. As some examples, player and npcs height is around 7, bank chests 4, yew/magic trees 14/16.
In TGameObject.Setup(size, height: Double; coordinates: TPointArray), size and height are used to create a Vector3 “shape” and call TGameObject.Setup(shape: Vector3; coordinates: TPointArray). In this case, shape.X and shape.Y would be both equal to size.
Lastly, TGameObject.Setup(height: Double; coordinates: TPointArray) also calls TGameObject.Setup(shape: Vector3; coordinates: TPointArray) and sets the shape.X and shape.Y to 1.
TGameObject.Find¶
function TGameObject.FindEx(out cuboids: TCuboidArray; out atpa: T2DPointArray): Boolean;
function TGameObject.Find(out atpa: T2DPointArray): Boolean;
TGameObject method used to find a type TGameObject. If found returns true, if not returns false.
The “extended” method in particular is mostly meant for debugging and is the one used when you call Debug(TGameObject).
Example:
WriteLn GameObjects.GEBank.Find(atpa); //Be in ge and with a walker setup there.
Debug(atpa);
TGameObject.IsVisible¶
function TGameObject.IsVisible(): Boolean;
TGameObject method used to find a type TGameObject. If found returns true, if not returns false.
Example:
WriteLn GameObjects.GEBank.IsVisible(); //Be in ge and with a walker setup there.
TGameObject.FindFromPosition¶
function TGameObject.FindFromPosition(me: TPoint; out atpa: T2DPointArray): Boolean;
Look for a type TGameObject as if you were on a different position. Great for things like pre-hovering.
TGameObject.Draw¶
procedure TGameObject.Draw(out bitmap: TMufasaBitmap);
Internal method used to draw found TGameObjects in a TMufasaBitmap.
Example:
Bitmap.FromClient()
GameObjects.GEBank.Draw(Bitmap); //Be in ge and with a walker setup there.
Bitmap.Debug();
Bitmap.Free();
TGameObject.SaveDebug¶
procedure TGameObject.SaveDebug();
Saves a debug image of the TGameObject to Simba\Screenshots\GameObjects
Example:
GameObjects.GEBank.SaveDebug(); //Be in ge and with a walker setup there.
TGameObject._UpdateTarget¶
procedure TGameObject._UpdateTarget(sender: PMouse; var x, y: Double; var done: Boolean);
Internal helper method of TMouseMovingEventEx type used to update the target position while the mouse is moving. You should probably not touch this if you don’t understand it.
TGameObject._HoverHelper¶
function TGameObject._HoverHelper(attempts: Int32; trackTarget: Boolean): Boolean;
Internal helper method used to hover a TGameObject target. You should not use this directly.
TGameObject._WalkHoverHelper¶
function TGameObject._WalkHoverHelper(attempts: Int32; trackTarget: Boolean): Boolean;
Internal helper method used to walk and hover a TGameObject target. You should not use this directly.
This is responsible for deciding wether we should walk to a TGameObject target or not before attempting to hover it.
TGameObject.PreHoverHelper¶
function TGameObject.PreHoverHelper(attempts: Int32): Boolean;
Internal helper method used to pre-hover a TGameObject target. You should not use this directly.
TGameObject.Hover¶
function TGameObject.Hover(attempts: Int32 = 2; trackTarget: Boolean = TRACK_TARGET): Boolean;
Method used to hover a TGameObject target if it’s found on the mainscreen. It can update the target position while the mouse moves with trackTarget.
Example:
RSW.WebWalk(WaspWeb.LOCATION_VARROCK);
GameObjects.GEBank.Hover(); //Be in GE with a walker setup there.
TGameObject.WalkHover¶
function TGameObject.WalkHover(attempts: Int32 = 2; trackTarget: Boolean = TRACK_TARGET): Boolean;
Method used to walk and hover a TGameObject target if it’s found on the mainscreen after walking. It can update the target position while the mouse moves with trackTarget.
Example:
//Be in varrock with a varrock map loaded.
RSW.WebWalk(WaspWeb.LOCATION_VARROCK);
GameObjects.GEBank.WalkHover();
TGameObject.Click¶
function TGameObject.Click(leftClick: Boolean = True; attempts: Int32 = 2): Boolean;
Method used to click a TGameObject target if it’s found on the mainscreen.
Example:
//Be in ge with a ge map loaded.
WriteLn GameObjects.GEBank.Click();
TGameObject.SelectOption¶
function TGameObject.SelectOption(action: TStringArray; attempts: Int32 = 2): Boolean;
Method used to select an option on a TGameObject target if it’s found on the mainscreen.
Example:
//Be in ge with a ge map loaded.
WriteLn GameObjects.GEBank.SelectOption(['Collect']);
TGameObject.WalkClick¶
function TGameObject.WalkClick(leftClick: Boolean = True; attempts: Int32 = 2): Boolean;
Method used to walk and click a TGameObject target if it’s found on the mainscreen.
Example:
//Be in ge with a ge map loaded, preferably far away so it has to walk.
WriteLn GameObjects.GEBank.WalkClick();
TGameObject.WalkSelectOption¶
function TGameObject.WalkSelectOption(action: TStringArray; attempts: Int32 = 2): Boolean;
Method used to walk and select an option on a TGameObject target if it’s found on the mainscreen.
Example:
//Be in ge with a ge map loaded, preferably far away so it has to walk.
WriteLn GameObjects.GEBank.WalkSelectOption(['Collect']);
type TMMDot¶
TMMDot are a type of TWalkerObject. This are meant to be TWalkerObjects that have a minimap dot so TMMDot.Filter.MinimapDot is True by default and shouldn’t be changed. This also have a DotType variable for the type of EMinimapDot they have (PLAYER, NPC, ITEM) and a DotFilter which is used to filter mmdots in/out of circles and/or polygons so we only focus on the TMMDots we want.
TMMDot.Setup¶
procedure TMMDot.SetupEx(radius: Int32; shape: Vector3; coordinates: TPointArray); overload;
procedure TMMDot.Setup(radius: Int32; size, height: Double; coordinates: TPointArray); overload;
procedure TMMDot.Setup(radius: Int32; height: Double; coordinates: TPointArray); overload;
All this extend the basic TWalkerObject.Setup(coordinates: TPointArray) specifically for TMMDots.
For TMMDots this are the methods that should be used for setting them up initially.
In TMMDot.Setup(radius: Int32; shape: Vector3; coordinates: TPointArray), radius is used to create a simple TDotFilterArray of that radius with cordinates and their center point. shape should be a vector3 of the target shape in number of tiles:
shape.X: Number of tiles of the target from west to east.
shape.Y: Number of tiles of the target from north to south.
shape.Z: Target height, this value has to be guessed, I recommend you try several values and debug it until it looks good to you. As some examples, player and npcs height is around 7, bank chests 4, yew/magic trees 14/16.
For NPCs that can move and are 1x2 tiles or any uneven number of tiles, I recommend you just set shape.X and shape.Y to the largest one. So a cow I would recommend making the shape 2x2.
The other methods all call this first one with certain default values:
Size makes shape.X and shape.Y equal to size.
If size is omited, shape.X and shape.Y are set to 1.
TMMDot._GetCuboids¶
function TMMDot._GetWMMCuboids(out mmTPA, dots: TPointArray; out dotFilters: TDotFilterArray): TCuboidExArray;
function TMMDot._GetMMCuboids(out dots: TPointArray): TCuboidExArray;
Internal helper TMMDot method used for debugging.
You probably dont need to use this directly.
You can see what this does in action by calling Debug(TMMDot).
TMMDot.GetCuboidArray¶
function TMMDot.GetCuboidArrayEx(out mmTPA, dots: TPointArray; out dotFilters: TDotFilterArray; out floorTiles: TRectArray; out roofTiles: TRectArray): TCuboidArray; overload;
function TMMDot.GetCuboidArray(): TCuboidArray; override;
Internal TMMDot method responsible for returning a TCuboidArray of our target on the 3D world (on mainscreen and outside of it).
This uses the previous 2 helper methods to do this.
You will probably never need to use this directly.
You can visually see this in action by using the Debug() methods, this is responsible for the white lines surounding the targets.
TMMDot.FindEx¶
function TMMDot.FindEx(out mmPoints, dots: TPointArray; out DotFilters: TDotFilterArray; out floorTiles: TRectArray; out roofTiles: TRectArray; out cuboidArray: TCuboidArray; out atpa: T2DPointArray): Boolean;
TMMDot methods used to find a TMMDot. If found returns true, if not returns false.
This “extended” method in particular is only meant for debugging and should be avoided outside of development/debugging.
This is what is used when you call Debug(TMMDot).
TMMDot.Find¶
function TMMDot.Find(out atpa: T2DPointArray): Boolean; overload;
function TMMDot.Find(): Boolean; overload;
TMMDot methods used to find a TMMDot. If found returns true, if not returns false.
Example:
WriteLn RSNPCs.LumbridgeCook.Find(atpa); //Be in lumbridge castle and with a walker setup there.
Debug(atpa);
TMMDot._GetBaseRecord¶
function TMMDot._GetBaseRecord(): TMMDot;
Internal method used for casting custom TMMDots back to the base record.
TMMDot.Draw¶
procedure TMMDot.Draw(out bitmap: TMufasaBitmap);
Internal method used to draw found TMMDot in a TMufasaBitmap.
Example:
Bitmap.FromClient()
RSNPCs.LumbridgeCook.Draw(Bitmap); //Be in Lumbridge castle and with a walker setup there.
Bitmap.Debug();
Bitmap.Free();
TMMDot.SaveDebug¶
procedure TMMDot.SaveDebug();
Saves a debug image of the TMMDot to Simba\Screenshots\RSMMDots
Example:
RSNPCs.LumbridgeCook.SaveDebug(); //Be in Lumbridge castle and with a walker setup there.
TMMDot._UpdateTarget¶
procedure TMMDot._UpdateTarget(sender: PMouse; var x, y: Double; var done: Boolean);
Internal helper method of TMouseMovingEventEx type used to update the target position while the mouse is moving. You should probably not touch this if you don’t understand it.
TMMDot._HoverHelper¶
function TMMDot._HoverHelper(attempts: Int32; trackTarget: Boolean): Boolean;
Internal helper method used to hover a TMMDot target. You should not use this directly.
TMMDot._WalkHoverHelper¶
function TMMDot._WalkHoverHelper(attempts: Int32; trackTarget: Boolean): Boolean;
Internal helper method used to walk and hover a TMMDot target. You should not use this directly.
This is responsible for deciding wether we should walk to a TMMDot target or not before attempting to hover it.
TMMDot.Hover¶
function TMMDot.Hover(attempts: Int32 = 2; trackTarget: Boolean = TRACK_TARGET): Boolean;
Method used to hover a TMMDot target if it’s found on the mainscreen. It can update the target position as the mouse moves with trackTarget. For NPCs that move, this is highly recommended.
Example:
//Be in Lumbridge castle
RSW.WebWalk(WaspWeb.LOCATION_LUMBRIDGE);
RSNPCs.LumbridgeCook.Hover();
TMMDot.WalkHover¶
function TMMDot.WalkHover(attempts: Int32 = 2; trackTarget: Boolean = TRACK_TARGET): Boolean;
Method used to walk and hover a TMMDot target if it’s found on the mainscreen after walking. It can update the target position as the mouse moves with trackTarget. For NPCs that move, this is highly recommended.
Example:
//Be in Lumbridge castle
RSW.WebWalk(WaspWeb.LOCATION_LUMBRIDGE);
RSNPCs.LumbridgeCook.WalkHover();
TMMDot.Click¶
function TMMDot.Click(leftClick: Boolean = True; attempts: Int32 = 2): Boolean;
Method used to click a TMMDot target if it’s found on the mainscreen.
Example:
//Be in Lumbridge castle with a walker map of it loaded.
WriteLn RSNPCs.LumbridgeCook.Click();
TMMDot.SelectOption¶
function TMMDot.SelectOption(action: TStringArray; attempts: Int32 = 2): Boolean;
Method used to select an option on a TMMDot target if it’s found on the mainscreen.
Example:
//Be in Lumbridge castle with a walker map of it loaded.
WriteLn RSNPCs.LumbridgeCook.SelectOption(['Examine']);
TMMDot.WalkClick¶
function TMMDot.WalkClick(leftClick: Boolean = True; attempts: Int32 = 2): Boolean;
Method used to walk and click a TMMDot target if it’s found on the mainscreen.
Example:
//Be in Lumbridge castle with a walker map of it loaded.
WriteLn RSNPCs.LumbridgeCook.WalkClick();
TMMDot.WalkSelectOption¶
function TMMDot.WalkSelectOption(action: TStringArray; attempts: Int32 = 2): Boolean;
Method used to walk and select an option on a TMMDot target if it’s found on the mainscreen.
Example:
//Be in Lumbridge castle with a walker map of it loaded.
WriteLn RSNPCs.LumbridgeCook.WalkSelectOption(['Examine']);
type TNPC¶
TNPC are a type of TMMDot and TWalkerObject. This are meant to be TMMDot that have a yellow minimap dot so TNPC.Filter.MinimapDot is True by default and shouldn’t be changed.
type TGroundItem¶
TGroundItem are a type of TMMDot and TWalkerObject. This are meant to be TMMDot that have a red minimap dot so TGroundItem.Filter.MinimapDot is True by default and shouldn’t be changed.
type TPlayer¶
TPlayer are a type of TMMDot and TWalkerObject. This are meant to be TMMDot that have a white minimap dot so TPlayer.Filter.MinimapDot is True by default and shouldn’t be changed.
TMMDot.SetupUpText¶
procedure TNPC.SetupUpText(upText: TStringArray); override;
procedure TGroundItem.SetupUpText(upText: TStringArray); override;
procedure TPlayer.SetupUpText(upText: TStringArray); override;
Setup method that extends TWalkerObject.SetupUpText(upText: TStringArray); These are the methods that should be used to setup TNPCs, TGroundItems and TPlayers as it ensures that the TNPC.DotType is correctly set.
Debug¶
procedure Debug(GameObject: TGameObject); overload;
procedure Debug(mmdot: TMMDot); overload;
Methods used to debug TGameObjects and TMMDots.
Example:
Debug(GameObjects.GEBank); //Run in ge with a walker map setup there.
Debug(RSNPCs.LumbridgeCook); //Run in Lumbridge castle with a walker map setup there.