Map

This file is responsible for the TRSMap positioning system. It was made from scratch by Torwent but heavily inspired in the original TRSWalker by slacky and it’s future iterations made by Olly. Without them, this wouldn’t be possible.

For a online interactive map you can visit WaspScripts map

For something simpler and much closer to the original slacky walker check out Image Map.


TRSPosition

Record holding a player’s full position:

  • X, Y coordinate

  • Z which is the player height on the current heightmap

  • Plane which is the player’s current plane if several planes are being used.


TRSMap

Record responsible for positioning.


Map.InternalSetup

procedure TRSMap.InternalSetup();

Internal TRSMap setup method. This is caleld automatically for you and you shouldn’t need to call it.


Map.Setup

procedure TRSMap.SetupEx(boxes: TBoxArray; planes: TIntegerArray = [0]; downscale: UInt32 = 8);
procedure TRSMap.Setup(chunks: TRSMapChunkArray; downscale: UInt32 = 8);
procedure TRSMap.Setup(echunks: set of ERSChunk; downscale: UInt32 = 8); overload;

Sets up a TRSMap.


Map.Add

procedure TRSMap.AddEx(boxes: TBoxArray; planes: TIntegerArray = [0]; downscale: UInt32 = 8);
procedure TRSMap.Add(chunks: TRSMapChunkArray; downscale: UInt32 = 8);
procedure TRSMap.Add(echunks: set of ERSChunk; downscale: UInt32 = 8); overload;

TRSMap to add maps to an already setup TRSMap.


Map.ScaledSearch

function TRSMap.ScaledSearch(img: TImage): TPointArray;

Internal TRSMap method used to get an initial TPointArray of possible positions. This is performed in a downscaled map with a downscaled minimap. This is very innacurate by itself but by ruling down most of the map in a downscaled search before doing a full sized search speed has a dramatic boost. You probably won’t ever need to call this directly.


Map.Position

function TRSMap.Position(): TPoint;
property TRSMap.FullPosition(): TRSPosition;

Returns the players current position on the loaded map. TRSMap.FullPosition() also returns the current Z level.

Example:

WriteLn(Map.Position());
WriteLn(Map.Similarity); // Check to see the match percentage if needed

Map.Height

function TRSMap.Height(pt: TPoint; global: Boolean = True): Single;

Returns the height of the player at the specified coordinate if there’s a heightmap loaded. If pt is [0,0], which is the default then we will use our current position. global decides wether the coordinate is converted to Global Points or if it’s meant to be used as internal Local Points.

Example:

WriteLn Map.Height();

Map.DebugPosition

function TRSMap.DebugPosition(): TPoint;

Debugs the player position in the currently loaded map.

Example:

Map.Setup(...);
while True do
  Map.DebugPosition();

Map.DebugHeight

procedure TRSMap.DebugHeight();

Debugs the heightmap with MM2MS.

Example:

{$I WaspLib/osrs.simba}
begin
  Map.Setup([ERSChunk.VARROCK]);
  while True do
  begin
    Options.GetZoomLevel(False);
    Map.DebugHeight();
  end;
end.
_images/mm2ms_height.gif

Map variable

Global TRSMap variable.