Mapwalk

The Mapwalk include contains all Mapwalking functions

RoadColors

var RoadColors: TIntegerArray;

Global record containing all roadcolors collected during runtime.

Note

by SRL Dev Team

variantDirection

function variantToDirection(dir: Variant): Extended;

Converts a variant to a direction, catching errors and attempts to fix. This function expects “compass relative” angles. For example: (‘n’, ‘s’, ‘e’, ‘w’) or degree (23.3, 25, 205.2) or ‘random’ (returns 0..360).

Note

by Nava2

Example:

dir := variantToDirection('n');     // -> 0.0
dir := variantToDirection('rand');  // -> in range 0..360
dir := variantToDirection(50);      // -> 50

MakeCompass

function MakeCompass(Direction: Variant): Boolean;
Aligns RS to specified direction
  • Enter a compass angle (‘n’, ‘s’, ‘e’, ‘w’) or degree (23.3, 25, 205.2)

    and it will move the compass to that angle. Also accepts ‘random’, and ‘rand’ to make the compass a random direction.

Note

by Nielsie95 & Nava2

Example:

// using a string!
MakeCompass('N');

// using an integer!
MakeCompass(0);

SetAngle

procedure SetAngle(Angle: Integer);

Sets the mainscreen at highestlowest angle, dependant on constant passed.

Note

by Raymond, edit by NaumanAkhlaQ

Example:

// make the camera the highest!
SetAngle(True);

ClickNorth

procedure ClickNorth(AngleHigh: Integer);

Clicks the compass to make it perfect North. Will set angle at highest depending on AngleHigh. See SetAngle for more information on the Angle parameter.

Note

by R1ch

Example:

procedure MapWalk();
begin
  ClickNorth(SRL_ANGLE_NONE);
  //...

GetWallAngle

Function GetWallAngle(Ps: TPointArray): Extended;

Get’s the Minimap angle using Walls. Returns Angle in Radians. Used in Maze.scar, but feel free to use for Perfect map aligning projects.

Note

by Wizzup?

Example:

RunAway

procedure RunAway(dir: string; RunFar: Boolean; Action, WaitTime: Integer);
  • Runs away in minimap related direction, based on north.

  • Dir can be ‘N’, ‘E’, ‘S’, ‘W’ or an angle in degrees (145, 93, 180, etc).

  • RunFar will run further than normal.

  • Action can be either 1, 2 or 3:

    1. RunAway + Wait(WaitTime) + RunBack
    2. RunAway + Wait(WaitTime)
    3. RunBack

Note

WaitTime is in milliseconds!

Note

by nielsie95 modified by ZephyrsFury

Example:

if (FindFight()) then
begin
  WriteLn('We are in a fight!');
  RunAway('n', True, 1, 2000);
end;

StoreToRoadColorArray

procedure StoreToRoadColorArray;

Stores RoadColor to an array. Debugging and logging purposes.

Note

by Wizzup? / WT-Fakawi, rewritten by EvilChicken!

Example:

GetOldRoadColors

function GetOldRoadColors: Boolean;

Checks if RoadColor matches with any color stored in RoadColors array. If successful, it sets the roadcolor.

Note

by Wizzup? / WT-Fakawi, edited by EvilChicken!

Example:

GetNewRoadColor

function GetNewRoadColor(xs, ys, xe, ye, tol: Integer): Boolean;

Searches for new RoadColor in box xs, ys, xe, ye by comparing all the colors found within box against current RoadColor.

Note

by Wizzup?/WT-Fakawi, edited by Ron & EvilChicken!

Example:

RoadColorChecker

function RoadColorChecker: Boolean;

Checks for presence of RoadColor. If none is found, it will try various methods to find it. If successful, it sets RoadColor to the new color.

Note

by Wizzup?/WT-Fakawi, edited by Ron & EvilChicken!

Example:

LinearWalkEx

function LinearWalkEx(var TPA: TPointArray; cx, cy, TheColor, tol: Integer; Direction: Variant; Radius: Integer): Boolean;

Finds TheColor from Radial (scanning outwards) for Radius Distance. Valid Arguments:

  • tpa. Result points.
  • Direction. See variantToDirection for information
  • Radius. Distance from the centre of minimap, i.e. how far away the mouse clicks. Use numbers 20-72

Note

by Nielsie95

Example:

// check if the colour is present
while (FindColor(x,y, RoadColor)) do
begin
  // build a tpa to walk on
  if (LinearWalkEx(tpa, MMCX, MMCY, RoadColor, 5, -25.0, (MMX1-MMCX))) then
    WalkTPA(tpa);          // this depends how you want to work with the tpa
end;

