Results 1 to 6 of 6

Thread: Differentiating between identical looking invetory items

  1. #1
    Join Date
    May 2012
    Posts
    102
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Differentiating between identical looking invetory items

    Lets say i had 28 items in my inventory that all looked the same except one of them was called B while the other 27 were called A how could I search through them one by one and then writeln('Found Item') when the uptext B has been found.

    Simba Code:
    Procedure Example;
    var
      TPA: TPointArray;
      DTM: Integer;
    begin
      DTM := DTMFromString('1234');
      if FindDTMs(DTM, TPA, MIX1, MIY2, MIX2, MIY2) then
        begin

        end;
      FreeDTM(DTM);
    end;

    Is as far as I have managed to get
    Last edited by Wreck; 06-02-2012 at 06:07 PM.

  2. #2
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    If they are really identical as in the icon doesn't differ at all then you'll HAVE to check the uptext and even a human would have to do so. A better way would be to track the spots the certain item is in at the time it enters the inventory. You'd have to use the IsUpText or IsUpTextMultiCustom function .
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  3. #3
    Join Date
    Jul 2010
    Posts
    1,115
    Mentioned
    1 Post(s)
    Quoted
    10 Post(s)

    Default

    can i ask what the items are?

  4. #4
    Join Date
    May 2012
    Posts
    102
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bolshak25 View Post
    can i ask what the items are?
    Nothing special just Lletya teleport crystals.

  5. #5
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Solutions without RAASTPA can have multiple points for one object so I used it to narrow it down to a single point per object. ATPA's can be used but that's not even necessary.. I'd use solution 1 personally. Not only that but if you want more than one point per object, then remove the RAASTPA. It's pretty neat.

    Simba Code:
    Procedure Solution1;
    var
      TPA: TPointArray;
      DTM, I, L: Integer;
    begin
      DTM:= DTMFromString('.............');

      If FindDTMs(DTM, TPA, MIX1, MIY1, MIX2, MIY2) then
      begin
        RAASTPAEx(TPA, 10, 10);
        L:= High(TPA);

        For I:= 0 To L Do
        begin
          MMouse(TPA[I].X, TPA[I].Y, 0, 0);
          If IsUptextMultiCustom(['......', '.....', '.......']) then
            ClickMouse2(MOUSE_LEFT);
        end;
      end;

      FreeDTM(DTM);
    end;

    Procedure Solution2;
    var
      TPA: TPointArray;
      ATPA: T2DPointArray;
      DTM, I, L, X, Y: Integer;
    begin
      DTM:= DTMFromString('.............');

      If FindDTMs(DTM, TPA, MIX1, MIY1, MIX2, MIY2) then
      begin
        ATPA:= TPAToATPAEx(TPA, 10, 10);
        L:= High(ATPA);
        For I:= 0 To L Do
        begin
          RAASTPAEx(ATPA[I], 10, 10);
          MiddleTPAEx(ATPA[I], X, Y);
          MMouse(X, Y, 0, 0);
          If IsUptextMultiCustom(['......', '.....', '.......']) then
            ClickMouse2(MOUSE_LEFT);
        end;
      end;

      FreeDTM(DTM);
    end;
    Last edited by Brandon; 06-02-2012 at 06:16 PM.
    I am Ggzz..
    Hackintosher

  6. #6
    Join Date
    May 2012
    Posts
    102
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Solutions without RAASTPA can have multiple points for one object so I used it to narrow it down to a single point per object. ATPA's can be used but that's not even necessary.. I'd use solution 1 personally. Not only that but if you want more than one point per object, then remove the RAASTPA. It's pretty neat.

    Simba Code:
    Procedure Solution1;
    var
      TPA: TPointArray;
      DTM, I, L: Integer;
    begin
      DTM:= DTMFromString('.............');

      If FindDTMs(DTM, TPA, MIX1, MIY1, MIX2, MIY2) then
      begin
        RAASTPAEx(TPA, 10, 10);
        L:= High(TPA);

        For I:= 0 To L Do
        begin
          MMouse(TPA[I].X, TPA[I].Y, 0, 0);
          If IsUptextMultiCustom(['......', '.....', '.......']) then
            ClickMouse2(MOUSE_LEFT);
        end;
      end;

      FreeDTM(DTM);
    end;

    Procedure Solution2;
    var
      TPA: TPointArray;
      ATPA: T2DPointArray;
      DTM, I, L, X, Y: Integer;
    begin
      DTM:= DTMFromString('.............');

      If FindDTMs(DTM, TPA, MIX1, MIY1, MIX2, MIY2) then
      begin
        ATPA:= TPAToATPAEx(TPA, 10, 10);
        L:= High(ATPA);
        For I:= 0 To L Do
        begin
          RAASTPAEx(ATPA[I], 10, 10);
          MiddleTPAEx(ATPA[I], X, Y);
          MMouse(X, Y, 0, 0);
          If IsUptextMultiCustom(['......', '.....', '.......']) then
            ClickMouse2(MOUSE_LEFT);
        end;
      end;

      FreeDTM(DTM);
    end;
    Went with solution 1 as you advised worked perfectly thanks! Should be releasing my script within the next couple of days

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
  •