Minimap

The minimap file holds all SRL’s functions that interact with the Runescape minimap.

The source for this file can be found here.

Consts, Types, Vars

The following constants, types and variables are used throughout the bankScreen methods.

const Angles

Constants that represent the N, S, E, W directions on the compass.

  • MM_DIRECTION_NORTH
  • MM_DIRECTION_EAST
  • MM_DIRECTION_SOUTH
  • MM_DIRECTION_WEST

const Minimap Dots

Constants representing the different dots that appear on the minimap. Developer note: Each value represents the difference between the two bottom colored pixels of each dot.

  • MM_DOT_NPC
  • MM_DOT_ITEM
  • MM_DOT_PLAYER
  • MM_DOT_FRIEND
  • MM_DOT_TEAM

const Symbols

Constants representing all the Runescape symbols.

Shops

  • MM_SYMBOL_SHOP_ARCHERY
  • MM_SYMBOL_SHOP_AXE
  • MM_SYMBOL_SHOP_CANDLE
  • MM_SYMBOL_SHOP_CLOTHES
  • MM_SYMBOL_SHOP_COOKERY
  • MM_SYMBOL_SHOP_CRAFTING
  • MM_SYMBOL_SHOP_FARMING
  • MM_SYMBOL_SHOP_FISHING
  • MM_SYMBOL_SHOP_FOOD
  • MM_SYMBOL_SHOP_HUNTER
  • MM_SYMBOL_SHOP_KEBAB
  • MM_SYMBOL_SHOP_MACE
  • MM_SYMBOL_SHOP_MAGIC
  • MM_SYMBOL_SHOP_PET
  • MM_SYMBOL_SHOP_PLATEBODY
  • MM_SYMBOL_SHOP_PLATESKIRT
  • MM_SYMBOL_SHOP_SCIMITAR
  • MM_SYMBOL_SHOP_SHIELD
  • MM_SYMBOL_SHOP_MINING
  • MM_SYMBOL_SHOP_SWORD
  • MM_SYMBOL_SHOP_STAFF
  • MM_SYMBOL_SHOP_SUMMONING

Stalls

  • MM_SYMBOL_STALL_SPICE
  • MM_SYMBOL_STALL_GEM
  • MM_SYMBOL_STALL_SILK
  • MM_SYMBOL_STALL_SILVER

Skills & Objects

  • MM_SYMBOL_TREE
  • MM_SYMBOL_FARMING
  • MM_SYMBOL_FISHING
  • MM_SYMBOL_RUNECRAFTING
  • MM_SYMBOL_HUNTING
  • MM_SYMBOL_HOUSE
  • MM_SYMBOL_POTTERY
  • MM_SYMBOL_MINING
  • MM_SYMBOL_JEWELERY
  • MM_SYMBOL_SLAYER_CONTRACT
  • MM_SYMBOL_SLAYER_MASTER
  • MM_SYMBOL_HERBALIST
  • MM_SYMBOL_WHEEL
  • MM_SYMBOL_OBELISK
  • MM_SYMBOL_TANNER
  • MM_SYMBOL_TRAINING_DUMMY
  • MM_SYMBOL_STORE
  • MM_SYMBOL_SHORTCUT
  • MM_SYMBOL_WEAVE
  • MM_SYMBOL_COOKING_RANGE
  • MM_SYMBOL_AGILITY
  • MM_SYMBOL_FURNACE
  • MM_SYMBOL_ALTAR
  • MM_SYMBOL_ANVIL
  • MM_SYMBOL_APOTHECARY
  • MM_SYMBOL_ARROW
  • MM_SYMBOL_BAR
  • MM_SYMBOL_BANK
  • MM_SYMBOL_LODESTONE
  • MM_SYMBOL_CHURN
  • MM_SYMBOL_DUNGEON
  • MM_SYMBOL_TRADER_FUR
  • MM_SYMBOL_SPOT_REST
  • MM_SYMBOL_GUIDE
  • MM_SYMBOL_HAIR_DRESSER
  • MM_SYMBOL_MAKEOVER_MAGE
  • MM_SYMBOL_MILL
  • MM_SYMBOL_MINIGAME
  • MM_SYMBOL_OBELISK_MINI
  • MM_SYMBOL_PORTAL
  • MM_SYMBOL_QUEST
  • MM_SYMBOL_WINDMILL
  • MM_SYMBOL_SAND
  • MM_SYMBOL_SAWMILL
  • MM_SYMBOL_TRANSPORTATION
  • MM_SYMBOL_UNDERGROUND
  • MM_SYMBOL_WATER
  • MM_SYMBOL_DIVINATION
  • MM_SYMBOL_SEASONAL_EVENT

const Buttons

