Results 1 to 20 of 20

Thread: WindWalk

  1. #1
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default WindWalk

    Hello, i have finished the wind walking for SPS

    This (as you would probably expect) creates a blind path and then walks along it in SPS.

    I have tried this and i seems to work quite well

    However because of the current SPS_WalkToPos being somewhat, slow... i have had to edit the include.

    This is the function, it was mainly taken from Reflection, so i take no credit here other than getting the correct values for it to work
    Simba Code:
    function sps_WindPath(xs, ys, xe, ye, gravity, wind, maxStep, targetArea: extended): TPointArray;
    var
      veloX, veloY, windX, windY, veloMag, dist, randomDist, lastDist, step: extended;
      lastX, lastY: integer;
      sqrt2, sqrt3, sqrt5: extended;
    begin
      sqrt2:= sqrt(2);
      sqrt3:= sqrt(3);
      sqrt5:= sqrt(5);
      while hypot(xs - xe, ys - ye) > 1 do
      begin
        dist:= hypot(xs - xe, ys - ye);
        wind:= minE(wind, dist);
        if dist >= targetArea then
        begin
          windX:= windX / sqrt3 + (random(round(wind) * 2 + 5) - wind) / sqrt5;
          windY:= windY / sqrt3 + (random(round(wind) * 2 + 5) - wind) / sqrt5;
        end else
        begin
          windX:= windX / sqrt2;
          windY:= windY / sqrt2;
          if (maxStep < 15) then
          begin
            maxStep:= random(15) + 15;
          end else
          begin
            maxStep:= maxStep / sqrt5;
          end;
        end;
        veloX:= veloX + windX;
        veloY:= veloY + windY;
        veloX:= veloX + gravity * (xe - xs) / dist;
        veloY:= veloY + gravity * (ye - ys) / dist;
        if hypot(veloX, veloY) > maxStep then
        begin
          randomDist:= maxStep / 2.0 + random(round(maxStep) / 2);
          veloMag:= sqrt(veloX * veloX + veloY * veloY);
          veloX:= (veloX / veloMag) * randomDist;
          veloY:= (veloY / veloMag) * randomDist;
        end;
        lastX:= Round(xs);
        lastY:= Round(ys);
        xs:= xs + veloX;
        ys:= ys + veloY;
        SetArrayLength(Result, GetArrayLength(Result) + 1);
        Result[ High(Result) ] := Point(Round(xs), Round(ys));
        step:= hypot(xs - lastX, ys - lastY);
        lastdist:= dist;
      end;
    end;

    function sps_WindWalk(T: TPoint): Boolean;
    var
      I, Tries: Integer;
      M, P: TPoint;
      CTRLPoints: TPointArray;
    begin
      P := T;
      repeat
        M := SPS_GetMyPos;
        if Length(CtrlPoints)=0 then
          CtrlPoints := sps_WindPath(M.x, M.y, P.X, P.Y, 22.5, 12.5, 40, 20);  
        Inc(Tries);
        if(Tries > 20)then
          Exit;
        for I:= High(CtrlPoints) downto 0 do
          if sps_WalkToPosEx(CtrlPoints[i], 20) then
          begin
            Result := I = High(CtrlPoints);
            Break;
          end;
      until(Result);
    end;

    But as i said, i had to edit SPS_WalkToPos
    So i also propose there is a SPS_WalkToPosEx which would be like so
    Simba Code:
    function SPS_WalkToPosEx(P: TPoint; FlagDist: Integer): boolean;
    var
      MM: TPoint;
    begin
      if not LoggedIn then Exit;
      MM := SPS_PosToMM(P);

      if (MM.X > 0) then
      begin
        Mouse(MM.X, MM.Y, 0, 0, True);
        Wait(200+Random(300));
        FFlag(FlagDist);
        Result := True;
      end;
    end;

    However to keep things tidy i suggest that SPS_WalkToPos gets changed to the following
    Simba Code:
    function SPS_WalkToPos(P: TPoint): boolean;
    begin
      result:= SPS_WalkToPosEx(p, 0);
    end;

    Here is a small script which you can use to test it
    this one will walk from Catherby bank to the fishing spots
    Simba Code:
    program new;
    {$loadlib sps}
    {$i srl/srl.scar}
    {$i sps/sps.simba}  

    begin
      SetupSrl;
      SPS_Setup(RUNESCAPE_SURFACE, ['7_7']);
      sps_WindWalk(Point(3210, 2925));
    end.

    and this one will walk from the fishing spots to the bank
    Simba Code:
    program new;
    {$loadlib sps}
    {$i srl/srl.scar}
    {$i sps/sps.simba}  

    begin
      SetupSrl;
      SPS_Setup(RUNESCAPE_SURFACE, ['7_7']);
      sps_WindWalk(Point(3070, 2890));
    end.

    ~shut
    Last edited by Shuttleu; 12-30-2011 at 09:39 AM.

  2. #2
    Join Date
    Dec 2011
    Location
    P2P :)
    Posts
    561
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Nice. It is a little weird but that might just be the area I am in. The point I set is a straight shot but it runs at a V type movement on the map.
    I wear my scars like the rings on a pimp
    I live life like the captain of a sinking ship
    Always sell your product for ATLEAST mid to ensure that the market doesn't drop.

  3. #3
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    you have to make sure you have loaded the correct map, assuming you have, where are you trying it

    ~shut

    EDIT: this one will walk from Catherby bank to the fishing spots
    Simba Code:
    program new;
    {$loadlib sps}
    {$i srl/srl.scar}
    {$i sps/sps.simba}  

    begin
      SetupSrl;
      SPS_Setup(RUNESCAPE_SURFACE, ['7_7']);
      sps_WindWalk(Point(3210, 2925));
    end.

    and this one will walk from the fishing spots to the bank
    Simba Code:
    program new;
    {$loadlib sps}
    {$i srl/srl.scar}
    {$i sps/sps.simba}  

    begin
      SetupSrl;
      SPS_Setup(RUNESCAPE_SURFACE, ['7_7']);
      sps_WindWalk(Point(3070, 2890));
    end.
    Last edited by Shuttleu; 12-30-2011 at 09:38 AM.

  4. #4
    Join Date
    Dec 2011
    Location
    P2P :)
    Posts
    561
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    I was messing around in Varrock(yes I know the snow was probably the issue). Works great though. I set up a walker from Seers Bank to the maple tree using cases and randomization since it is just the 1 click(yes I know I could use other methods but why not use the up and coming WindWalk)
    I wear my scars like the rings on a pimp
    I live life like the captain of a sinking ship
    Always sell your product for ATLEAST mid to ensure that the market doesn't drop.

  5. #5
    Join Date
    Dec 2011
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I did everything and when I tried to compile I got this: "Unknown identifier 'MMCX' at line 135.. Compiling failed."
    For this code(even though I didn't mess with it) :
    Simba Code:
    / Gets the map pieces that appear on the minimap
    function SPS_GatherMinimap: T3DIntegerArray;
    var
      bmp: TMufasaBitmap;
      c: TClient;
    begin
      try
        bmp := TMufasaBitmap.Create;
        bmp.SetSize(100, 100);

        c := getTClient;
        bmp.CopyClientToBitmap(
            c.IOManager, false, 0,0, MMCX-50, MMCY-50, MMCX+50, MMCY+50    //FROM HERE
          );                                                                                              // TO HERE

        Result := SPS_BitmapToMap(bmp);
      finally
        bmp.free;
      except
        SPS_DebugStr('[ERROR] in SPS_GatherMinimap: '+ExceptionToString(ExceptionType, ExceptionParam));
        SPS_WarnUser('SPS_GatherMinimap', ExceptionToString(ExceptionType, ExceptionParam));
      end;
    end;

    And you said "So i also propose there is a SPS_WalkToPosEx which would be like so ... and than the code"
    And I don't have a SPS_WalkToPosEx.
    Last edited by Gushers; 01-02-2012 at 12:42 AM.

  6. #6
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  7. #7
    Join Date
    Dec 2011
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Okay I replaced your whole SPS with mine... And I got the same error. This is weird.

  8. #8
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  9. #9
    Join Date
    Dec 2011
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I dont understand.. Explain a bit more?

  10. #10
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  11. #11
    Join Date
    Dec 2011
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    My scripts compile just fine.. I'm just trying to compile SPS.simba itself (the file you sent me) do I need to compile it? Or just save it?
    Last edited by Gushers; 01-02-2012 at 01:10 AM.

  12. #12
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  13. #13
    Join Date
    Dec 2011
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Alright man well now it's time to say THANK YOU! This works amazing.
    I'm now making a script to help out our community.
    Only question is how do I find the RuneScape Surface numbers I need?
    Do I use the PathCreator v0.9 for SPS?

  14. #14
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Gushers View Post
    Alright man well now it's time to say THANK YOU! This works amazing.
    I'm now making a script to help out our community.
    Only question is how do I find the RuneScape Surface numbers I need?
    Do I use the PathCreator v0.9 for SPS?
    i always found those numbers to be wrong

    best way is to open C:/Simba/Includes/SPS/img and find the images that you want to use, then put their names in the script below and press play, it will spit out a co-ordinate you can use

    Simba Code:
    {$loadlib sps}
    {$i srl/srl.scar}
    {$i sps/sps.simba}

    begin
      SetupSRL;
      SPS_Setup(RUNESCAPE_SURFACE, ['7_7', '7_8']);
      Writeln(SPS_GetMyPos);
    end.

    ~shut

  15. #15
    Join Date
    Dec 2011
    Posts
    209
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Alright thanks again man! This is amazing.

  16. #16
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,934
    Mentioned
    26 Post(s)
    Quoted
    237 Post(s)

    Default

    Question: if I will release my script to Public and it is going to be using 'Windwalk' would everyone need to make these changes, cause I doubt SRL has added this to SPS?

  17. #17
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  18. #18
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Thanks! :-) I will release these with SPS2

  19. #19
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    387
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Hey everyone, Im new to all of this, but I'm learning quickly

    So how do I add this to my SPS file?
    Do I open up the SPS and replace some of the current coding with this new coding?
    If do, which part of the SPS code do i replace?
    If I am wrong could you please help?

  20. #20
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    This has been added to my SPS2.0 branch. I'll be updating marpis's 1.5 thread later.

    E: Here's the modified version of SPS_WindWalk that I added. From what I tested, it's quite a bit faster than the one you posted Shut. Not exactly sure why, but it works great.
    Simba Code:
    // Walks from the player's current position to the point T
    function SPS_WindWalk(T: TPoint): Boolean;
    var
      I, Tries: Integer;
      M, P: TPoint;
      ctrlPoints: TPointArray;
    begin
      P := T;

      repeat
        M := SPS_GetMyPos;

        if (Length(ctrlPoints) = 0) then
          ctrlPoints := SPS_WindPath(M.X, M.Y, P.X, P.Y, 22.5, 12.5, 40, 20);

        Inc(Tries);
        if (Tries > 20) then
          Exit;

        Result := SPS_WalkPath(ctrlPoints);
      until(Result);
    end;

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
  •