SRL Archive - OSR Help

Invent outline help


Le Jingle

2012-08-02 23:15:43

EDIT 3 :

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

Le Jingle

2012-08-03 03:14:58

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).

Le Jingle

2012-08-03 12:58:41

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.)

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;

Wreck

2012-08-03 13:05:14

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

Have you tried using this?

Le Jingle

2012-08-03 14:49:02

From: Wreck
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

Runaway

2012-08-03 14:59:07

Maybe you could try something like this?


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;

Le Jingle

2012-08-03 15:06:36

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!
++