Constants representing the minimap buttons.

  • MM_BUTTON_COMPASS
  • MM_BUTTON_RUN
  • MM_BUTTON_LODESTONE
  • MM_BUTTON_MAP

type TRSMinimap

type
  TRSMinimap = type TRSInterface;

A type that stores the minimap interface properties.

var minimap

var
  minimap: TRSMinimap;

A variable through which scripters can access the TRSMinimap type methods.

TRSMinimap methods

The following methods should be called through the minimap variable.

Example:

a := minimap.getAngleDegrees();

getAngleRadians

function TRSMinimap.getAngleRadians(): extended;

Returns the compass angle in radians.

Note

  • by Olly
  • Last Updated: 28 October 2014 by Olly

Example:

var
  angle: extended;
begin
  angle := minimap.getAngleRadians();
  writeLn(angle);

getAngleDegrees

function TRSMinimap.getAngleDegrees(): extended;

Returns the compass angle in degrees.

Note

  • by Wizzup?
  • Last Updated: 23 May 2013 by Coh3n

Example:

var
  angle: extended;
begin
  angle := round(minimap.getAngleDegrees());
  writeLn(angle);

setAngle

function TRSMinimap.setAngle(angleDegrees: integer): boolean;

Returns true if it rotates the compass angle to angleDegrees . You can use the angle constants at the top of this page, or any other angle.

Note

  • by nielsie95 & Nava2
  • Last Updated: 23 May 2013 by Coh3n

Example:

minimap.setAngle(MM_DIRECTION_SOUTH);

mouseOffCompass

procedure TRSMinimap.mouseOffCompass();

Moves the mouse off of the compass. This is because the dial vanishes when the mouse of on the compass.

Note

  • by Olly
  • Last Modified: 6 November 2014 by Ashaman88

Example:

minimap.mouseOffCompass();

clickCompass

procedure TRSMinimap.clickCompass(faceSouth: boolean = false);

Clicks the Runescape compass to set the angle to north. If faceSouth is true, it will right click and make the compass south (default = false)

Note

  • by Olly
  • Last Modified: 12 March 2015 by The Mayor

Example:

minimap.clickCompass();
minimap.clickCompass(true); // To face south

isPointOn

function TRSMinimap.isPointOn(p: TPoint): boolean;

Returns true if the point p is on the minimap

Note

  • by Olly
  • Last Updated: 09 October 2013 by Olly

Example:

if minimap.isPointOn(someRandomPoint) then
  writeln('Point is on the minimap!');

findDTM

function TRSMinimap.findDTM(dtm: integer; var x, y: integer): boolean;

Returns true if it finds the DTM DTM on the minimap. It will search +/- 15 degrees of the current minimap angle. It will pass the coordinates for the first DTM it finds to x and y.

Note

  • by Olly
  • Last Updated: 15 August 2013 by Olly

Example:

var
  x, y, dtm: Integer;
begin
  dtm := DTMFromString('heapsoftext');

  if minimap.findDTM(dtm, x, y) then
    mouse(point(x, y), MOUSE_LEFT);

findDTMs

function TRSMinimap.findDTMs(dtm: integer; out points: TPointArray): boolean;

Returns true if it finds the DTM DTM on the minimap. It will search +/- 15 degrees of the current minimap angle. It will pass the midpoints of all the DTMs it finds to points

Note

  • by Olly
  • Last Updated: 15 August 2013 by Olly

Example:

