WalkerV2 and doors
Introduction
Recently, @Torwent and I made huge efforts to incorporate doors into the TRSWalkerV2
, which is the walker that works on the new TRSMap
system. In this tutorial, I will explain how to setup the Map
to use this feature and then how to use it to walk through doors.
Setting up TRSMap
The library has a standard global variable named Map
, which is an object of the TRSMap
record. It is recommended to use this variable, unless you know what you are doing and have a specific reason to do so. To setup the Map
variable, all that one has to do is call the function Map.SetupChunks
or some variant of it. This function takes input of the type array of TRSMapChunk
and this can be easily passed into the function as [[[ul_x,ul_y,lr_x,lr_y],[level]], [[ul_x2,ul_y2,lr_x2,lr_y2],[level]] , ...]
where ul
and lr
are the upper-left and lower-right coordinates of the chunks you want to load on the MejRS map, and level
is the level of the area you want to load. As of the time of writing, the walker doesn’t support walking on planes other than 0, but support for this should be added in the near future! Notice that on the map there is a huge section of caves that are also on plane 0, but are placed above the normal map (and there is an even bigger section of caves even higher on the map). A tip to find things on the map is to take a recognizable NPC from the area and fill it into the NPC finder on the lower left of the map. For example, if you want to find the Monkey Madness 1 caves, type in Zooknock
into the name field and press enter and zoom out to find the blue mark on the map. Take note that the NPC finding is case sensitive!
An example of how to load the map of Varrock in a script is below:
{$I WaspLib/osr.simba}
begin
Map.SetupChunks([[[49, 54, 51, 52],[0]]]); //Varrock area
end.
Walking through doors
The built-in door handler is disabled by default but once enabled walking to a destination with one or more doors in between is just as simple as walking to any other place in most cases! It is integrated into the WebWalk
feature of the library. As an example, I will extend the script we had before to walk to some tile in Varrock that is behind a door:
{$I WaspLib/osr.simba}
var
destination: TPoint;
begin
Map.SetupChunks([[[49, 54, 51, 52],[0]]]); //Varrock area
Map.Loader.Graph.UseCollisionData := True; //needed to enable the door handler
Map.Walker._DoorHandler.Enabled := True; //needed to enable the door handler
destination := [8856, 36778];
Map.Walker.WebWalk(destination);
end.
Teleport to the Varrock square and try for yourself!
Bonus tutorial!
If you are curious as to how you can find points on the map, try the following script:
{$DEFINE SRL_DISABLE_REMOTEINPUT}
{$I SRL-T/osr.simba}
{$I WaspLib/osr.simba}
const
USE_KEYBOARD = True;
Chunk_Bank: TRSMapChunk = [[45, 51, 46, 51], [0]];
Chunk_C_532: TRSMapChunk = [[53,55,54,54], [0]];//slayer tower
Chunk_C_217: TRSMapChunk = [[41,50,44,49], [0]];//added karamja north
Chunk_C_128: TRSMapChunk = [[42,54,44,53], [0]];//camelot //catherby
Chunk_C_146: TRSMapChunk = [[23,56,25,54], [0]];//saj in kourend
Chunk_C_113: TRSMapChunk = [[41,57,42,56], [0]];//releka
Chunk_C_122: TRSMapChunk = [[38,51,40,51], [0]];//west ardy
Chunk_C_433: TRSMapChunk = [[36,55,38,53], [0]];// //gnome
Chunk_C_143: TRSMapChunk = [[44,56,45,55], [0]];// Burthrope
Chunk_C_313: TRSMapChunk = [[49,50,52,49], [0]];// Alkalid//lumbyswamp
procedure Run();
var
p: TPoint;
begin
while True do
begin
Wait(1000);
p := map.walker.Position();
if not USE_KEYBOARD then
begin
Writeln('[', p.X, ', ', p.Y, '];');
Continue;
end;
if Keyboard.IsKeyDown(VK_SPACE) then
begin
Writeln('[', p.X, ', ', p.Y, '];');
Wait(1000);
end
end;
end;
begin
//Map.SetupChunks([Chunk_C_313]);
Map.SetupChunks([[[47,49,49,47],[0]], [[25,196,27,194],[0]]]);
ClearDebug();
Run();
end.
At the bottom, you can load the area you are interested in and then hold the spacebar on the tile you want to find and it will be outputted into the console.