Results 1 to 15 of 15

Thread: NXT Dynamic Interfaces

  1. #1
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default NXT Dynamic Interfaces

    These functions will find various interfaces within the resize-able NXT client. I will add more if they are requested and I have the time.

    Backpack

    Requirements: The entire backpack is uncovered, all 28 slots are visible (i.e. no scrollbar), total width less than 1135.

    function FindBackpack(out Bounds: TBox): Boolean;
    Finds the backpack by searching for bitmaps, outputs the bounds as a TBox, and returns a Boolean.
    Takes ~20 ms.

    function LoadSlotBoxes(const Bounds: TBox; const FileName: String): TBoxArray;
    Given the previously found bounds, returns a TBoxArray of the 28 slots by loading a preset from a text file, found here: Slots.txt
    Note: these boxes are the correct visual bounds. If you want the correct clickable bounds, then shrink by 3 pixels.
    Takes ~2 ms.

    (you can ignore the Grid functions if using SRL-6)

    Simba Code:
    1. //https://github.com/SRL/SRL-6/blob/d5817b11a391940d12180740a914a4cf5d72b204/lib/utilities/math.simba#L59
    2. function GridBox(Slot, Columns, Rows, w, h, DiffX, DiffY: Int32; StartPoint: TPoint): TBox;
    3. begin
    4.   Result.x1 := (StartPoint.x + ((Slot mod Columns) * DiffX) - (w div 2));
    5.   Result.y1 := (StartPoint.y + ((Slot div Columns) * DiffY) - (h div 2));
    6.   Result.x2 := (Result.x1 + w);
    7.   Result.y2 := (Result.y1 + h);
    8. end;
    9.  
    10. function Grid(Columns, Rows, w, h, DiffX, DiffY: Int32; StarTPoint: TPoint): TBoxArray;
    11. var
    12.   i: integer;
    13. begin
    14.   SetLength(Result, (Columns * Rows));
    15.  
    16.   for i := 0 to High(Result) do
    17.     Result[i] := GridBox(i, Columns, Rows, w, h, DiffX, DiffY, StarTPoint);
    18. end;
    19.  
    20. function FindBackpack(out Bounds: TBox): Boolean;
    21. const
    22.   LINE_COLOR = 6247745;
    23.   HEADER_COLOR = 332333;
    24.   HEADER_TOL = 9;
    25. var
    26.   i, j, x, y, w, h, CoinBMP, PackBMP, DownBMP, CloseBMP: Int32;
    27.   TPA, TPA2: TPointArray;
    28.   ATPA, ATPA2: T2DPointArray;
    29. begin
    30.   GetClientDimensions(w, h);
    31.   CoinBMP := BitmapFromString(9, 9, 'meJzrufGz58bPSbd/A1HNvgcO5fOU' +
    32.             '0jvNeteaTdjSgyQ14+6/RY//S0TUaVcvBqLOq1+ACCIFZEy9/lEqr' +
    33.             'gMortu8zqF3mdOElUZNqx2m7M/bead48yUOs3TxoEagiFHVdKPKOc' +
    34.             'oFc4AqoxYc7T7/mtMyhc8pVzF7pm3fartJ64FqLHt3AqWAulgNooC' +
    35.             'ycskTgVqMaxZAdAENrNx5Ay6lVz0PKAg3sOHgPbiBQPdbTtkGdA/Q' +
    36.             'QIgzILokI9sAFPp7uw==');
    37.  
    38.   PackBMP := BitmapFromString(10, 10, 'meJyTt26Vt261cGoBIgkVcyACcl' +
    39.             'VssyEImQ1EQFlRdV+gIJAEclkFlZDVAAUh4rxigUCGmIg0EwsvRAQ' +
    40.             'iBRQBsoNrVwDNgWhh5RcGGgLkArUAZeUyuor33oiacwziDIhFQDbQ' +
    41.             'HCBpWLpYVLXQOmQlxBnILgRygXpB9qoWQmThjgEioHa1hCKT7pUQq' +
    42.             '5EVgJBqIVANUNbn0E02FVW4H4EBArQLiIDGAh0JFAQAJ5hHLw==');
    43.  
    44.   DownBMP := BitmapFromString(10, 8, 'meJzLuP2r49ZnBgyQvuKaUc9Z51N' +
    45.             'fM6/+rL35qweMWs99Kdn1OHbtXbupF9kKDljvewNU4H/6R+QJEArc' +
    46.             '9cF8znXlnnNcVUdYs3caLz1vtvkxUI3p7m9ApLbitVDneaAUR/YOj' +
    47.             'piFQCu0Z5zWX/nQeMtbo+1fgbKCjSd4inezxy2Fu0Fr+imgAu1Vr5' +
    48.             'Vn3UOTggDl7iNAKanuCzzJSzC9AAQKjXulyrcjiwAAiq5bTg==');
    49.  
    50.   CloseBMP := BitmapFromString(10, 10, 'meJzj4PFh5U6GIDauLAiCcDnAUm' +
    51.              'y8NRyCzZgIqoW3Ju3YF5Os3eyCnUAEZAC5EFkWzmigrHbKzoyL/4D' +
    52.              'iQARhsPM1wWUhCkKP/QEiIAMoBRSBynKXANlyMdvsd/4GIiADoh4o' +
    53.              'xcIWBHSkaOB6jdW/xEI2AxGEAdQClxWe/J7HdwPIEO4SIAPIBQoCp' +
    54.              'VhYfBGeZYf6F8hgZU8HSnFymANJBAKrhyCgFAAg/Uys');
    55.  
    56.   try
    57.     if FindColors(TPA, LINE_COLOR, 0, 0, w-1, h-1) then
    58.     begin
    59.       ATPA := ClusterTPA(TPA, 1);
    60.       for i := 0 to High(ATPA) do
    61.       begin
    62.         Bounds := GetTPABounds(ATPA[i]);
    63.         if (Bounds.Y2 = Bounds.Y1) then
    64.         begin
    65.           Bounds.Y2 := Min(h-1, Bounds.Y2 + 35);
    66.           if FindBitmapToleranceIn(CoinBMP, x, y, Bounds.X1, Bounds.Y1, Bounds.X2, Bounds.Y2, 0) then
    67.           begin
    68.             Bounds.X1 := Max(0, Bounds.X1 - 4);
    69.             Bounds.X2 := Min(w-1, Bounds.X2 + 4);
    70.  
    71.             if FindBitmapIn(PackBMP, x, y, 0, 0, Bounds.X2, Bounds.Y2) then
    72.             begin
    73.               Bounds.Y1 := y + 15;
    74.             end else
    75.             if FindBitmapIn(CloseBMP, x, y, Bounds.X2 - 15, 0, Bounds.X2 + 5, Bounds.Y2 - 85) then
    76.             begin
    77.               Bounds.Y1 := y + 11;
    78.             end else
    79.             begin
    80.               WriteLn('Backpack error: didn''t find Red X or Backpack bitmap.');
    81.               Exit;
    82.             end;
    83.  
    84.             if FindBitmapToleranceIn(DownBMP, x, y, Bounds.X1, Bounds.Y1, Bounds.X2, Bounds.Y2, 5) then
    85.             begin
    86.               WriteLn('Backpack error: not all slots visible.');
    87.               Exit;
    88.             end;
    89.  
    90.             Exit(True);
    91.           end else
    92.           begin
    93.             WriteLn('Backpack error: didn''t find Coin bitmap.');
    94.           end;
    95.         end;
    96.       end;
    97.     end;
    98.   finally
    99.     FreeBitmap(CoinBMP);
    100.     FreeBitmap(PackBMP);
    101.     FreeBitmap(DownBMP);
    102.     FreeBitmap(CloseBMP);
    103.   end;
    104. end;
    105.  
    106. function LoadSlotBoxes(const Bounds: TBox; const FileName: String): TBoxArray;
    107. var
    108.   i, Width, Cols, Rows, SpaceX: Int32;
    109.   GridPoint: TPoint;
    110.   SS: TStringArray;
    111.   List: TStringList;
    112. begin
    113.   Width := Bounds.X2 - Bounds.X1 + 1;
    114.   Cols := 2 + (Width - 94) div 40;
    115.   Rows := Ceil(28 / Cols);
    116.  
    117.   if (not FileExists(FileName)) then
    118.   begin
    119.     WriteLn('Backpack slots error: didn''t find Slots.txt');
    120.     Exit;
    121.   end;
    122.   List.Init();
    123.   try
    124.     List.LoadFromFile(FileName);
    125.     for i := 0 to (List.GetCount() - 1) do
    126.     begin
    127.       SS := Explode(#9, List.GetStrings(i));
    128.       if (Length(SS) <> 3) then
    129.       begin
    130.         WriteLn('Backpack slots error reading Slots.txt');
    131.         Exit;
    132.       end;
    133.       if SameText(IntToStr(Width), SS[0]) then
    134.       begin
    135.         GridPoint.X := Bounds.X1 + StrToInt(SS[1]) + 19;
    136.         SpaceX := StrToInt(SS[2]);
    137.         Break;
    138.       end;
    139.     end;
    140.   finally
    141.     List.Free();
    142.   end;
    143.   if (SpaceX < 1) then
    144.   begin
    145.     WriteLn('Backpack slots error: didn''t Width in find Slots.txt');
    146.     Exit;
    147.   end;
    148.  
    149.   GridPoint.Y := Bounds.Y1 + 6 + 16;
    150.   Result := Grid(Cols, Rows, 37, 33, SpaceX, 36, GridPoint);
    151.   SetLength(Result, 28);
    152. end;
    Results (the exact bounds and slots found by the functions):





    Minimap

    Requirements: Don't cover the corners of the minimap, other than that it should work anywhere at any size.

    function FindMinimap(out Bounds: TBox): Boolean;
    Finds the minimap by searching for bitmaps, outputs the bounds as a TBox, and returns a Boolean.
    Takes ~20 ms.

    Simba Code:
    1. function FindMinimap(out Bounds: TBox): Boolean;
    2. var
    3.   x, y, w, h, TP_BMP, LG_BMP: Int32;
    4. begin
    5.   GetClientDimensions(w, h);
    6.  
    7.   TP_BMP := BitmapFromString(9, 9, 'meJw7u2JapmXM2ekzPt3dD0RHdq4E' +
    8.            'siEIKP5kx7yvl7YA2e2eBWX2qXAEFH9zbNX8kkygGjQEVD8rLj3e1' +
    9.            'B8ZQaT2T6yGcP21XH9//wpEyAog4nApCBuI4OJwKSclKwiCiwPZEC' +
    10.            'kraUNMqa+PLiMjAPyxc2A=');
    11.  
    12.   LG_BMP := BitmapFromString(10, 10, 'meJzza1uWtflq8c6baAgo6Ne2zG' +
    13.            'HuiczLP5rv/EJDQEGglGLvAesDr0QiJyEjk6kH3fb+UJl4WLhls+z' +
    14.            'aGxAkPvs4T8ZsIIPdu1Zlx1OgFFfdWsG1t4HiXGHTGOwLgAjIhZBA' +
    15.            'KYHCpWKzLwOVAdUzmMQCEZALIYFSsilL9LvPW02/BkSqVdt47fKAX' +
    16.            'AYtbyAJlJKPXqZYd4JBwRIZAc0BCgJlgS6UKNollr1aMHMpnASKAB' +
    17.            'FQCmgU0D1YEVAKAJUng5Y=');
    18.  
    19.   try
    20.     if FindBitmap(TP_BMP, x, y) then
    21.     begin
    22.       Bounds.X1 := Max(0, x - 16);
    23.       Bounds.Y2 := Min(h-1, y + 34);
    24.       if FindBitmap(LG_BMP, x, y) then
    25.       begin
    26.         Bounds.X2 := Min(w-1, x + 10);
    27.         Bounds.Y1 := Max(0, y + 11);
    28.         Result := True;
    29.       end;
    30.     end;
    31.   finally
    32.     FreeBitmap(TP_BMP);
    33.     FreeBitmap(LG_BMP);
    34.   end;
    35. end;
    Results (the exact bounds found by the function):





    Chatbox

    Requirements: have "All Chat" as your first tab, don't hide the corners of the chatbox

    function FindChatbox(out Bounds: TBox): Boolean;
    Finds the chatbox by searching for bitmaps, outputs the bounds as a TBox, and returns a Boolean.
    Takes ~60 ms.

    Simba Code:
    1. function FindChatbox(out Bounds: TBox): Boolean;
    2. var
    3.   x, y, w, h, ChatBMP, DownBMP, GrayBMP, YellowBMP: Int32;
    4. begin
    5.   GetClientDimensions(w, h);
    6.  
    7.   GrayBMP := BitmapFromString(8, 8, 'meJxjYICClt4JC5avgiOIYEVT6+S5' +
    8.             'CyCod9pMIAIKZpWWAxlA9cgoKjkNqBgT2bl6hMTEYyKgOUAp39BIT' +
    9.             'HGIFIQLNBaCYM5ElwIAmjFFZg==');
    10.  
    11.   YellowBMP := BitmapFromString(8, 8, 'meJxjYIAC46XH9fa9gCOIoPySvRCu' +
    12.               '/NbHEAQUlJ68AcIWWXcPjtjrVkIYHKvuIyPZxBmaHRcwEdAcoJR89' +
    13.               'WGl+jNo4nApiCwEwZzJIBQ7VaZoL1wKAHR0Tuo=');
    14.  
    15.   ChatBMP := BitmapFromString(9, 9, 'meJz7c6Xzz5XO7oZ4ICoqjrEpj1Wb' +
    16.             'WgNE0sle17cEAqXsJuewxhUBxYEMiBSbmz5QCqgeKAIUZ2gIVayKA' +
    17.             'up1cvdk0TS7lK1kVGeeGWsyq0gcSALNUUsoAiJmG3cgF0jyhCfaO5' +
    18.             'hCZIHauZoXsjiHARHQFubCLiACMoC6gGqAKoEGcjllAEXkMrqAKiE' +
    19.             'K5Gz8pRSEmdJcgbJAjUBlECuADKD5jGsrgSjZgN9QXwdoCFCxmJup' +
    20.             'jJIa0NlAcaBrAbHUTng=');
    21.  
    22.   DownBMP := BitmapFromString(10, 8, 'meJzLuP2r49ZnBgyQvuKaUc9Z51N' +
    23.             'fM6/+rL35qweMWs99Kdn1OHbtXbupF9kKDljvewNU4H/6R+QJEArc' +
    24.             '9cF8znXlnnNcVUdYs3caLz1vtvkxUI3p7m9ApLbitVDneaAUR/YOj' +
    25.             'piFQCu0Z5zWX/nQeMtbo+1fgbKCjSd4inezxy2Fu0Fr+imgAu1Vr5' +
    26.             'Vn3UOTggDl7iNAKanuCzzJSzC9AAQKjXulyrcjiwAAiq5bTg==');
    27.  
    28.   try
    29.     if (FindBitmap(GrayBMP, x, y) or FindBitmap(YellowBMP, x, y)) then
    30.     begin
    31.       Bounds.X1 := Max(0, x - 6);
    32.       Bounds.Y1 := y + 14;
    33.     end else
    34.     if FindBitmap(ChatBMP, x, y) then
    35.     begin
    36.       Bounds.X1 := Max(0, x - 20);
    37.       Bounds.Y1 := y + 15;
    38.     end else
    39.     begin
    40.       WriteLn('Chatbox error: didn''t find All Chat or Left Arrow');
    41.       Exit;
    42.     end;
    43.     if FindBitmapToleranceIn(DownBMP, x, y, Bounds.X1, Bounds.Y1, w-1, h-1, 9) then
    44.     begin
    45.       Bounds.X2 := Min(w-1, x + 16);
    46.       Bounds.Y2 := Min(h-1, y + 35);
    47.       Result := True;
    48.     end else
    49.     begin
    50.       WriteLn('Chatbox error: didn''t find Down Arrow');
    51.       Exit;
    52.     end;
    53.   finally
    54.     FreeBitmap(GrayBMP);
    55.     FreeBitmap(YellowBMP);
    56.     FreeBitmap(ChatBMP);
    57.     FreeBitmap(DownBMP);
    58.   end;
    59. end;

    Results (the exact bounds found by the function):

    Last edited by Citrus; 03-15-2018 at 02:13 PM.

  2. #2
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    reserved

  3. #3
    Join Date
    Jun 2014
    Posts
    463
    Mentioned
    27 Post(s)
    Quoted
    229 Post(s)

    Default

    Nice work!
    Tsunami

  4. #4
    Join Date
    Oct 2007
    Posts
    187
    Mentioned
    7 Post(s)
    Quoted
    61 Post(s)

    Default

    This is some great stuff Citrus! How long have you been working with NXT?

  5. #5
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by klamor View Post
    This is some great stuff Citrus! How long have you been working with NXT?
    Just the few hours that it took to make these.

  6. #6
    Join Date
    Aug 2009
    Location
    Nova Scotia, Canada
    Posts
    604
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default

    Pretty impressive. Backpack does fail under a couple conditions. Namely if backpack is the only tab (so tab header is not visible) and interfaces are locked (hides close button). But how often are you going to run into that situation actually.
    Never ever approach a computer saying or even thinking "I will just do this quickly".

  7. #7
    Join Date
    Oct 2007
    Posts
    187
    Mentioned
    7 Post(s)
    Quoted
    61 Post(s)

    Default

    @Citrus have you made any further developments with dynamic interfaces?

  8. #8
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by klamor View Post
    @Citrus have you made any further developments with dynamic interfaces?
    Nope. Haven't given it a single thought since 03-15-2018 at 08:13 AM.
    All of these functions are super easy to make, if a bit tedious. It's just basic bitmaps and static offsets.

  9. #9
    Join Date
    Oct 2007
    Posts
    187
    Mentioned
    7 Post(s)
    Quoted
    61 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    Nope. Haven't given it a single thought since 03-15-2018 at 08:13 AM.
    All of these functions are super easy to make, if a bit tedious. It's just basic bitmaps and static offsets.
    I was speaking in terms of getting these functions put into an official SRL release, but I guess I neglected to mention that.
    Anyways, are you doing any botting in RS3? I'm getting back into things and trying to get a feel for who's working on what.

  10. #10
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by klamor View Post
    I was speaking in terms of getting these functions put into an official SRL release, but I guess I neglected to mention that.
    Anyways, are you doing any botting in RS3? I'm getting back into things and trying to get a feel for who's working on what.
    Nah, not really botting or gaming anymore. I've never had anything to do with the official includes, but anyone is free to use this stuff anywhere they want.

  11. #11
    Join Date
    Oct 2007
    Posts
    187
    Mentioned
    7 Post(s)
    Quoted
    61 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    Nah, not really botting or gaming anymore. I've never had anything to do with the official includes, but anyone is free to use this stuff anywhere they want.
    Alright, I did have to change the CoinsBMP, but after that everything with backpack seems to work wonderfully. I'm in the process of merging your code into SRL1.2/tabBackpack now.

    For anyone interested in downloading a copy of SRL-6 that includes these functions, they will be available on github soon. I will see about having these merged into the official SRL-6 once I get everything working nicely.

  12. #12
    Join Date
    Nov 2012
    Posts
    161
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    @klamor did you ever get this integrated?

  13. #13
    Join Date
    May 2012
    Posts
    499
    Mentioned
    23 Post(s)
    Quoted
    228 Post(s)

    Default

    Quote Originally Posted by nkd2009 View Post
    @klamor did you ever get this integrated?
    I did, it is public on my github and in our members section of discord.
    Just not ready for a proper release.

  14. #14
    Join Date
    Nov 2012
    Posts
    161
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    @thomas nice sweet i found it. Struggling to get SPS to work (duplicate declaration error) and backslots is giving error didnt find the slots.txt file but the file is in the srl6/lib/interfaces folder...still trying.

  15. #15
    Join Date
    May 2012
    Posts
    499
    Mentioned
    23 Post(s)
    Quoted
    228 Post(s)

    Default

    Quote Originally Posted by nkd2009 View Post
    @thomas nice sweet i found it. Struggling to get SPS to work (duplicate declaration error) and backslots is giving error didnt find the slots.txt file but the file is in the srl6/lib/interfaces folder...still trying.
    PM me on discord

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
  •