Minimap¶
Methods to interact with the minimap interface:
EDot enum¶
EDot = enum(PLAYER, NPC, ITEM);
Enum representing the available minimap dots.
EMinimapOrb enum¶
EMinimapOrb = enum(HITPOINTS, PRAYER, ENERGY, SPECIAL);
Enum representing the 4 available minimap orbs.
TMinimap type¶
Main record used to interact with the Minimap.
Minimap.SetupInterface¶
procedure TMinimap.SetupInterface();
Internal method used to setup the TMinimap type coordinates.
This is automatically called for you on the Minimap variable.
Minimap.Contains¶
function TMinimap.Contains(pt: TPoint): Boolean;
Returns True/False if a point pt is on the minimap.
Example:
WriteLn Minimap.Contains([100,100]);
Minimap.Filter¶
function TMinimap.Filter(tpa: TPointArray): TPointArray;
Returns a TPA of the points from tpa that are within the minimap.
Example:
tpa := TPointArray.CreateFromBox(Minimap.Bounds);
ShowOnTarget(Minimap.Filter(tpa));
Minimap.RandomPoint¶
function TMinimap.RandomPoint(pt: TPoint; randomness: Integer): TPoint;
Generates a random point on the minimap based on the point pt passed.
The distance of this random point will be within randomness amount of distance
from pt.
Example:
while True do
ShowOnTarget(Minimap.RandomPoint(Minimap.Center, 30));
Minimap.Compass¶
The minimap compass refers to the small compass on the top left corner of the minimap:
The following properties are used to read and set the compass angle as both radians and degrees as needed.
Minimap.CompassRadians¶
property TMinimap.CompassRadians: Single;
property TMinimap.CompassRadians(radians: Single): Boolean;
property TMinimap.CompassRadians(minRadians, maxRadians: Single): Boolean;
Returns or sets the minimap compass angle as radians.
The accuracy can be controlled through the Minimap.Compass.Accuracy variable
and it’s value should be in radians. It’s default is aproximately
5º (0.03*PI).
Credits: slacky
Example:
WriteLn Minimap.CompassRadians;
WriteLn Minimap.CompassRadians := PI;
WriteLn Minimap.CompassRadians;
Minimap.CompassDegrees¶
property TMinimap.CompassDegrees: Single;
property TMinimap.CompassDegrees(degrees: Single): Boolean;
property TMinimap.CompassDegrees(minDegrees, maxDegrees: Single): Boolean;
Returns or sets the minimap compass angle as degrees.
The accuracy can be controlled through the Minimap.Compass.Accuracy variable
and it’s value should be in radians. It’s default is aproximately
5º (0.03*PI).
Example:
WriteLn Minimap.CompassDegrees;
WriteLn Minimap.CompassDegrees := 180;
WriteLn Minimap.CompassDegrees;
If you are not sure what the compass refers to, check the image at the end of Minimap.CompassRadians.
Minimap.GetLevel¶
function TMinimap.GetLevel(orb: EMinimapOrb): Integer;
Returns the level of the specified orb.
Example:
WriteLn Minimap.GetLevel(EMinimapOrb.PRAYER);
Minimap.UnderLevel¶
function TMinimap.UnderLevel(orb: EMinimapOrb; level: Integer): Boolean;
Returns true if the level of the specified orb is below the specified level threshold.
Example:
WriteLn Minimap.UnderLevel(EMinimapOrb.PRAYER, 50);
Minimap.OverLevel¶
function TMinimap.OverLevel(orb: EMinimapOrb; level: Integer): Boolean;
Returns true if the level of the specified orb is over the specified level threshold.
Example:
WriteLn Minimap.OverLevel(EMinimapOrb.PRAYER, 50);
Minimap.GetRunEnergy¶
function TMinimap.GetRunEnergy(): Integer;
Returns the remaining run energy.
Example:
WriteLn Minimap.GetRunEnergy();
Minimap.GetHPLevel¶
function TMinimap.GetHPLevel(): Integer;
Returns the remaining hitpoints.
Example:
WriteLn Minimap.GetHPLevel();
Minimap.GetPrayerLevel¶
function TMinimap.GetPrayerLevel(): Integer;
Returns the remaining prayer points.
Example:
WriteLn Minimap.GetPrayerLevel();
Minimap.GetSpecLevel¶
function TMinimap.GetSpecLevel(): Integer;
Returns the remaining special attack level.
Example:
WriteLn Minimap.GetSpecLevel();
Minimap Orbs Statuses and States¶
The following are methods to interact and read information from the Minimap EMinimapOrb enum orbs.
Minimap Status¶
Methods to retrieve Minimap EMinimapOrb enum orbs statuses.
Minimap.HasPoison¶
function TMinimap.HasPoison(): Boolean;
Returns whether the EMinimapOrb.HITPOINTS has the poison status.
Example:
WriteLn Minimap.HasPoison();
Minimap.HasVenom¶
function TMinimap.HasVenom(): Boolean;
Returns whether the EMinimapOrb.HITPOINTS has the venom status.
Example:
WriteLn Minimap.HasVenom();
Minimap.HasStamina¶
function TMinimap.HasStamina(): Boolean;
Returns whether the EMinimapOrb.ENERGY has the stamina status.
Example:
WriteLn Minimap.HasStamina();
Minimap.HasSpecial¶
function TMinimap.HasSpecial(): Boolean;
Returns whether the EMinimapOrb.SPECIAL has the special status, in other
words, whether the current weapon is a special attack weapon or not.
Example:
WriteLn Minimap.HasSpecial();
Minimap States¶
Methods to retrieve Minimap EMinimapOrb enum orbs states.
Minimap.PrayerEnabled¶
function TMinimap.PrayerEnabled(): Boolean;
Returns whether the EMinimapOrb.PRAYER is enabled or not.
Example:
WriteLn Minimap.PrayerEnabled();
Minimap.EnergyEnabled¶
function TMinimap.EnergyEnabled(): Boolean;
Returns whether the EMinimapOrb.ENERGY is enabled or not.
Example:
WriteLn Minimap.EnergyEnabled();
Minimap.SpecialEnabled¶
function TMinimap.SpecialEnabled(): Boolean;
Returns whether the EMinimapOrb.SPECIAL is enabled or not.
Example:
WriteLn Minimap.SpecialEnabled();
Minimap.GetPercent¶
function TMinimap.GetPercent(orb: EMinimapOrb): Integer;
Returns the percent remaining of the specified orb.
Example:
WriteLn Minimap.GetPercent(EMinimapOrb.HITPOINTS);
Minimap.GetHPPercent¶
function TMinimap.GetHPPercent(): Integer;
Returns the percent remaining of hp.
Example:
WriteLn Minimap.GetHPPercent();
Minimap.GetPrayerPercent¶
function TMinimap.GetHPPercent(): Integer;
Returns the percent remaining of prayer.
Example:
WriteLn Minimap.GetPrayerPercent();
Minimap.Toggle¶
function TMinimap.Toggle(orb: EMinimapOrb): Boolean;
Toggles a minimap orb. All orbs can be toggled except EMinimapOrb.HITPOINTS.
Example:
if not Minimap.PrayerEnabled() then
Minimap.Toggle(EMinimapOrb.PRAYER);
Minimap.EnablePrayer¶
function TMinimap.EnablePrayer(): Boolean;
Enable the quick prayer orb.
Minimap.DisablePrayer¶
function TMinimap.DisablePrayer(): Boolean;
Disable the quick prayer orb.
Minimap.CurePoison¶
function TMinimap.CurePoison(): Boolean;
Clicks the health orb.
This cures poison assuming you have potions for it in your Inventory.
Minimap.CureVenom¶
function TMinimap.CureVenom(): Boolean;
Clicks the health orb.
This cures venom assuming you have potions for it in your Inventory.
Minimap.EnableEnergy¶
function TMinimap.EnableEnergy(): Boolean;
Enable the energy orb.
Minimap.DisableEnergy¶
function TMinimap.DisableEnergy(): Boolean;
Disable the energy orb.
Minimap.EnableSpecial¶
function TMinimap.EnableSpecial(level: Integer): Boolean;
Enabled the special attack orb.
Minimap.DisableSpecial¶
function TMinimap.DisableSpecial(): Boolean;
Disable the special attack orb.
Minimap.FindFlag¶
function TMinimap.FindFlag(out pt: TPoint): Boolean;
Returns True/False if the minimap walking flag is visible on the minimap.
pt will return the coordinate where the flag was found.
Example:
if Minimap.FindFlag(flagPt) then
ShowOnTarget(TCircle.Create(flagPt.X, flagPt.Y, 6));
Minimap.HasFlag¶
function TMinimap.HasFlag(): Boolean;
Returns True/False if the minimap walking flag is visible on the minimap.
Same as Minimap.FindFlag() but without the need for parameters.
Example:
WriteLn Minimap.HasFlag();
Minimap.WaitFlag¶
function TMinimap.WaitFlag(time: Integer = 600; interval: Integer = -1): Boolean;
Returns True/False if the minimap walking flag becomes (or already is) visible
within time milliseconds.
Example:
pt := Minimap.RandomPoint(Minimap.Center, 30);
Mouse.Click(pt, EMouseButton.LEFT);
WriteLn Minimap.WaitFlag(2000);
Minimap.CountColor¶
function TMinimap.CountColor(color: TColor; tolerance: Single = 0): Integer;
function TMinimap.CountColor(color: TColorTolerance): Integer; overload;
Counts the specified color on the Minimap.
Example:
WriteLn Minimap.CountColor($FFFFFF);
Minimap.ColorPercent¶
function TMinimap.ColorPercent(color: TColor; tolerance: Single = 0): Single;
function TMinimap.ColorPercent(color: TColorTolerance): Single; overload;
Counts the percentage of the specified color on the Minimap.
Example:
WriteLn Minimap.ColorPercent($FFFFFF);
Minimap.Normalize¶
function TMinimap.Normalize(pt: TPoint; angle: Single): TPoint;
function TMinimap.NormalizeEx(vector: Vector2; angle: Single): Vector2;
Normalizes minimap coordinates to 0º.
Basically, whatever pt or vector you pass into this, will be rotated to it’s
position on the minimap at 0º.
angle should be in radians.
Example:
pt := Minimap.RandomPoint(Minimap.Center, 30);
angle := Minimap.CompassRadians;
pt := Minimap.Normalize(pt, angle);
ShowOnTarget(TCircle.Create(pt.X, pt.Y, 6));
Minimap.GetDots¶
function TMinimap._GetDots(dot: EDot; img: TImage; offset: TPoint): TPointArray;
function TMinimap.GetDots(dot: EDot; bounds: TBox): TPointArray;
function TMinimap.GetDots(dot: EDot): TPointArray; overload;
function TMinimap.GetDots(dots: EDots; bounds: TBox): TDotArray; overload;
function TMinimap.GetDots(dots: EDots = [EDot.PLAYER, EDot.NPC, EDot.ITEM]): TDotArray; overload;
Returns minimap dots found.
You can specify which dots you want to look for in dot or dots.
You can also optionalyl specify bounds to returns minimap dots from just a region of the minimap.
For example, this is how you can find NPC dots and debug them:
{$I WaspLib/main.simba}
var
pt: TPoint;
boxes: TBoxArray;
begin
for pt in Minimap.GetDots(EDot.NPC) do
boxes += TBox.Create(pt, 3, 3);
ShowOnTarget(boxes);
end.
Your result should look something like this on the minimap:
Finding minimap dots accurately is quite complex as they can overlap each other and the way WaspLib does it is not perfect.
It basically comes down to whether you want a simple solution that people can reason with or something complex that does it accurately. WaspLib goes with the first option.
This means that depending on the type of EDot you are trying to
find and the EClient you are using, you might get 2 TPoints per dot.
This is because the way it works is as follows:
We try to find the 2 bottom center pixels (blue square on the image below)
These 2 pixels are always guaranteed to be visible and any other combination of pixels can be covered by other dots overlapping when there’s too many
When we find those 2 pixels, we return the top left center pixel of the dot (green cross below)
However, with EDot.PLAYER and every dot on EClient.OFFICIAL you
have the following issue:
The 2 bottom center pixels are not unique anymore which makes it so you get 2 points returned per dot (the 2 green crosses)
So do have that in mind when writing your scripts.
Minimap.GetCleanMask¶
function TMinimap.GetCleanMask(img: TImage): TPointArray;
Returns a TPA of a mask to clean the minimap.
Minimap.CleanImage¶
function TMinimap.CleanImage(img: TImage; radius: Integer): TImage;
Cleans a TImage of the Minimap you pass into it. “Clean” means that minimap dots, the running flag and a few other things are removed and the colors around it will be blended in.
The image i
Example:
{$I WaspLib/main.simba}
var
before, after, combined: TImage;
begin
before := Target.GetImage(Minimap.Bounds);
after := Minimap.CleanImage(before.Copy(), 65);
combined := new TImage(before.Width*2, before.Height);
combined.DrawImage(before, [0,0]);
combined.DrawImage(after, [before.Width+1, 0]);
combined.Show();
end.
Minimap.GetCleanImage¶
function TMinimap.GetCleanImage(angle: Single = $FFFF; radius: Integer = -1): TImage;
Returns a clean TImage of the Minimap.
Read Minimap.CleanImage for more information.
Unlike Minimap.CleanImage, the TImage returned is rotated to 0º as you
can see in the following example:
{$I WaspLib/main.simba}
var
img: TImage;
begin
while True do
begin
img := Minimap.GetCleanImage();
img.Show();
end;
end.
Minimap.ScaleMinimap¶
function TMinimap.ScaleMinimap(img: TImage; scaling: Integer; radius: Integer = -1): TImage;
Scales down a minimap TImage passed in the img parameter.
Example:
{$I WaspLib/main.simba}
var
img, downscaled: TImage;
begin
img := Minimap.GetCleanImage();
downscaled := Minimap.ScaleMinimap(img, 4);
downscaled.Show();
end.
And this should be the result you see:
As you can see, it’s pretty small, if we zoom it in 800% it should look something like this:
Minimap.IsPlayerMoving¶
function TMinimap.IsPlayerMoving(minShift: Integer = 500): Boolean;
Returns whether the player is moving or not according to the specified minimum pixel shift.
Example:
WriteLn Minimap.IsPlayerMoving();
Minimap.WaitMoving¶
procedure TMinimap.WaitMoving(time: Integer = 20000; minShift: Integer = 500);
To put it simply, waits time milliseconds for Minimap.IsPlayerMoving to
return false with the specified minShift.
Example:
WriteLn Minimap.WaitMoving();
Minimap variable¶
Global TMinimap type variable.