# 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](https://slacky.one/) 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](https://map.waspscripts.com/) For something simpler and much closer to the original [slacky](https://slacky.one/) walker check out {ref}`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 ```pascal procedure TRSMap.InternalSetup(); ``` Internal TRSMap setup method. This is caleld automatically for you and you shouldn't need to call it. - - - ## Map.Setup ```pascal 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 {ref}`TRSMap`. - - - ## Map.Add ```pascal 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 ```pascal 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 ```pascal 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: ```pascal WriteLn(Map.Position()); WriteLn(Map.Similarity); // Check to see the match percentage if needed ``` - - - ## Map.Height ```pascal 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 {ref}`global points` or if it's meant to be used as internal {ref}`local points`. Example: ```pascal WriteLn Map.Height(); ``` - - - ## Map.DebugPosition ```pascal function TRSMap.DebugPosition(): TPoint; ``` Debugs the player position in the currently loaded map. Example: ```pascal Map.Setup(...); while True do Map.DebugPosition(); ``` - - - ## Map.DebugHeight ```pascal procedure TRSMap.DebugHeight(); ``` Debugs the heightmap with {ref}`MM2MS`. Example: ```pascal {$I WaspLib/osrs.simba} begin Map.Setup([ERSChunk.VARROCK]); while True do begin Options.GetZoomLevel(False); Map.DebugHeight(); end; end. ``` ```{figure} ../../images/mm2ms_height.gif ``` - - - ## Map variable Global {ref}`TRSMap` variable.