First of all, if you haven't read the tutorial on how TRSWalker works but knowing how walker works is vital to debug it when issues arise.
In this tutorial we will go over a basic walker setup, do some walking and go over some of it's variables, methods and we will also cover webber and webgraphs.
Let's start by creating very simple script to play with it:
var rsw: TRSWalker; begin end.
I recommend you type it, it's useful to get used to it but you can also just copy paste it into Simba.
In this example
rsw will be our walker variable.
You can name it whatever you want but it's a good practice to name variables something that makes sense.
rsw for instance stands for "RuneScape Walker".
You can have multiple walkers setup, but the use cases are rare and are usually for very advanced scripts, unless you absolutely need more than 1 walker I would avoid it.
Now, let's take a look at the walker record and go over some of it's variables.
CTRL+Left click the world
TRSWalker in Simba to go to it's declaration and you will find this or something very similar:
TRSWalker = record(TSRLBaseRecord) Region: TBox; RegionIndex: Integer; Map: TRSWalkerMap; Cache: TMatchTemplateRGBCache; WebGraph: TWebGraph; EnableRunAtEnergy: Int32; Scaling: Int32; Similarity: Single; ScreenWalk: Boolean; AdaptiveWalk: Boolean; NearZoomMode: Boolean; ClickRandomness: Int32; AdaptiveToggleDistances: TPoint; Path: TPointArray; PathIndex: Int32; FancyMouse: Boolean; MouseAheadTimer: Int32; Enabled: Boolean; OnWalkEvent: TRSWalker_OnWalkEvent; OnWalkEventEx: TRSWalker_OnWalkEventEx; OnWalkingEvent: TRSWalker_OnWalkEvent; end;
Some of this variables are internal and you really shouldn't be touching them unless you know what you are doing, some though are meant to be used and can be changed to your liking.
In this tutorial we are going to focus on this ones on this order after we add some walking to our basic script:
ScreenWalk AdaptiveWalk NearZoomMode FancyMouse WebGraph
But before making use of any of them, let's add some more stuff to our script.
In the same file you have the TRSWalker declaration open, you can also see it's methods, but for simplicity sake you can refer to the docs or see them here:
procedure TRSWalker.Setup(Scaling: Integer = 8); procedure TRSWalker.Setup(Map: String; Scaling: Int32 = 8); procedure TRSWalker.Setup(Map: String; Regions: TBoxArray; Scaling: Integer = 8); overload; procedure TRSWalker.Setup(Regions: TBoxArray; Scaling: Integer = 8); overload;
procedure TRSWalker.SetupNamedRegion(region: TRSBankRegion = ); overload; procedure TRSWalker.SetupFromURL(url: String; map: String = ''; scaling: Int32 = 8; forceDownload: Boolean = False); overload;
So any of those will setup walker for you with it's respective parameters.
So let's first explain the SRL parameters:
- Map is the map image name you want to load. When this parameter is not used, the default WaspLib map
Simba/Includes/osr/walker/map.pngwill be used. If you specify a map, a file with the specified name will be loaded from
Simba/Includes/osr/walker/maps/if it exists, if not the script will crash. The file extension has to be .png or .bmp and using the extension on the string is optional, e.g.:
- Scaling is a very important one but maybe hard to understand. It refers to the downscaling used in walker to improve speed. This is almost linear and doubling scaling doubles performance while halving accuracy. The default of
8is a good value for almost every case but if you are struggling with bad positions you may have luck by lowering it. For no downscaling which I wouldn't recommend you would want to set this to 0.
- Regions this one is extremely useful and if you are using WaspLib, because the map is larger it's highly recommend tk be used everytime. This basically tells walker you want it to crop the boxes you pass to it through this and discard the rest of the map. This makes using walker when you don't require the whole world map which is virtually every time, much faster and accurate. Say your map is 10k pixels by 10k pixels and you set the regions to be
[[0, 0, 1000, 1000]]and you never need to leave that square. You just made walker work 10x faster and accurate for you. If you need to leave that "region", you can set multiple:
[[0, 0, 1000, 1000], [2500, 2500, 3500, 3500]]. The only thing you have to be sure is that you will never be using walker when you are not inside of the regions you setup.
Now for WaspLib parameters, I'm only going to talk about
TRSWalker.SetupFromURL() which is used to setup a map with a file from the internet for now:
- url is the file url. And again, the resource as to be .png or .bmp format.
- map in this case is the name you want the file to havd locally without any extension. The file will be saved directly as a .bmp so just set it's name without an extension.
- scaling is the same as SRL
- forceDownload is wether you want the asset to be redownloaded everytime or if map already exists just use that instead. By default this is set to
WaspLib also includes a large collection of TBox "RSRegions" to use with it's default map. If the region you need is available make use of it!
These are also very easy to create with a tool WaspLib has:
This is just a simba script, you run it and a GUI with WaspLib map will open up and you can see and edit all
RSRegions available and add new ones.
Keep in mind that adding new ones will be only be available to you unless you submit them to the WaspLib repo and they are accepted. Also, these will be lost when you update WaspLib if they are not added to the official repository.
However, you may use this to retrieve the TBoxes you need very easily too.
With this out of the way, lets finally setup walker to our little script with a map of varrock:
var rsw: TRSWalker; begin rsw.Setup([RSRegions.VARROCK]); end.