RadialWalkEx

function RadialWalkEx(var TPA: TPointArray; cx, cy, TheColor, tol: Integer; StartRadial, EndRadial: Variant; Radius: Integer): Boolean;

Finds TheColor from StartRadial to EndRadial for Radius Distance. Valid Arguments:

  • tpa. Result points.
  • StartRadial/EndRadial. See variantToDirection for information
  • Radius. Distance from the centre of minimap, i.e. how far away the mouse clicks. Use numbers 20-72

Note

by Nielsie95

Example:

// check if the colour is present
while (FindColor(x,y, RoadColor)) do
begin
  // build a tpa to walk on
  if (RadialWalkEx(tpa, MMCX, MMCY, RoadColor, 5, -25.0, (MMX1-MMCX))) then
    WalkTPA(tpa);          // this depends how you want to work with the tpa
end;

RadialWalk

function RadialWalk(TheColor: Integer; StartRadial, EndRadial: Variant; Radius, Xmod, Ymod: Integer): Boolean;

Walks TheColor from StartRadial to EndRadial for Radius Distance Valid Arguments:

  • TheColor. Any Color, but Road- or WaterColor will do fine :)
  • StartRadial/EndRadial. See variantToDirection for information
  • Radius. Distance from the centre of minimap, i.e. how far away the mouse clicks. Use numbers 20-72
  • XMod, YMod: deviation from MouseFindFlag. -2 to 2.

Note

by Nielsie95 from an original idea by WT-Fakawi

Example:

while (RadialWalk(GetRoadColor, 'w', 'n', 50, -1, 2)) do
  WriteLn('Walking in a ''pie'' shape!');

LinearWalk

function LinearWalk(TheColor: Integer; Direction: Variant; Radius, Xmod, Ymod: Integer): Boolean;

Walks TheColor from Direction MIDDLE OUT!by performing windscreenlike scanning movements for Radius Distance Valid Arguments:

  • TheColor. Any Color, but Road- or WaterColor will do fine :)
  • Direction. See variantToDirection for information
  • Radius. Distance from the centre of minimap, i.e. how far away the mouse clicks. Use numbers 20-72.
  • XMod, YMod: deviation from MouseFindFlag. -2 to 2.

Note

by Nielsie95 from another original idea by WT-Fakawi

Example:

while (LinearWalk(GetRoadColor, 25.5, 50, -1, 2)) do
  WriteLn('Walking in a ''line''!');

LinearWalkTolerance

function LinearWalkTolerance(TheColor: Integer; Direction: Variant; Radius, Xmod, Ymod, Tol : Integer): Boolean;

Same as LinearWalk, but with a tolerance.

Note

by Nielsie95

Example:

while (LinearWalkTolerance(clRed, 25.5, 50, -1, 2, 5)) do
  WriteLn('Walking in a ''line''... with tolerance!');

RadialRoadWalk

function RadialRoadWalk(TheColor, StartRadial, EndRadial, Radius, Xmod, Ymod: Integer): Boolean;

Walks TheColor from StartRadial to EndRadial for Radius Distance Valid Arguments:

  • TheColor. RoadColor. RoadColor will be dynamically updated.
  • StartRadial/EndRadial. Any number between 0-720. 0=N,90=E,180=S,270=W.
  • Radius. Distance from the centre of minimap, i.e. how far away the mouse clicks. Use numbers 20-72 XMod, YMod: deviation from MouseFindFlag. -2 to 2.

Note

by WT-Fakawi?

Example:

RadialWalkTolerance

function RadialWalkTolerance(Color: Integer; sRadial, eRadial: Variant; r, modX, modY, Tol: Integer): Boolean;

Same as RadialWalk, but with a tolerance.

Note

by Coh3n Last modified: Jan. 08, 2012 by Coh3n

Example:

while (RadialWalkTolerance(clRed, 25.5, 60.0, 50, -1, 2, 5)) do
  WriteLn('Walking in a ''line''... with tolerance!');

RadialWalkAutoColor

function RadialWalkAutoColor(autoColorConst, sRad, eRad, r, modX, modY: Integer): Boolean;

Uses the TAutoColorInfo record to radial walk.

Note

by Coh3n

Example:

LinearRoadWalk

function LinearRoadWalk(TheColor: Integer; Direction: Integer; Radius: Integer; Xmod, Ymod: Integer): Boolean;

Walks TheColor from Direction MIDDLE OUT!by performing windscreenlike scanning movements for Radius Distance Valid Arguments:

  • TheColor. Any Color, but Road- or WaterColor will do fine :)
  • Direction. Any number between 0-720. 0=N,90=E,180=S,270=W.
  • Radius. Distance from the centre of minimap, i.e. how far away the mouse clicks. Use numbers 20-72
  • XMod, YMod: deviation from MouseFindFlag. -2 to 2.

