In the amount include the function CoinAmount and FindCoins does not work. I have tried with coins in bank/inventory neither of which work so I am assuming trades wont work either. I have prior programming knowledge but I'm new to SRL scripting so I can't debug the function myself to fix it.
Simba Code:
function FindCoins(var X, Y: Integer; Area: string): Boolean;
var
B: TBox;
CTS, I, J, H, L: Integer;
Pts, tPts: TPointArray;
ATPA: T2DPointArray;
V: array [0..1] of TVariantArray;
begin
case Lowercase(Area) of
'inv', 'inventory': B := IntToBox(MIX1, MIY1, MIX2, MIY2);
'bank': B := IntToBox(MBx1, MBy1, MBx2, MBy2);
'trade': B := IntToBox(323, 73, 509, 302);
'your trade': B := IntToBox(9, 73, 196, 302);
end;
V[0] := [1479346, 1, 0.00, 0.00]; //Darker colour (top of coins)
V[1] := [3722229, 7, 0.05, 0.86]; //Lighter colour (rest of the coins)
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetLength(tPts, 0);
try
for I := 0 to 1 do
begin
SetColorSpeed2Modifiers(V[I][2], V[I][3]);
FindColorsTolerance(Pts, V[I][0], B.X1, B.Y1, B.X2, B.Y2, V[I][1]);
if (Length(Pts) < 10) then Exit;
ATPA := SplitTPAEx(Pts, 10, 10);
h := High(ATPA);
L := High(tPts) + 1;
SetLength(tPts, L + h + 1);
for J := 0 to H do
tPts[L + j] := MiddleTPA(ATPA[J]);
end;
ATPA := SplitTPAEx(tPts, 20, 20);
H := High(ATPA);
for I := 0 to H do
if (High(ATPA[I]) = 1) then
Break;
if (I > H) then Exit;
Result := True;
MiddleTPAEx(ATPA[I], X, Y);
finally
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
end;
Thanks. The line of code I am using to test this is as shown below.
Simba Code:
WriteLn('Coins found: '+toStr(CoinAmount('inv')));