Results 1 to 7 of 7

Thread: Invent outline help

  1. #1
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default Invent outline help

    EDIT 3 :
    Simba Code:
    program new;
    {$i SRL/srl.simba}
    {$i srl/srl/misc/debug.simba}

    function InvEdges(SlotFrom, SlotTo, _Tol: Integer): T2DPointArray;
    var
      i: integer;
      temp: TPointArray;
    begin
      i := 1;
      for i := SlotFrom to SlotTo do
      begin
        FindColorsTolerance(temp, 131072, invbox(i).x1, invbox(i).y1, invbox(i).x2, invbox(i).y2, _Tol);
        result := TPAtoATPA(temp, CoordsToItem(ItemCoords(i).x, ItemCoords(i).y));
        inc(i);
      end;
    end;

    begin
      SetupSRL;
      ActivateClient;
      WriteLn(InvEdges(1, 2, 1));
      DebugATPA(InvEdges(1, 2, 1), 'Tester');
    end.
    ^ I'm liking this code, however my T2DPointArray only debugs 1 item... I was intending for multiple items, as in 28 items in the Debug ATPA :/




    I'm trying to make a T2DPointArray for the black outline of dots in my inventory. So if I wanted slots 1 to 10, I'd get a tpa of the black outline for each slot and then a T2DPointArray for the black outline of those slots from 1 to 10.

    I can't seem to get a desired result for the function, and help/advice/input would be much appreciated.

    Ideally I'm trying to get this result, then compare it to a predefined T2DPointArray to use as one of multiple checks for inventory items.

    Cheers,
    Lj
    Last edited by Le Jingle; 08-03-2012 at 04:55 PM.

  2. #2
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Updated my progress.. Main idea I want to say here is pay attention to the Edit 3 over anything else (multiple idea's present in the edits, but it shows progress, it also helps give some background on what I'm trying to accomplish).

  3. #3
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Erm night's sleep on this, yet I'm still getting one image debug in the ATPA, I suppose I'll scan through the TPA's and see if I'm overlooking something. Currently I get this;

    (it looks like I'm only grabbing 1 inventory slot and T2DPointArray'ing it)

    Edit: Improvement? I can grab one TPA for the item, but it only grabs/debugs the last item specified. (If I said from slots 1 to 2, it will only grab the 2nd slot.)

    Simba Code:
    function InvEdges(SlotFrom, SlotTo, _Tol: Integer): T2DPointArray;
    var
      i: integer;
      temp: TPointArray;
      gather: T2DPointArray;
    begin
      for i := SlotFrom to SlotTo do
      begin
        FindColorsTolerance(temp, 131072, invbox(i).x1, invbox(i).y1, invbox(i).x2, invbox(i).y2, _Tol);
        gather := SplitTPAEx(temp, 42, 35);
    //    result := TPAtoATPAEx(temp, CoordsToItem(ItemCoords(i).x, ItemCoords(i).y));
      end;
      result := gather;
    end;
    Last edited by Le Jingle; 08-03-2012 at 05:26 PM.

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

    Default

    Simba Code:
    procedure RAaSTPAEx(var a: TPointArray; const w, h: Integer);

    Have you tried using this?

  5. #5
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Quote Originally Posted by Wreck View Post
    Simba Code:
    procedure RAaSTPAEx(var a: TPointArray; const w, h: Integer);

    Have you tried using this?
    No, but I don't think I need to?
    I'm ultimately trying to '' add '' my TPA outlines to the ATPA as pre-defined by the slotfrom .. slotto in the function's start. Still scratching my head / testing out faulty combo's whilst reading WizzyPlugins :s

  6. #6
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Maybe you could try something like this?

    Simba Code:
    function InvEdges(SlotFrom, SlotTo, _Tol: Integer): T2DPointArray;
    var
      Num, i: integer;
      Box: TBox;
    begin
      Num := SlotTo - SlotFrom;
      SetLength(Result, Num + 1);
      for i := 0 to Num do
      begin
        Box := InvBox(SlotFrom + i);
        FindColorsTolerance(Result[i], 131072, Box.x1, Box.y1, Box.x2, Box.y2, _Tol);
      end;
    end;

  7. #7
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    jeez >.<
    I even talked about looking into your TPAsegment bit in my first 2 edits (I think I was too stubborn to find a working connection).

    Nonetheless, this is why you amaze me and continuously help me learn, TYYY!
    ++

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
  •