Results 1 to 11 of 11

Thread: Tutorial: Using SRL Positioning System (SPS) to Walk Anywhere

  1. #1
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Thumbs up Tutorial: Using SRL Positioning System (SPS) to Walk Anywhere

    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.


    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:

    We want to move specifically between these two points:


    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:

    Simba Code:
    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:
    Simba Code:
    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:
    Progress Report:
    [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:
    Simba Code:
    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)
    Second note, closer to the wheels: (3365, 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:

    Simba Code:
    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:
    Simba Code:
    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:


    Simba Code:
    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
      Simba Code:
      SRL_Procs[srl_AntiBan] := @MyAntiBanFunction;
      to call antiban functions while walking and using some other SRL functions.
    • 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!
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  2. #2
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Sweeeeeeeeeeet

    Creds to DannyRS for this wonderful sig!

  3. #3
    Join Date
    Feb 2012
    Location
    Canada
    Posts
    1,164
    Mentioned
    26 Post(s)
    Quoted
    433 Post(s)

  4. #4
    Join Date
    Sep 2007
    Location
    BitLeak
    Posts
    175
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default

    I will definitely refer to this once I find time to make some scripts!

    This is a very nice tutorial, thank you.

  5. #5
    Join Date
    Mar 2012
    Location
    Over there
    Posts
    840
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    Very nice tutorial. For some reason I was doubting that it would be stable but turns out it works very well. I'm currently running a pretty long path and it hasn't messed up yet in 2+ hours of testing. Thanks for sharing the method.

    Edit: I have a question in regards to using FindNormalRandoms. Would it be best to just throw it in the loop while its Blindwalking or would it be better to use SRL_procs?
    Last edited by Total; 03-27-2013 at 09:12 AM.

  6. #6
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Quote Originally Posted by Total View Post
    Very nice tutorial. For some reason I was doubting that it would be stable but turns out it works very well. I'm currently running a pretty long path and it hasn't messed up yet in 2+ hours of testing. Thanks for sharing the method.

    Edit: I have a question in regards to using FindNormalRandoms. Would it be best to just throw it in the loop while its Blindwalking or would it be better to use SRL_procs?
    (I'm assuming you are on OSRS, because FindNormalRandoms isn't really needed in the live game)
    If you want to call it often, use the procs thingy, tough blindwalk should quit if it can't find itself on the map. It's more failsafe with procs.
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  7. #7
    Join Date
    Nov 2011
    Posts
    1,589
    Mentioned
    9 Post(s)
    Quoted
    17 Post(s)

    Default

    I though Bindwalk, generated the path then walked that path?
    Mat



    ^^

  8. #8
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Quote Originally Posted by Mat View Post
    I though Bindwalk, generated the path then walked that path?
    Mat
    Not really, it calculates where to click after you reach the flag, every single time.
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  9. #9
    Join Date
    Oct 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I cannot for the life of me get this to work.

    First I tried SPS_GetMyPos using the runescape_surface07 for castle wars. That didn't work. Then I tried to making my own map, a simple small map at first just to see if I could get the coordinates where I am standing:

    cw.png

    That didn't work either. Debug keeps giving me this:

    Code:
    SPS_GetMyPos: Finished in 1919 ms. Result = (-1, -1)
    SPS_GetMyPos: Finished in 1887 ms. Result = (-1, -1)
    SPS_GetMyPos: Finished in 1888 ms. Result = (-1, -1)
    Brightness is all the way up, here's what my code looks like:

    Code:
    program TestSPS;
    {$DEFINE SMART8}
    {$I SRL-OSR/SRL.Simba}
    {$I SPS/sps-osr.simba}
    
    
    Procedure DeclarePlayers;
    Begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
       Players[0].Name := '';
       Players[0].Pass :='';
       Players[0].Nick :='';
       Players[0].Active:=True;
    End;
    
    Procedure Setup;
    Begin
      SetupSRL;  // You need to setup srl before anything else
    
      SPS_Setup(runescape_surface,['cw']); //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;
    
    
    
    begin
     Setup;
     SPS_GetMyPos;
    end.
    I even tried going to Draynor, and using your map and your Mainland1 Procedure, and nothing happens. What am I doing wrong??
    Last edited by kyang1993; 04-03-2013 at 08:34 PM.

  10. #10
    Join Date
    Mar 2013
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    This helped a lot, thanks for writing!

  11. #11
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Quote Originally Posted by kyang1993 View Post
    I cannot for the life of me get this to work.

    First I tried SPS_GetMyPos using the runescape_surface07 for castle wars. That didn't work. Then I tried to making my own map, a simple small map at first just to see if I could get the coordinates where I am standing:

    cw.png

    That didn't work either. Debug keeps giving me this:

    Code:
    SPS_GetMyPos: Finished in 1919 ms. Result = (-1, -1)
    SPS_GetMyPos: Finished in 1887 ms. Result = (-1, -1)
    SPS_GetMyPos: Finished in 1888 ms. Result = (-1, -1)
    Brightness is all the way up, here's what my code looks like:

    Code:
    program TestSPS;
    {$DEFINE SMART8}
    {$I SRL-OSR/SRL.Simba}
    {$I SPS/sps-osr.simba}
    
    
    Procedure DeclarePlayers;
    Begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
       Players[0].Name := '';
       Players[0].Pass :='';
       Players[0].Nick :='';
       Players[0].Active:=True;
    End;
    
    Procedure Setup;
    Begin
      SetupSRL;  // You need to setup srl before anything else
    
      SPS_Setup(runescape_surface,['cw']); //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;
    
    
    
    begin
     Setup;
     SPS_GetMyPos;
    end.
    I even tried going to Draynor, and using your map and your Mainland1 Procedure, and nothing happens. What am I doing wrong??
    try making it a bit bigger

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •