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.Create¶
function TRSEntity.Create(walker: PRSWalker; size: TVector3; coordinates: TPointArray; uptext: TStringArray = []; dots: ERSMinimapDots = []): TRSEntity; static;
function TRSEntity.Create(json: TJSONObject): TRSEntity; static; overload;
Createors to create your TRSEntity.
Assuming you create the RSEntity manually, the Createor 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]); //varrock west southern most banker
npc := TRSEntity.Create(@Map.Walker, [1,1,7], [[8652,36686]], ['Banker'], [ERSMinimapDot.NPC]);
//npc.Finder.Colors += [$543B3B, 10.121, EColorSpace.HSV, [0.528, 1.275, 1.199]];
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 := TRSEntity.Create(NPCsJSON.GetByName('banker', 1).Item[0]);
end;
RSEntityArray.Create¶
function TRSEntityArray.Create(json: TJSONArray): TRSEntityArray; static;
Create function to build your TRSObjectArray.
This only accepts a json array and it expects a specific json structure which is
the one that Map JSONs provide.
Example:
{$I WaspLib/osrs.simba}
var
entities: TRSEntityArray;
begin
Map.Setup([ERSChunk.VARROCK]);
entities := TRSEntityArray.Create(NPCsJSON.GetByName('Banker'));
end;
Entity._GetBounds¶
function TRSEntity._GetBounds(me: TPoint; vector: TVector2; size: TVector3; height, radians: Single): TCuboid;
Internal helper function for TRSEntity.GetBoundsArray.
Entity.GetBoundsArray¶
function TRSEntity.GetBoundsArray(me: TPoint; angle: Single = $FFFF): TCuboidArray;
Internal function that returns an array of cuboids of the entity if it’s visible on the MainScreen.
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.GetBoundsArray() so targets that are outside of the mainscreen are filtered out. You will probably never need to use this directly.
TRSEntity.FindEx¶
function TRSEntity.FindEx(me: TPoint; out boundsArray: TPolygonArray; out coordinates: TPointArray; out atpa: T2DPointArray): Boolean;
Internal TRSEntity method used to find a RSEntity.
You also have RSEntity.Find to find entities, this version of the method
is internal because it returns extra information about the found entities for
internal use, like it’s cuboids for example.
This also returns an atpa containing the colors of the object that were found
assuming the object has a TColorFinder setup.
If not, the cuboids area are returned as the match.
RSEntity.Find¶
function TRSEntity.Find(out coordinates: TPointArray; out atpa: T2DPointArray): Boolean;
function TRSEntity.Find(out atpa: T2DPointArray): Boolean; overload;
TRSEntity method used to find a RSEntity.
This returns True/False if the entity was found and it’s atpa which cointains
the colors of it that were found.
For more information on this refer to TRSEntity.FindEx, it’s an internal function but is used within this one and will go into more detail.
TRSEntity._UpTextCheck¶
function TRSEntity._UpTextCheck(out shouldExit: Boolean; action: TStringArray): 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(action: TStringArray; attempts: Integer): Boolean;
Internal helper method used to hover a TRSEntity target. You should not use this directly.
TRSEntity._WalkHoverHelper¶
function TRSEntity._WalkHoverHelper(action: TStringArray; attempts: Integer): 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(action: TStringArray = []; attempts: Integer = 2): Boolean;
Method used to hover a TRSEntity target if it’s found on the mainscreen.
Example:
//TODO...
TRSEntity.WalkHover¶
function TRSEntity.WalkHover(action: TStringArray = []; attempts: Integer = 2): Boolean;
Method used to walk and hover a TRSEntity target if it’s found on the mainscreen after walking.
Example:
//TODO...
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.Interact¶
function TRSEntity.Interact(action: TStringArray; attempts: Integer = 2): Boolean;
Method used to select an option on a TRSEntity target if it’s found on the mainscreen.
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.WalkInteract¶
function TRSEntity.WalkInteract(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.
TImage.DrawEntity¶
procedure TImage.DrawEntity(npc: TRSEntity);
Helper method to debug TRSEntity.
ShowOnTarget TRSEntity¶
procedure ShowOnTarget(entity: TRSEntity); overload;
Shows an image of the target with the TRSEntity drawn on it.
ShowOnTarget TRSEntityArray¶
procedure ShowOnTarget(entities: TRSEntityArray); overload;
Shows an image of the target with the TRSEntityArray drawn on it.