litoris
2013-03-26 16:15:21
Before reading this, make sure you have read the Offical SPS Thread.
I'm assuming you know how to write a working script, and that you are a bit familiar with SPS.
I'm assuming you know how to write a working script, and that you are a bit familiar with SPS.
Using SPS
or: How I Learned to Stop Worrying and Love BlindWalk
In this tutorial, I am going to teach you how I use SPS to walk anywhere. I am going to give two examples, one from the live game and one from the Old School version.
Example # 1:
Let's say that I want to walk to the crafting wheel in Burthorpe from the bank chest and back. A quick scroll through the Surface folder will show me that there's a very nice map piece that includes both of our points of interest:
But of course, it is not possible to move in a straight path between these points, because there is a ditch around the banking area, and there are smithing furnaces between the wheel and the bank. So, you would most likely follow a path like this:
And here is what I do to walk this path:
First, add the necessary setup lines:
Procedure Setup;
Begin
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
SetupSRL; //You need to setup srl before anything else
SPS_Setup(runescape_surface,['8_6']); //the map we used is in the surface folder, and is named 8_6
SPS_AnyAngle := True; //I want to use this map with a different angle, so I set it true
SPS_Debug := True; //this will debug everything SPS is doing
DeclarePlayers;
LoginPlayer;
MakeCompass('S'); //this will work because any angle is set to true
SetAngle(SRL_Angle_high); //high angle
End; This is our Setup procedure. This will be called as the script starts.
Now, to the actual walking.
I like using BlindWalk with SPS instead of paths. BlindWalk lets you walk between two points that are not necessarily visible in the minimap at the same time. Blindwalk is useful because it generates the path as it walks, preventing your script from failing just because a point is not visible.
BlindWalk is useful for walking between two points that lie on a straight path, without obstacles. Here is how I would use BlindWalk to walk to a point that is not visible in the minimap:
procedure RandomWalk;
begin
repeat
Wait(600);
until (SPS_Blindwalk(Point(500, 500)));
WaitNotMoving(False);
end; I am making it loop until the blindwalk function returns True, which only happens if SPS_GetMyPos's result at the end of the path is (00,500) in this case.If you have SPS_Debug set to true, this is the sort of Debug you would see while this function runs:
[00:00:30]: Rotating map took 0 ms.
[00:00:31]: SPS_GetMyPos: Finished in 625 ms. Result = (3366, 2482)
[00:00:31]: Rotating map took 0 ms.
[00:00:31]: SPS_GetMyPos: Finished in 640 ms. Result = (3366, 2482)
[00:00:36]: Rotating map took 0 ms.
[00:00:37]: SPS_GetMyPos: Finished in 610 ms. Result = (3386, 2518)//different coordinate- it has moved!
[00:00:37]: Rotating map took 16 ms.
[00:00:38]: SPS_GetMyPos: Finished in 610 ms. Result = (3386, 2522)
[00:00:41]: Rotating map took 0 ms.
[00:00:42]: SPS_GetMyPos: Finished in 610 ms. Result = (3354, 2546)//the debug stops here because the final point is reached(notice: I copied this off while my script was running, so this is debug from an actual path. It also has timestamps, unrelated)But, of course, we want to walk a real path! TO walk a path, you first need to have points on the path. What I do is, with my character logged in and at the location I want to walk at, I call SPS_GetMyPos. IF you have set debug to true, then this will tell you your character's coordinates in the debug box.
So, after copying off the Setup procedure I have above you could run this as your mainloop:
begin
Setup;
SPS_GetMyPos;
end;And get the coordinates in your debug box. This should be pretty accurate in all angles, coordinates may vary by 4-5 points so you can't land at an exact tile, but it's good enough.A good path should have points (nodes) at locations that you can walk straight inbetween. Here's where I would pick my nodes for the Burthorpe area:
The large red dots are my starting/ending points, and the blue points are my nodes. While making my script I collected the following points for my path:
By the chest: (3354, 2486)
First node away from chest: (3390, 2518)
By the wheels: (3334, 2586)
After a long phase of testing I decided that the second node is unnecesary and decreases the xp/h, so I did not use it :P It is included in this tutorial anyway, you better be safe when first making the script.
Here is the procedure that walks from he chest to the wheel:
procedure WalktoOven;
begin
repeat
Wait(600);
until (SPS_Blindwalk(Point(3390, 2518))); //first (and only) node
repeat
Wait(600);
until (SPS_Blindwalk(Point(3334, 2586))); //coordinates of the wheels
WaitNotMoving(False);
end;And here is the one that walks back:
procedure WalktoBank;
begin
repeat
Wait(600);
until (SPS_Blindwalk(Point(3390, 2518)));
repeat
Wait(600);
until (SPS_Blindwalk(Point(3354, 2486)));
WaitNotMoving(False);
end;For the chest, I did not get the coordinate right next to the chest, because that could make me walk all the way around the ditch. Instead, I am using a point that is a bit away from the chest, but still inside the ditch.
Anyway, this should be enough to let you walk this distance.
Example # 2:
ASuuming you have read the previous example, this one will be for OSRS and I will use a custom map.
I use this SPS for OSRS.
I want to walk to Port Sarim from Draynor for a law crafter. First, I make a custom map: (you can find a tutorial for this easily. For this map, I merged sections from the SPS I linked you above)
Then, I gather points. For this path, I have 5 points, because there are things to be avoided. Here is the procedure I made:
procedure Mainland1;
begin
SPS_Setup(runescape_surface, ['sarimdraynor']); //I put the file in the 07surface folder per the requirements of the SPS I am using. sarimdraynor is the name of the file
repeat
Wait(600);
until (SPS_Blindwalk(Point(192,148))); //center of draynor square I believe
repeat
Wait(600);
until (SPS_Blindwalk(Point(148,60))); //the "corner", south east of the cabbage patch, I take a sharp turn here and head south
repeat
Wait(600);
until (SPS_Blindwalk(Point(120,104))); //some spot on the docks that falls on a straight line from the "corner"
repeat
Wait(600);
until (SPS_Blindwalk(Point(88,204))); //the part of the docks with the entrana monks
end; You can test this path if you want, I have used it for many hours without problems. Not to mention that I am giving a quarter of a law runner away for free ;)
Things to Be Careful About
- Always gather node coordinates at areas that you would be fine with landing in a 5 square radius of. If you need to stand at a very specific tile, get nearby with SPS and then use something more precise.
- You can do things while SPS is working! Use
to call antiban functions while walking and using some other SRL functions.SRL_Procs[srl_AntiBan] := @MyAntiBanFunction; - Use FFlag(Distance) function to set a distance from the minimap flag, at which the script will assume you have arrived. Can be useful at values around 3 to make walking more human-like, at the cost of some accuracy.
- When making a custom map, make sure everywhere that is seen on your minimap during your walk is on the map. Having your map cut-off can screw up your coordinates.
- Don't use more than one SPS map. Surface maps allow you to merge maps, but it screws things up really bad. SPS can confuse roads etc with other ones. It is the best to create one big map out of the areas you use, and then crop the parts that will never appear on your minimap.
Conclusion
You should now know how to walk to anywhere confidently! I am not the expert in walking, but I realized that a lot of people use the built-in path system rather than BlindWalk. Someone might make a BlindWalkPath function one day, but until then, this works well enough, and I cba to make one myself :).
Post here if you have any questions, and I will try yo answer them to the best of my abilities.
I'm glad if you learned something from this tutorial!