if minimap.findDTMs(dtm, tpa) then
  writeln('Found at least one DTM match!);

getDots

function TRSMinimap.getDots(const dotType: Integer; const searchBox: TBox; const Tol: Byte = 55): TPointArray;

Returns all minimap dots inside searchBox that match the dot type dotType You can optionally adjust the tolerance tol (default = 55)

Note

  • by Olly
  • Last Updated: 6 September 2014 by Olly

Example:

atpa := minimap.getAllPossibleDots(bmp);

getColorPercent

function TRSMinimap.getColorPercent(color, tolerance: integer): extended;

Returns the percentage of the minimap occupied by color with tolerance

Note

  • by Olly
  • Last Updated: 08 August 2013 by Olly

Example:

per := minimap.getColorPercent(123456, 12);

getBlackBackground

function TRSMinimap.getBlackBackground(): integer;

Get’s the most common black color that appears on the minimap. Useful for dungeons and upper stories of buildings.

Note

  • by ZephyrsFury
  • Last Updated: 23 May 2013 by Coh3n

Example:

var
  blackColor: integer;
begin
  blackColor := minimap.getBlackBackground();
  if minimap.getColorPercent(blackColor, 0) > 50% then
    writeLn('We are inside the dungeon!');

filterPoints

procedure TRSMinimap.filterPoints(var tpa: TPointArray);

Removes all the points in the tpa tpa that are not on the actual map area.

Note

  • by Olly
  • Last Updated: 09 October 2013 by Olly

Example:

begin
  findColors(tpa, clWhite, minimap.getBounds());
  minimap.filterPoints(tpa);

  writeln('We found ' + intToStr(length(tpa)) + 'points on the map!');
end;

isFlagPresent

function TRSMinimap.isFlagPresent(var p: TPoint): boolean;

Returns true if the flag is present on the minimap. If found, it’s coordinates are passed to p

Note

  • by Home
  • Last Updated: 29 July 2013 by Olly

Example:

if minimap.isFlagPresent(p) then
  writeln('Flag is present');

isFlagPresent (overload)

function TRSMinimap.isFlagPresent(waitTime: integer = 0): boolean; overload;

This overload returns trueif the flag is present on the minimap within waitTime (default = 0)

Note

  • by Coh3n
  • Last Updated: 1 August 2013 by Olly

Example:

if (minimap.isFlagPresent(2000)) then
  writeln('Flag is present');

getFlagDistance

function TRSMinimap.getFlagDistance(): integer;

Returns the distance from the player (i.e. the center of the minimap) to the flag. Returns -1 if the flag isn’t present.

Note

  • by weequ
  • Last Updated: 23 May 2013 by Coh3n

Example:

dist := minimap.getFlagDistance();

waitFlag

function TRSMinimap.waitFlag(dist: integer = 0): boolean;

Returns true the player is within dist of the flag within 20 seconds.

Note

  • by Nava2
  • Last Updated: 23 May 2013 by Coh3n

Example:

minimap.waitFlag(10);

isPlayerMoving

function TRSMinimap.isPlayerMoving(shiftInterval: integer = 500): boolean;

Returns true if the player is moving (i.e. walking or running). If the pixel shift of the minimap across shiftInterval (default = 500) is > 200, it returns true.

Note

  • by marpis
  • Last Updated: 23 May 2013 by Coh3n

Example:

if (minimap.isPlayerMoving()) then
  writeln('Player is moving!');

waitPlayerMoving

function TRSMinimap.waitPlayerMoving(shiftInterval: integer; maxTime: integer = 20000): boolean;

Returns true if the player has stopped moving within maxTime (default = 20000)

Note

  • by marpis
  • Last Updated: 23 May 2013 by Coh3n

Example:

if minimap.waitPlayerMoving() then
  writeLn('We are no longer moving');

radialWalk

function TRSMinimap.radialWalk(theColor, tol, radius, startRadial, endRadial: integer; flagDist: integer = 0): boolean;
Walks the player to the furthest point found within the given parameters.
  • theColor : The color to look for.
  • tol : The tolerance on “theColor”.
  • radius : The maximum radius to look for the color. Should be less than MM_RADIUS.
  • startRadial : The degree value to start looking for the color.
  • endRadial : The degree value to stop looking for the color.
  • flagDist : Optional. The minimum flag distance from the player. (Default = 0)

Note

  • by nielsie95 & NCDS
  • Last Updated: 23 May 2013 by Coh3n

Example:

minimap.radialWalk(834782, 10, 100, 45, 135, 10);

tpaWalk

function TRSMinimap.tpaWalk(color, tol: integer; sortFrom: TPoint; flagDist: integer; offset: TPoint = point(0, 0)): boolean;

Uses a simple TPA sorting method to walk to a spot on the minimap. Returns true if walked successfully.

  • color : The color to be found on the minimap.
  • tol : The tolerance on color.
  • sortFrom : The point on the minimap to sort found colors from.
  • flagDist : The minimum flag distance from the player.
  • offset : Optional. The offset coordinates on the point that’s clicked.

Note

  • by Coh3n
  • Last Updated: 23 May 2013 by Coh3n

Example:

minimap.tpaWalk(288937, 10, point(minimap.x2, minimap.y1), 10);

findSymbols

function TRSMinimap.FindSymbols(const Symbols: TIntegerArray; const SearchArea: TBox; out FSymbols: TFoundSymbols; FindOne: Boolean = False): Boolean; overload;

Searches for multiple mumumap symbols and returns true if at least one is found.

  • Symbols An array of MM symbols
  • SearchArea The TBox ti search
  • FSymbols All symbol info (pos, accuracy, point) is stored in this
  • FindOne If true, will only find 1 of each symbol (default = false)

Note

  • by Olly
  • Last Updated: 10 September 2014 by Olly

Example:

procedure Test_Symbols();
var
  Symbols: TFoundSymbols;
  i: Integer;
begin
  Minimap.FindSymbols([MM_SYMBOL_BANK, MM_SYMBOL_DUNGEON, MM_SYMBOL_FISHING], Minimap.getBounds(), Symbols, False);

  for i := 0 to High(Symbols) do
  begin
    WriteLn('Found symbol: ' + toStr(Symbols[i].ID));
    smartImage.drawCircle(Symbols[i].Pos, 7, False, clLime);
    smartImage.drawCross(Symbols[i].Pos, 5, clLime);
    Writeln(Symbols[i].Acc);
  end;
end;

findSymbols (overload 1)

function TRSMinimap.findSymbols(var tpa: TPointArray; symbol: integer; searchBox: TBox): boolean; overload;

Returns true if one or more of symbol is found within searchBox The midpoints of all symbols that are found are passed to tpa .

Note

  • by lordsaturn
  • Last Updated: 23 May 2013 by Coh3n

Example:

var
  tpa: TPointArray;
begin
  symbols := minimap.findSymbols(tpa, MM_SYMBOL_FISHING, myCustomBox);
  symbols.sortFromPoint(minimap.getCenterPoint());
  mouse(tpa[high(tpa)], MOUSE_LEFT);  // Click farthest

findSymbols (overload 2)

function TRSMinimap.findSymbols(var tpa: TPointArray; symbols: TIntegerArray; searchBox: TBox): boolean; overload;

Same as overload 1, except it can take multiple symbols in symbols .. note:

- by Nava2 & NCDS
- Last Updated: 23 May 2013 by Coh3n

Example:

symbols := minimap.findSymbols(tpa, [MM_SYMBOL_BANK, MM_SYMBOL_FISHING], minimap.getBounds());

findSymbol

function TRSMinimap.findSymbol(var p: TPoint; symbol: integer; searchBox: TBox): boolean;

Returns true if the symbol is found within searchBox If the symbol is found, its midpoint is passed to p .

Note

  • by Stupid3ooo
  • Last Updated: 23 May 2013 by Coh3n

Example:

var
  p: TPoint;
begin
  if minimap.findSymbol(p, MM_SYMBOL_BANK, minimap.getBounds()) then
  begin
    writeln('Found bank symbol');
    mouse(p, MOUSE_LEFT);
    minimap.waitFlag(10);
  end;
end;

isResting

function TRSMinimap.isResting(): boolean;

Returns true if the player is resting.

Note

  • by Olly
  • Last Updated: 08 August 2013 by Olly

Example:

if minimap.isResting() then
  writeln('We are resting!');

enableRest

function TRSMinimap.enableRest(): Boolean;

Returns true if it successfully right clicks the run button and enables rest.

Note

  • by The Mayor
  • Last Updated: 07 December 2014 by The Mayor

Example:

if minimap.enableRest() then
  writeln('We are now resting');

getRunEnergy

function TRSMinimap.getRunEnergy(): Int32;

Returns the players current run energy.

Note

  • by slacky
  • Last Updated: 28 Feb. 2015

Example:

if minimap.getRunEnergy() < 20 then
  minimap.enableRest();

isRunEnabled

function TRSMinimap.isRunEnabled(): boolean;

Returns true if the players run is enabled.

Note

  • by Olly
  • Last Updated: 08 August 2013 by Olly

Example:

if minimap.isRunEnabled() then
  writeln('Sup kid? I''m Usain Bolt. Prep2BRekt m8');

toggleRun

procedure TRSMinimap.toggleRun(enable: boolean);

Returns true if it enables of disables run, depending on the enable parameter.

Note

  • by Olly
  • Last Updated: 08 August 2013 by Olly

Example:

minimap.toggleRun(true);

toggleRun (overload)

procedure TRSMinimap.toggleRun(minRunPercent: integer); overload;

Enables run only if the current run energy is above minRunPercent . This procedure hasn’t beed coded yet because it requires getRunEnergy (see above).

Note

  • by Olly
  • Last Updated: 08 August 2013 by Olly

Example:

minimap.toggleRun(50);

pointToMainscreen

function TRSMinimap.pointToMainscreen(const point: TPoint): TPoint;

Converts a point on the minimap to a point on the mainscreen

Note

  • by Narcle
  • Last Updated: 21 November 2013 by Olly

Example:

p := minimap.pointToMainscreen(minimap.getCenterPoint());

pointsToMainscreen

function TRSMinimap.pointsToMainscreen(points: TPointArray; sortFromPlayer: boolean = true): TPointArray;

Converts a tpa points on the minimap to mainscreen points. It will delete points that aren’t on the mainscreen. The TPA that is returned is sorted from the player by default.

Note

  • by Narcle
  • Last Updated: 21 November 2013 by Olly

Example:

tpa := minimap.pointsToMainscreen(mmDots);