Page 1 of 4 123 ... LastLast
Results 1 to 25 of 83

Thread: SPS 1.5 - Ready for testing!

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

    Default SPS 1.5 - Ready for testing!

    Update: March 25th, 2012:
    Quote Originally Posted by Coh3n View Post
    I've updated my SPS2.0 branch on github with the files from the first post. After I'm able to test more (and there are no major bugs), I will merge with the master so everyone can enjoy it.

    If you want to test it out, replace your SPS folder with the one from here. Replace the old plugin with the new one, and you're good to go.

    To use a map other than the RS surface, do:
    Simba Code:
    SPS_Setup(RUNESCAPE_OTHER, ['runecrafting_altars']);
    SPS 1.5
    A huge thankyou to Hero for the dungeon maps!

    What's new?
    • SPS 1.5 uses the whole round minimap when finding the location, instead of just a 100x100 pixel box from the center.
    • A better, faster tolerance formula. Tolerance value is 600 by default, compared to the previous 0.3.
    • Dungeons! Just use RUNESCAPE_DUNGEONS as the surface when calling SPS_Setup and check out the filenames under /img/runescape_dungeons/ to see what are the area names to use.


    How to try it?
    1. Download the sps2.dll to /Simba/Plugins/
    2. Download the sps2.simba to /Simba/Includes/SPS/
    3. Download the sps2 test.simba to /Simba/Scripts/
    4. Stand on Varrock south gate and run the test script and watch your cahracter run around in Lumbridge.


    How to use SPS 1.5 in dungeons?
    1. Download the runescape dungeons folder to /Simba/Includes/SPS/img/
    2. Check out the filenames in that folder
    3. Set your SPS_Setup(RUNESCAPE_DUNGEONS, ['ancient_cavern']);


    Known bugs
    • Gives an access violation error. Solution: for now, just reset Simba.
    • GetMyPos acts weird in dungeons. Working on it now. Should be fixed now.


    EDIT: Sauce
    Code:
    library sps;
    
    {$mode objfpc}{$H+}
    
    uses
      Classes, sysutils, FileUtil, mufasatypes, bitmaps, math, Interfaces;
    
    type
      T3DIntegerArray = array of T2DIntegerArray;
      T4DIntegerArray = array of T3DIntegerArray;
      TMufasaBitmapArray = array of TMufasaBitmap;
    
    function SPS_ColorBoxesMatchInline(B1, B2: TIntegerArray; tol: extended): boolean; inline;
    begin
      Result := False;
    
      if (B2[0]+B2[1]+B2[2]) = 0 then
        Exit;
    
      if (abs(B1[0] - B2[0]) < tol) then
        if (abs(B1[1] - B2[1]) < tol) then
          if (abs(B1[2] - B2[2]) < tol) then
            Result := True;
    end;
    
    
    function SPS_MakeColorBox(bmp: TMufasaBitmap; x1, y1, SideLength: integer): TIntegerArray; register;
    var
      x, y, width: integer;
      C: TRGB32;
    begin
      SetLength(Result, 3);
      width := bmp.Width;
    
      for x := (x1 + SideLength - 1) downto x1 do
        for y := (y1 + SideLength - 1) downto y1 do
        begin
          try
            C := bmp.FData[y * width + x];
            Result[0] := Result[0] + C.R;
            Result[1] := Result[1] + C.G;
            Result[2] := Result[2] + C.B;
          except end;
        end;
    end;
    
    
    procedure SPS_FilterMinimap(var Minimap: TMufasaBitmap); register;
    var
      W, H, x, y: integer;
      C: TRGB32;
    begin
      W := Minimap.width;
      H := Minimap.height;
    
      for x := W - 1 downto 0 do
        for y := H - 1 downto 0 do
        begin
          if hypot(abs(75.0 - x), abs(75.0 - y)) > 75 then
          begin
            Minimap.FastSetPixel(x, y, 0);
            continue;
          end;
    
          C := Minimap.FData[y * W + x];
    
        end;
    end;
    
    
    
    function SPS_BitmapToMap(bmp: TMufasaBitmap; SideLength: integer): T3DIntegerArray; register;
    var
      X, Y, HighX, HighY: integer;
    begin
      HighX := Trunc(bmp.Width / (SideLength*1.0));
      HighY := Trunc(bmp.Height / (SideLength*1.0));
    
      SetLength(Result, HighX);
      for X := 0 to HighX - 1 do
      begin
        SetLength(Result[X], HighY);
        for Y := 0 to HighY - 1 do
        begin
          Result[X][Y] := SPS_MakeColorBox(bmp, X * SideLength, Y * SideLength, SideLength);
        end;
      end;
    end;
    
    
    function SPS_FindMapInMap(out fx, fy: integer; LargeMap: T4DIntegerArray; SmallMap: T3DIntegerArray; tol: extended; out FoundMatches: integer): integer; register;
    var
      x, y, HighX, HighY, cm, L: integer;
      xx, yy: integer;
      Matching: integer;
      BoxesInViewX, BoxesInViewY: integer;
      b: Boolean;
    begin
      fX := -1;
      fY := -1;
      Result := -1;
      FoundMatches := 0;
      L := Length(LargeMap);
      BoxesInViewX := Length(SmallMap);
      BoxesInViewY := Length(SmallMap[0]);
    
      for cm := 0 to L-1 do
      begin
        HighX := High(LargeMap[cm]) - BoxesInViewX - 1;
        HighY := High(LargeMap[cm][0]) - BoxesInViewY - 1;
    
        for x := 0 to HighX do
          for y := 0 to HighY do
          begin
            Matching := 0;
    
            for xx := BoxesInViewX - 1 downto 0 do
              for yy := BoxesInViewY - 1 downto 0 do
              begin
                b:= SPS_ColorBoxesMatchInline(LargeMap[cm][x+xx][y+yy], SmallMap[xx][yy], tol);
                if (b) then Inc(Matching);
              end;
    
            if (Matching > FoundMatches) then
            begin
              FoundMatches := Matching;
              Result := cm;
              fX := x;
              fY := y;
            end;
          end;
      end;
    end;
    
    
    //////  EXPORTING  /////////////////////////////////////////////////////////////
    
    procedure SetPluginMemoryManager(MemMgr : TMemoryManager); stdcall; export;
    begin
      SetMemoryManager(MemMgr);
    end;
    
    function GetTypeCount(): Integer; stdcall; export;
    begin
      Result := 3;
    end;
    
    function GetTypeInfo(x: Integer; var sType, sTypeDef: string): integer; stdcall; export;
    begin
      case x of
        0: begin
            sType := 'T3DIntegerArray';
            sTypeDef := 'array of T2DIntegerArray;';
          end;
        1: begin
            sType := 'T4DIntegerArray';
            sTypeDef := 'array of T3DIntegerArray;';
          end;
        2: begin
             sType := 'TMufasaBitmapArray';
             sTypeDef := 'array of TMufasaBitmap';
           end;
        else
          x := -1;
      end;
      Result := x;
    end;
    
    function GetFunctionCount(): Integer; stdcall; export;
    begin
      Result := 4;
    end;
    
    function GetFunctionCallingConv(x : Integer) : Integer; stdcall; export;
    begin
      Result := 0;
      case x of
         0..3: Result := 1;
      end;
    end;
    
    function GetFunctionInfo(x: Integer; var ProcAddr: Pointer; var ProcDef: PChar): Integer; stdcall; export;
    begin
      case x of
        0:
          begin
            ProcAddr := @SPS_FindMapInMap;
            StrPCopy(ProcDef, 'function SPS_FindMapInMap(out fx, fy: integer; LargeMap: T4DIntegerArray; SmallMap: T3DIntegerArray; tol: extended; out FoundMatches: integer): integer;');
          end;
        1:
          begin
            ProcAddr := @SPS_BitmapToMap;
            StrPCopy(ProcDef, 'function SPS_BitmapToMap(bmp: TMufasaBitmap; SideLength: integer): T3DIntegerArray;');
          end;
        2:
          begin
            ProcAddr := @SPS_MakeColorBox;
            StrPCopy(ProcDef, 'function SPS_MakeColorBox(bmp: TMufasaBitmap; x1, y1, SideLength: integer): TIntegerArray;');
          end;
        3:
          begin
            ProcAddr := @SPS_FilterMinimap;
            StrPCopy(ProcDef, 'procedure SPS_FilterMinimap(var Minimap: TMufasaBitmap);');
          end
      else
        x := -1;
      end;
      Result := x;
    end;
    
    exports SetPluginMemoryManager;
    exports GetTypeCount;
    exports GetTypeInfo;
    exports GetFunctionCount;
    exports GetFunctionInfo;
    exports GetFunctionCallingConv;
    
    begin
    end.
    Last edited by Coh3n; 03-26-2012 at 02:26 AM.

  2. #2
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    Holy Shit!
    This looks amazing!!
    It'll work for sure now?

  3. #3
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Shweet work man! Will test this out later!
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  4. #4
    Join Date
    Dec 2011
    Location
    USA
    Posts
    362
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Awesome! I think ill try it with my new script~

  5. #5
    Join Date
    Jan 2012
    Location
    Vilnius, Lithuania
    Posts
    33
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Thanks for release!
    Testing it for my yew woodcutter and here is what i got (Access violation is in sps2.simba):

    [SPS] SPS_Setup() took 78 ms. Loaded 2 areas.
    [SPS] SPS_GetMyPos() finished in 219 ms. Result = (4015, 3585)
    Error: Exception: Access violation at line 146
    The following DTMs were not freed: [SRL - Lamp bitmap, 1, SRL - Lamp bitmap, 3]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, 6]
    EDIT: This happens only in port sarim docks.
    Last edited by chemicstry; 01-23-2012 at 06:00 PM.

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

    Default

    Nice job. So someone finished the maps I made?

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

    Default

    i need help can i just this as the main sps for simba ?

  8. #8
    Join Date
    Oct 2006
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Ah, I am going to convert the DTM walking in my script to SPS. I'll leave the DTM walking in there just in case it doesn't work correctly, or if it breaks again. :P

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

    Default

    Quote Originally Posted by Hero View Post
    Nice job. So someone finished the maps I made?
    Oh gosh! I forgot to credit you in the original post, fixed that! Sorry!
    I just added thicker black borders, otherwise they're original.

  10. #10
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    298
    Mentioned
    8 Post(s)
    Quoted
    37 Post(s)

    Default

    Code:
    [SPS] SPS_Setup() took 156 ms. Loaded 3 areas.
    [SPS] SPS_GetMyPos() finished in 265 ms. Result = (4680, 3135)
    [SPS] SPS_GetMyPos() finished in 265 ms. Result = (4650, 3145)
    [SPS] SPS_GetMyPos() finished in 249 ms. Result = (4600, 3170)
    [SPS] SPS_GetMyPos() finished in 250 ms. Result = (4550, 3205)
    [SPS] SPS_GetMyPos() finished in 234 ms. Result = (-1, -1)
    [SPS] SPS_GetMyPos() finished in 234 ms. Result = (-1, -1)
    [SPS] SPS_GetMyPos() finished in 234 ms. Result = (4540, 3275)
    [SPS] SPS_GetMyPos() finished in 280 ms. Result = (4535, 3305)
    [SPS] SPS_GetMyPos() finished in 281 ms. Result = (4535, 3305)
    [SPS] SPS_GetMyPos() finished in 281 ms. Result = (4535, 3310)
    [SPS] SPS_GetMyPos() finished in 265 ms. Result = (4535, 3310)
    [SPS] SPS_GetMyPos() finished in 296 ms. Result = (4540, 3330)
    [SPS] SPS_GetMyPos() finished in 280 ms. Result = (4540, 3335)
    [SPS] SPS_GetMyPos() finished in 296 ms. Result = (4540, 3335)
    [SPS] SPS_GetMyPos() finished in 312 ms. Result = (4540, 3340)
    [SPS] SPS_GetMyPos() finished in 296 ms. Result = (4540, 3370)
    [SPS] SPS_GetMyPos() finished in 280 ms. Result = (4540, 3370)
    [SPS] SPS_GetMyPos() finished in 296 ms. Result = (4540, 3375)
    [SPS] SPS_GetMyPos() finished in 281 ms. Result = (4540, 3375)
    [SPS] SPS_GetMyPos() finished in 281 ms. Result = (4545, 3425)
    [SPS] SPS_GetMyPos() finished in 296 ms. Result = (4540, 3430)
    [SPS] SPS_GetMyPos() finished in 297 ms. Result = (4540, 3430)
    [SPS] SPS_GetMyPos() finished in 281 ms. Result = (4540, 3430)
    [SPS] SPS_GetMyPos() finished in 265 ms. Result = (4505, 3465)
    [SPS] SPS_GetMyPos() finished in 281 ms. Result = (4505, 3465)
    [SPS] SPS_GetMyPos() finished in 265 ms. Result = (4505, 3470)
    [SPS] SPS_GetMyPos() finished in 265 ms. Result = (4505, 3470)
    [SPS] SPS_GetMyPos() finished in 281 ms. Result = (4500, 3515)
    [SPS] SPS_GetMyPos() finished in 296 ms. Result = (4500, 3520)
    [SPS] SPS_GetMyPos() finished in 265 ms. Result = (4500, 3520)
    [SPS] SPS_GetMyPos() finished in 280 ms. Result = (4500, 3520)
    [SPS] SPS_GetMyPos() finished in 281 ms. Result = (4500, 3525)
    [SPS] SPS_GetMyPos() finished in 344 ms. Result = (4500, 3525)
    [SPS] SPS_GetMyPos() finished in 296 ms. Result = (4480, 3585)
    [SPS] SPS_GetMyPos() finished in 343 ms. Result = (4505, 3615)
    [SPS] SPS_GetMyPos() finished in 296 ms. Result = (4540, 3675)
    [SPS] SPS_GetMyPos() finished in 281 ms. Result = (4545, 3675)
    [SPS] SPS_GetMyPos() finished in 281 ms. Result = (4595, 3675)
    [SPS] SPS_GetMyPos() finished in 280 ms. Result = (4640, 3675)
    askldfaklsdkljasd
    Successfully executed.
    Works great! (aside the access violation error)

    Also a temporary solution to Access violation error is this: Right click simba.exe and choose run as administrator, then choose the SPS test script. (Applies atleast to windows Vista & 7)
    Rusting away

  11. #11
    Join Date
    Jan 2012
    Location
    Vilnius, Lithuania
    Posts
    33
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Smidqe View Post
    Also a temporary solution to Access violation error is this: Right click simba.exe and choose run as administrator, then choose the SPS test script. (Applies atleast to windows Vista & 7)
    Works!

    However location finding in port sarim is still a bit buggy.

  12. #12
    Join Date
    Feb 2006
    Location
    Canada
    Posts
    2,254
    Mentioned
    21 Post(s)
    Quoted
    238 Post(s)

    Default

    Awesome work guys!

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

    Default

    Sorry I never got around to removing all the !s but thanks for the credits Hopefully going to use this in some dungeons soon.

  14. #14
    Join Date
    Oct 2007
    Location
    The deep web
    Posts
    2,496
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Sexy as ever @Marpis, just a quickie, Can this be used to walk from the runescape surface into a dungeon and carry on walking? (chaos tunnel)

    Multiple surfaces?
    Did someone say GDK?

  15. #15
    Join Date
    Jan 2012
    Location
    Vilnius, Lithuania
    Posts
    33
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by jakeyboy29 View Post
    Sexy as ever @Marpis, just a quickie, Can this be used to walk from the runescape surface into a dungeon and carry on walking? (chaos tunnel)

    Multiple surfaces?
    You will have to use SPS_Setup() again with different surface.

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

    Default

    Nice marpis! The Access Violation was fixed, though. You need to add some memory code to your plugin so it works properly. I don't know exactly what it is, but talk to Wizzup? or Markus, they know.

  17. #17
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    Time for some quests?
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  18. #18
    Join Date
    Dec 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    thank you for all youre work on this website =)

  19. #19
    Join Date
    Oct 2007
    Location
    The deep web
    Posts
    2,496
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by chemicstry View Post
    You will have to use SPS_Setup() again with different surface.
    thanks rep+

    Quote Originally Posted by go9090go View Post
    thank you for all youre work on this website =)
    your* :P sorry for being a grammer nazi
    Did someone say GDK?

  20. #20
    Join Date
    Dec 2008
    Posts
    160
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yay! can't wait Ill test when I get home from school
    My Soul Wars Scipt Proggress:[100%....]
    Probably won't release though I like it for myself

  21. #21
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Nice marpis! The Access Violation was fixed, though. You need to add some memory code to your plugin so it works properly. I don't know exactly what it is, but talk to Wizzup? or Markus, they know.
    You have to use the ShareMem that simba exports. It should be in the source of SPS 1....

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

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

    Default

    Quote Originally Posted by Shuttleu View Post
    so is this what was going to be SPS 2.0?

    ~shut
    Eventually, yes.

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

    Default

    Quote Originally Posted by Shuttleu View Post
    so is this what was going to be SPS 2.0?

    ~shut
    The amount of work needed to do all the things I have planned is overwhelming, so I decided to release several versions with something little added to each one.

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

    Default

    Quote Originally Posted by mormonman View Post
    You have to use the ShareMem that simba exports. It should be in the source of SPS 1....
    Got it.

    Marpis, add this to your plugin to get rid of the access violations:
    Pascal Code:
    procedure SetPluginMemoryManager(MemMgr : TMemoryManager); stdcall; export;
    begin
      SetMemoryManager(MemMgr);
    end;

    exports SetPluginMemoryManager;
    I'm pretty sure that's all you have to do. Simba will do the rest.

Page 1 of 4 123 ... LastLast

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
  •