# Minimap Methods to interact with the minimap. ```{figure} ../../images/minimap.png The minimap interface. ``` - - - ## ERSMinimapDots ```pascal ERSMinimapDot = enum(PLAYER, NPC, ITEM); ``` Enum representing the available minimap dots. - - - ## ERSMinimapOrb ```pascal ERSMinimapOrb = enum(HITPOINTS, PRAYER, ENERGY, SPECIAL); ``` Enum representing the 4 available minimap orbs. - - - ## TRSMinimap Main record used to interact with the {ref}`Minimap`. - - - ## Minimap.SetupInterface ```pascal procedure TRSMinimap.SetupInterface(); ``` Internal method used to setup the {ref}`TRSMinimap` coordinates. This is automatically called for you on the {ref}`Minimap variable`. - - - ## Minimap.Contains ```pascal function TRSMinimap.Contains(pt: TPoint): Boolean; ``` Returns True/False if a point `pt` is on the minimap. Example: ```pascal WriteLn Minimap.Contains([100,100]); ``` - - - ## Minimap.Filter ```pascal function TRSMinimap.Filter(tpa: TPointArray): TPointArray; ``` Returns a TPA of the points from `tpa` that are within the minimap. Example: ```pascal tpa := TPointArray.CreateFromBox(Minimap.Bounds); ShowOnTarget(Minimap.Filter(tpa)); ``` - - - ## Minimap.RandomPoint ```pascal function TRSMinimap.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: ```pascal while True do ShowOnTarget(Minimap.RandomPoint(Minimap.Center, 30)); ``` - - - ## Minimap.GetCompassAngle ```pascal function TRSMinimap.GetCompassAngle(asDegrees: Boolean = True): Single; ``` Returns the minimap compass angle either in radians or degrees. By default, degrees are used. Credits: [slacky](https://slacky.one/) Example: ```pascal WriteLn Minimap.GetCompassAngle(); ``` - - - ## Minimap.SetCompassAngle ```pascal function TRSMinimap.SetCompassAngleEx(degrees, accuracy: Single): Boolean; function TRSMinimap.SetCompassAngle(degrees: Single): Boolean; function TRSMinimap.SetCompassAngle(minDegrees, maxDegrees: Single; accuracy: Single = 5): Boolean; overload; ``` Sets the current compass angle. If you specify a minimum and a maximum angle a gaussian distribution will be used. Example: ```pascal Minimap.SetCompassAngle(180); ``` - - - ## Minimap.GetLevel ```pascal function TRSMinimap.GetLevel(orb: ERSMinimapOrb): Integer; ``` Returns the level of the specified `orb`. Example: ```pascal WriteLn Minimap.GetLevel(ERSMinimapOrb.PRAYER); ``` - - - ## Minimap.UnderLevel ```pascal function TRSMinimap.UnderLevel(orb: ERSMinimapOrb; level: Integer): Boolean; ``` Returns true if the level of the specified `orb` is below the specified `level` threshold. Example: ```pascal WriteLn Minimap.UnderLevel(ERSMinimapOrb.PRAYER, 50); ``` - - - ## Minimap.OverLevel ```pascal function TRSMinimap.OverLevel(orb: ERSMinimapOrb; level: Integer): Boolean; ``` Returns true if the level of the specified `orb` is over the specified `level` threshold. Example: ```pascal WriteLn Minimap.OverLevel(ERSMinimapOrb.PRAYER, 50); ``` - - - ## Minimap Orb Status ```pascal function TRSMinimap.Poisoned(): Boolean; function TRSMinimap.Envenomed(): Boolean; function TRSMinimap.RunEnabled(): Boolean; function TRSMinimap.HasStamina(): Boolean; function TRSMinimap.PrayerEnabled(): Boolean; function TRSMinimap.SpecialEnabled(): Boolean; function TRSMinimap.HasSpecialWeapon(): Boolean; ``` Returns a status from a minimap orb. Example: ```pascal WriteLn Minimap.Poisoned(); ``` - - - ## Minimap.GetPercent ```pascal function TRSMinimap.GetPercent(orb: ERSMinimapOrb): Integer; ``` Returns the percent remaining of the specified `orb`. Example: ```pascal WriteLn Minimap.GetPercent(ERSMinimapOrb.HITPOINTS); ``` - - - ## Minimap.Toggle ```pascal function TRSMinimap.Toggle(orb: ERSMinimapOrb): Boolean; ``` Toggles a minimap orb. All orbs can be toggled except `ERSMinimapOrb.HITPOINTS`. Example: ```pascal if not Minimap.PrayerEnabled() then Minimap.Toggle(ERSMinimapOrb.PRAYER); ``` - - - ## Minimap.FindFlag ```pascal function TRSMinimap.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: ```pascal if Minimap.FindFlag(flagPt) then ShowOnTarget(TCircle.Create(flagPt.X, flagPt.Y, 6)); ``` - - - ## Minimap.HasFlag ```pascal function TRSMinimap.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: ```pascal WriteLn Minimap.HasFlag(); ``` - - - ## Minimap.WaitFlag ```pascal function TRSMinimap.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: ```pascal pt := Minimap.RandomPoint(Minimap.Center, 30); Mouse.Click(pt, EMouseButton.LEFT); WriteLn Minimap.WaitFlag(2000); ``` - - - ## Minimap.Normalize ```pascal function TRSMinimap.Normalize(pt: TPoint; angle: Single): TPoint; function TRSMinimap.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: ```pascal pt := Minimap.RandomPoint(Minimap.Center, 30); angle := Minimap.GetCompassAngle(False); pt := Minimap.Normalize(pt, angle); ShowOnTarget(TCircle.Create(pt.X, pt.Y, 6)); ``` - - - ## Minimap.GetDots ```pascal function TRSMinimap.GetDots(dot: ERSMinimapDot; bounds: TBox): TPointArray; function TRSMinimap.GetDots(dot: ERSMinimapDot): TPointArray; overload; function TRSMinimap.GetDots(dots: ERSMinimapDots; bounds: TBox): TRSMinimapDotArray; overload; function TRSMinimap.GetDots(dots: ERSMinimapDots = [ERSMinimapDot.PLAYER, ERSMinimapDot.NPC, ERSMinimapDot.ITEM]): TRSMinimapDotArray; 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. Example: ```pascal tpa := Minimap.GetDots(ERSMinimapDot.NPC); for pt in tpa do boxes += TBox.Create(pt, 6, 6); ShowOnTarget(boxes); ``` - - - ## Minimap.CleanImage ```pascal function TRSMinimap.CleanImage(img: TImage): TImage; ``` Cleans a TImage of the minimap you pass into it. "Clean" means that minimap dots are removed and the colors around it will be blended in. Example: ```pascal rawIMG := Target.GetImage(Minimap.Bounds); cleanIMG := Minimap.CleanImage(rawIMG); rawIMG.Free(); cleanIMG.Show(); cleanIMG.Free(); ``` - - - ## Minimap.GetCleanImage ```pascal function TRSMinimap.GetCleanImage(angle: Single = $FFFF): TImage; ``` Returns a clean TImage of the minimap. Read `Minimap.CleanImage()` for more information. The image returns is also rotated to 0º. Example: ```pascal img := Minimap.GetCleanImage(); img.Show(); img.Free(); ``` - - - ## Minimap.ScaleMinimap ```pascal function TRSMinimap.ScaleMinimap(img: TImage; scaling: Integer; radius: Integer = 67): TImage; ``` Scales down a minimap TImage passed in the `img` parameter. Example: ```pascal cleanIMG := TImage.GetCleanImage(); scaledIMG := Minimap.ScaleMinimap(cleanIMG, 4); cleanIMG.Free(); scaledIMG.Show(); scaledIMG.Free(); ``` - - - ## Minimap.IsPlayerMoving ```pascal function TRSMinimap.IsPlayerMoving(minShift: Integer = 500): Boolean; ``` Returns whether the player is moving or not according to the specified minimum pixel shift. Example: ```pascal WriteLn Minimap.IsPlayerMoving(); ``` - - - ## Minimap variable Global {ref}`TRSMinimap` variable.