Results 1 to 4 of 4

Thread: SPS_Debug Utility

  1. #1
    Join Date
    Dec 2011
    Posts
    733
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default SPS_Debug Utility

    All this small script does is:
    • Convert coordinates based off of map segments to global coordinates, for use in scripts.
    • Debug points found in an existing SPS Path onto runescape
    • Allow you to adjust tolerance of SPS while debugging, to find what works best


    How to use?

    Click the 'New Image' button


    Choose the map you will be working off of, and remember the name of it. This will be your 'Area Coordinate'
    After choosing press open to load the map into the PathMaker


    Create your path In the path maker. Just click all the points you want the script to walk to. I recommend having the slightly close together, so that 3-4 points are showing on the minimap at a time, total.


    When finished creating your path, click this box to generate your path.


    Copy the contents of this box for use in your script, after conversion

    To convert the Path generated by the program, you will need to run it through the conversion function i created below.

    an example conversion:
    Simba Code:
    {$DEFINE SMART}
    {$i srl/srl.simba}
    {$i srl/srl/misc/paintsmart.simba}
    {$i sps/sps.simba}

    var
      myPath : TPointArray;

    function convertPath(area:String;Path:TPointArray):TPointArray;
    var
      i:Integer;
      newPath : TPointArray;
    begin
      newPath := path;
      for i := 0 to length(Path)-1 do
      begin
        newPath[i] := SPS_LocalToGlobal(area,newPath[i].x,newPath[i].y);
      end;
      result := newPath;
    end;

    function MakePathDeclaration(area:String;Path:TPointArray):String;
    begin
      result:= 'myPath := ' + Replace(tostr(convertPath(area,Path)),'(','Point(');
    end;

    begin
      myPath := [Point(239, 158), Point(236, 169), Point(246, 170), Point(257, 170), Point(270, 170), Point(277, 170), Point(283, 172), Point(290, 193), Point(290, 202), Point(290, 212), Point(288, 235), Point(291, 252), Point(293, 269), Point(302, 294), Point(312, 303), Point(331, 319), Point(350, 338), Point(369, 359), Point(383, 381), Point(390, 397), Point(425, 394), Point(441, 388), Point(455, 382)];
      writeln(MakePathDeclaration('0_2',myPath) + ';');
    end.
    If you replace 'myPath' With the path declaration u copied from wolygons path maker, this will print out the converted path, for use in your scripts.


    This is the full Utility:
    Simba Code:
    {$DEFINE SMART}
    {$i srl/srl.simba}
    {$i srl/srl/misc/paintsmart.simba}
    {$i sps/sps.simba}

    const
      surface = RUNESCAPE_SURFACE; //surface the map was in
      area = '0_2';  //set to the area map you used
      SPS_Tolerance = -1; //new tolerance to use for finding current position.
                           //set tol to -1 to use default
      paintPoints = true; //paint path points on SMART canvas?
      MinInterval = 3000; //Minimum time it takes for mainloop to execute once

    var
      myPath : TPointArray;
      TP : TPoint;
      I : Integer;
      foundOne : Boolean;
      T:LongInt;

    function convertPath(area:String;Path:TPointArray):TPointArray;
    var
      i:Integer;
      newPath : TPointArray;
    begin
      newPath := path;
      for i := 0 to length(Path)-1 do
      begin
        newPath[i] := SPS_LocalToGlobal(area,newPath[i].x,newPath[i].y);
      end;
      result := newPath;
    end;

    function MakePathDeclaration(area:String;Path:TPointArray):String;
    begin
      result:= 'myPath := ' + Replace(tostr(convertPath(area,Path)),'(','Point(');
    end;

    begin
      {$ifdef SMART}
        Smart_Members := True;
        Smart_Server := 100;
        Smart_Signed := False;
        Smart_SuperDetail := False;
      {$endif}
      SetupSRL;

      SPS_Setup(surface,[area]);
      if (SPS_Tolerance <> -1) then
        SPS_Surface.Tolerance := SPS_Tolerance;

      repeat
        MarkTime(T);
        if paintPoints and (length(myPath) > 0) then
        begin
          SMART_ClearCanvas;
          foundOne := False;
          for I := 0 to length(mypath)-1 do
          begin
            TP := SPS_PosToMM(mypath[I]);
            writeln(tostr(SPS_GetMyPos) + '->' + inttostr(I) + ': ' + tostr(TP));
            if TP.y > 0 then
              foundOne := true;
            if foundOne and (TP.y < 0) then
              break;
            SMART_DrawCircle(false,TP,3,false,clRed);
          end;
        end else
          writeln(SPS_GetMyPos);
          wait(Max(0,MinInterval-TimeFromMark(T)));
      until false;  {}
    end.

    EDIT: updated with pics;
    Last edited by m34tcode; 03-18-2012 at 03:33 PM.

  2. #2
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Really neato. Yeah I'd surely like to see some pictures mate, anywho, good job.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  3. #3
    Join Date
    Dec 2011
    Location
    -bash
    Posts
    515
    Mentioned
    0 Post(s)
    Quoted
    27 Post(s)

    Default

    Any of you have a version of sps that includes runescape_other?

  4. #4
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Chig View Post
    Any of you have a version of sps that includes runescape_other?
    Should be able to just update sps?

Thread Information

Users Browsing this Thread

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

Posting Permissions

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