Entities

This file is responsible for interacting with RSEntities.

RSEntities is anything in the game that has a ERSMinimapDot assign to it on the Minimap.

These are functionally very similar to RSObjects and you create and interact with them almost the same way.

They only differ in the fact that TRSEntity can use a ERSMinimapDot to help find them and/or TRSDotFilters. Also, due to the unpredictability of entities that move, unlike RSObjects these do not have a rotation field.


TRSEntity

Main type to handle RSEntity.


TRSEntityArray

Array of TRSEntity.


RSEntity.Construct

function TRSEntity.Construct(walker: PRSWalker; size: TVector3; coordinates: TPointArray; uptext: TStringArray = []; dots: ERSMinimapDots = []): TRSEntity; static;
function TRSEntity.Construct(json: TJSONItem): TRSEntity; static; overload;

Constructors to create your TRSEntity.

Assuming you create the RSEntity manually, the constructor will provide you with a fully built TRSEntity without a finder.

You may optionally assign one later if you want:

{$I WaspLib/osrs.simba}
var
  npc: TRSEntity;
begin
  Map.Setup([ERSChunk.VARROCK]);
  npc := new TRSEntity(@Map.Walker, [1,1,7], [[8652,36686]], ['Banked'], [ERSMinimapDot.NPC]);
  //npc.Finder.Colors += $FFFFFF;
end;

The json version of the function expects a specific json structure which is the one that Map JSONs provide:

{$I WaspLib/osrs.simba}
var
  npc: TRSEntity;
begin
  Map.Setup([ERSChunk.VARROCK]);
  //Item[0] because this returns a JSON array. For more info read Map JSONs documentation.
  npc := new TRSEntity(NPCsJSON.GetByName('banker', 1).Item[0]);
end;

TRSEntity.Find

function TRSEntity.Find(cuboidArray: TCuboidArray): T2DPointArray;

Internal TRSEntity method responsible for filtering a TCuboidArray by what’s visible in the mainscren. This is meant to filter TRSEntity.GetCuboidArray() so targets that are outside of the mainscreen are filtered out. You will probably never need to use this directly.


TRSEntityV2.Find

function TRSEntityV2.FindEx(out cuboids: TCuboidArray; out atpa: T2DPointArray): Boolean;
function TRSEntityV2.Find(out atpa: T2DPointArray): Boolean;
function TRSEntityV2.FindFromPosition(me: TPoint; out atpa: T2DPointArray): Boolean;

TRSEntityV2 method used to find a TRSEntityV2. 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(TRSEntity).

Example:

WriteLn RSObjects.GEBank.Find(atpa); //Be in ge and with a walker setup there.
Debug(atpa);

TRSEntity._UpTextCheck

function TRSEntity._UpTextCheck(out shouldExit: Boolean): Boolean;

Internal TRSEntity helper method that is used by all hovering methods. You probably don’t need to use this directly.


TRSEntity._HoverHelper

function TRSEntity._HoverHelper(attempts: Integer; trackTarget: Boolean): Boolean;

Internal helper method used to hover a TRSEntity target. You should not use this directly.


TRSEntity._WalkHoverHelper

function TRSEntity._WalkHoverHelper(attempts: Integer; trackTarget: Boolean): Boolean;

Internal helper method used to walk and hover a TRSEntity target. You should not use this directly.

This is responsible for deciding wether we should walk to a TRSEntity target or not before attempting to hover it.


TRSEntity._PreHoverHelper

function TRSEntity.PreHoverHelper(attempts: Integer): Boolean;

Internal helper method used to pre-hover a TRSEntity target. You should not use this directly.


TRSEntity._ClickHelper

function TRSEntity._ClickHelper(leftClick: Boolean): Boolean;

Internal TRSEntity 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.


TRSEntity._SelectHelper

function TRSEntity._SelectHelper(action: TStringArray): Boolean;

Internal TRSEntity 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.


TRSEntity.Hover

function TRSEntity.Hover(attempts: Integer = 2; trackTarget: Boolean = TRSEntity.TrackTarget): Boolean;

Method used to hover a TRSEntity 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);
RSObjects.GEBank.Hover(); //Be in GE with a walker setup there.

TRSEntity.WalkHover

function TRSEntity.WalkHover(attempts: Integer = 2; trackTarget: Boolean = TRSEntity.TrackTarget): Boolean;

Method used to walk and hover a TRSEntity 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);
RSObjects.GEBank.WalkHover();

TRSEntity.Click

function TRSEntity.Click(leftClick: Boolean = True; attempts: Integer = 2): Boolean;

Method used to click a TRSEntity target if it’s found on the mainscreen.

Example:

//Be in ge with a ge map loaded.
WriteLn RSObjects.GEBank.Click();

TRSEntity.SelectOption

function TRSEntity.SelectOption(action: TStringArray; attempts: Integer = 2): Boolean;

Method used to select an option on a TRSEntity target if it’s found on the mainscreen.

Example:

//Be in ge with a ge map loaded.
WriteLn RSObjects.GEBank.SelectOption(['Collect']);

TRSEntity.WalkClick

function TRSEntity.WalkClick(leftClick: Boolean = True; attempts: Integer = 2): Boolean;

Method used to walk and click a TRSEntity 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 RSObjects.GEBank.WalkClick();

TRSEntity.WalkSelectOption

function TRSEntity.WalkSelectOption(action: TStringArray; attempts: Integer = 2): Boolean;

Method used to walk and select an option on a TRSEntity 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 RSObjects.GEBank.WalkSelectOption(['Collect']);

TImage.DrawEntity

procedure TImage.DrawEntity(npc: TRSEntity);

Helper method to debug TRSEntity.