Le Jingle
2012-08-13 22:23:16
Hi, this post is: Me @query T2DIntegerArray's.
*** This was a function designed by Runaway ***
He seems to be inactive lately :< so I thought the community might be more responsive
I run into an 'Out of Range' error (posted in image below)
[—The //0 was the original code, but my 1 produces the same error—]

I'm having difficulty understanding if the MaxA isn't compatible with the for to do loop in the T2DIntegerArray.. or if I'm missing out on something obvious.
Here's the test script I'm using;
Edit : this was from him via a script (vcgrocktails), for the additive information. Extra info : I'm trying to hunk a wide variety cooking guild cooker,
*** This was a function designed by Runaway ***
He seems to be inactive lately :< so I thought the community might be more responsive
I run into an 'Out of Range' error (posted in image below)
[—The //0 was the original code, but my 1 produces the same error—]

I'm having difficulty understanding if the MaxA isn't compatible with the for to do loop in the T2DIntegerArray.. or if I'm missing out on something obvious.
Here's the test script I'm using;
{$i srl/srl.simba}
function WaitColorBox(WaitTime: Integer; Color, Min, Tol: TIntegerArray; Box: TBoxArray; Strict: Boolean): Boolean;
var
c: T2DIntegerArray;
TPA: TPointArray;
Temp: TIntegerArray;
hMax, hTemp, Count, h, hh, t, i: Integer;
hColor, hMin, hTol, hBox: Integer;
begin
if not LoggedIn then
Exit;
Result := False;
hColor := High(Color); // All of this hXXX bullshiz is just to allow for a special feature that
hMin := High(Min); // I've added into this. You can enter 2 search boxes and 1 of everything else
hTol := High(Tol); // and the function will search for the specified color, with the min and tol
hBox := High(Box); // values in both search boxes. It can be done vice versa as well.
Temp := [hColor, hMin, hTol, hBox];
hTemp := High(Temp);
hMax := MaxA(Temp);
SetLength(c, hMax + 1);
for h := 0 to hTemp do
begin
for hh := 0 to hMax do
begin
if (Temp[h] < 1) then
c[hh][h] := 1//0
else
c[hh][h] := hh;
end;
end;
MarkTime(t);
repeat
Count := 0;
for i := 0 to hMax do
begin
FindColorsTolerance(TPA, Color[c[i][0]], Box[c[i][3]].x1, Box[c[i][3]].y1, Box[c[i][3]].x2, Box[c[i][3]].y2, Tol[c[i][2]]);
if (Length(TPA) > Min[c[i][1]]) then
Inc(Count);
end;
if Strict then
begin
if (Count >= (hColor + 1)) then
begin
Result := True;
Exit;
end;
end else
begin
if (Count > 0) then
begin
Result := True;
Exit;
end;
end;
Wait(100+Random(50));
until(TimeFromMark(t) > WaitTime);
writeln('Reached the end of the "Wait Color Box" Function.');
end;
var
aBOX: TBoxArray;
begin
SetupSRL;
ActivateClient;
setlength(aiobox, 2);
aBox[0] := InvBox(1);
aBox[1] := InvBox(2);
if WaitColorBox(100, [1710098], [25], [15], [abox[0],abox[1]], true) then
writeln('true')
else
writeln('false');
end.
Edit : this was from him via a script (vcgrocktails), for the additive information. Extra info : I'm trying to hunk a wide variety cooking guild cooker,