Note

by Nielsie95

Example:

WaterWalk

function WaterWalk(StartRadial, EndRadial, Radius, FFlagBreakOut, Xoff, Yoff, Xmod, Ymod: Integer): Boolean;
Walks alongside Water.
  • StartRadial/EndRadial = Any number between 0-720. 0=N,90=E,180=S,270=W.
  • Radius. Distance from the centre of minimap, i.e. how far away the mouse clicks. Use numbers 20-72
  • FFlagBreakOut. Distance to flag where it will break out. 15 - 10 is good.
  • Xoff, Yoff. Added to found point.
  • XMod, YMod. deviation from MouseFindFlag. -2 to 2.

Note

by Nielsie95 from a third original idea by WT-Fakawi

Example:

TPAWalk

function TPAWalk(color, tol, offsetX, offsetY: integer; sortFrom: TPoint): boolean;
Uses a simple TPA sorting method to walk to a spot on the minimap.
  • color: the color to be found on the minimap
  • tol: the tolerance on color
  • offsetX: the offset to click on the X coordinate of the found color
  • offsetY: the offset to click on the Y coordinate of the found color
  • sortFrom: the point on the minimap to sort found colors from

Note

by Coh3n

Example:

if (not TPAWalk(1234567, 10, 0, 0, point(MMX1, MMY1)) then
  if (not radialWalkTolerance({parameters here}) then
    writeln('failed to TPA and radial walk');

GetMiniMapDotsIn

function GetMiniMapDotsIn(WhatDot: String; x1, y1, x2, y2: Integer): TPointArray;

Results the dots specified by WhatDot in x1, y1, x2, y2.

Usage:

  • ‘npc’, ‘yellow’ = Yellow Dot;
  • ‘cape’, ‘blue’ = Blue Dot;
  • ‘item’, ‘red’ = Red Dot;
  • ‘player’, ‘white’ = White Dot;
  • ‘friend’, ‘green’ = Green Dot;

Note

by Nava2 and Rasta Magician

Example:

count := Length(GetMiniMapDotsIn('green', MMX1, MMY1, MMX2, MMY2)));
WriteLn(ToStr(count) + ' friends on the map!');

GetMMDotsOnMS

Function GetMMDotsOnMS(WhatDot: String): TPointArray;

Using minimap gets all MM dots assumed to be on Main Screen and returns it as a TPA. You can also use it like Length(GetMMDotsOnMS(WhatDot)) to count how many are actually visable. Returns closes to your position first. Used with MMtoMS can be very powerful for searching more precise locations.

Note

by Narcle

Example:

while (Length(GetMMDotsOnMS('npc')) < 1) and (GetSystemTime < TimeCheck) do
begin
  Wait(100);
  FindNormalRandoms;
end;

GetMiniMapDots

function GetMiniMapDots(WhatDot: String): TPointArray;

Results the dots specified by WhatDot on the Minimap. See GetMiniMapDotsIn for more information.

Note

by Nava2

Example:

// print the minimap positions on the debug canvas
DebugTPA(GetMiniMapDots('white'));

CountDots

function CountDots(WhatDot: String): integer;

Counts the occurance of WhatDot on the MiniMap. See GetMiniMapDots in for more information.

Note

by Nava2

Example:

WriteLn(ToStr(CountDots('yellow')) + ' NPCs present on Minimap.');

MouseMM

procedure MouseMM(x, y, randX, randY: Integer);

Clicks (x, y) on the MM, taking Map Angle into Account. Be sure to choose the coords when Map Angle = 0 !

Note

by mixster

Example:

northPoint := Point(MMCX, MMY1-5); // North part!
MouseMM(NorthPoint.x, NorthPoint.y, 4, 4); //

LodestoneScreen

function LodestoneScreen(): Boolean;

Finds LodestoneScreen. Returns true if Found.

Note

Author: Home

Example:

If LodestoneScreen then
  WriteLn('Lodestone Network screen is open!');

OpenLodestoneScreen

function OpenLodestoneScreen(): Boolean;

Opens Lodestone Screen. Returns true if screen appears.

Note

Author: euphemism

Example:

If OpenLodestoneScreen then
  WriteLn('Opened Lodestone Network screen!');

LodestoneTeleport

function LodestoneTeleport(Where: String): Boolean;

Teleports you to chosen location via Lodestone teleport.

Note

Author: Home

Example:

If CastHomeTeleport then
  Lodestoneteleport('Lumbridge');