SRL Archive - SRL Bugs

GetAmount out of range (line 120)


marpis

2009-05-14 22:40:56


[Runtime Error] : Out Of Range in line 120 in script D:\RSCHEAT\scar\SCAR 3.20\includes\SRL/SRL/Core/Amount.scar

and here's my function:
edit: Narcles function, tbh

function GetArrowCount:integer;
begin
gametab(5);
result := GetAmount(666, 249);
end;

Sir R. M8gic1an

2009-05-14 23:29:47

the error is in amount.scar, not in your script.

I checked out that function, and at least in the opendev rev i see no thing which would cause such error.

~RM

marpis

2009-05-14 23:58:31

From: Rasta Magician
the error is in amount.scar, not in your script.

I checked out that function, and at least in the opendev rev i see no thing which would cause such error.

~RM


Im not so sure what rev i have, i think 32, but here's the function from amount.scar


{*******************************************************************************
function GetAmount(ItemX, ItemY: Integer): Integer;
By: ZephyrsFury
Description: Returns the amount of an item at coordinates (ItemX, ItemY).
Returns approximate values for 'K' and 'M'.
*******************************************************************************}

function GetAmount(ItemX, ItemY: Integer): Integer;
var
S: string;
X, Y, Col, II: Integer;
B: TBox;
colPts: TPointArray;
ATPA: T2DPointArray;
begin
if (FindColor(X, Y, 65536, ItemX - 10, ItemY - 10, ItemX + 10, ItemY + 10)) then
begin
Result := 1;
for II := 2 downto 0 do
if (FindColorsTolerance(colPts, 7575987 * II * II - 6796134 * II + 65535, ItemX - 20, ItemY - 30, ItemX + 20, ItemY + 10, 0)) then
Break;
if (II > 2) then Exit;
ATPA := SplitTPAEx(colPts, 5, 5);
SortATPASize(ATPA, True);
colPts := ATPA[0];
Col := 7575987 * II * II - 6796134 * II + 65535;
B := GetTPABounds(colPts);
S := Trim(GetTextAtEx(B.X1, B.Y1 - 1, 0, StatChars, False, False, 0, 1, Col, 5, True, tr_AllChars));
Result := StrToIntDef(GetNumbers(S), 1);
if (Pos('M', S) > 0) then Result := Result * 1000000;
if (Pos('K', S) > 0) then Result := Result * 1000;
end;
end;

Sir R. M8gic1an

2009-05-15 00:20:11


{*******************************************************************************
function GetAmount(ItemX, ItemY: Integer): Integer;
By: ZephyrsFury
Description: Returns the amount of an item at coordinates (ItemX, ItemY).
Returns approximate values for 'K' and 'M'.
*******************************************************************************}

function GetAmount(ItemX, ItemY: Integer): Integer;
var
S: string;
Col, II: Integer;
B: TBox;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if (FindColorsTolerance(TPA, 65536, ItemX - 50, ItemY - 50, ItemX + 50, ItemY + 50, 0)) then
begin
ATPA := SplitTPAEx(TPA, 5, 5);
SortATPAFromFirstPoint(ATPA, Point(ItemX, ItemY));
B := GetTPABounds(ATPA[0]);
if (Length(ATPA[0]) < 15) or (B.X2 - B.X1 < 5) or (B.Y2 - B.Y1 < 5) then Exit;
Result := 1;
for II := 2 downto 0 do
if (FindColorsTolerance(TPA, 7575987 * II * II - 6796134 * II + 65535, B.X1 - 10, B.Y1 - 10, B.X2 + 10, B.Y2 + 10, 0)) then
Break;
if (II < 0) then Exit;
ATPA := SplitTPAEx(TPA, 5, 5);
SortATPAFrom(ATPA, Point((B.X1 + B.X2) shr 1, (B.Y1 + B.Y2) shr 1));
TPA := ATPA[0];
Col := 7575987 * II * II - 6796134 * II + 65535;
B := GetTPABounds(TPA);
S := Trim(GetTextAtEx(B.X1, B.Y1 - 1, 0, StatChars, False, False, 0, 1, Col, 5, True, tr_AllChars));
Result := StrToIntDef(GetNumbers(S), 1);
if (Pos('M', S) > 0) then Result := Result * 1000000 else
if (Pos('K', S) > 0) then Result := Result * 1000;
end;
end;

http://www.villavu.com/repositories/srl-opendev/SRL/core/Amount.scar

~RM

marpis

2009-05-15 17:31:11

I found another one:
[Runtime Error] : Exception: Access violation at address 0385D27B in module 'WizzyPlugin.dll'. Read of address 17FA8000 in line 507 in script D:\RSCHEAT\scar\SCAR 3.20\includes\SRL/SRL/Core/Text.scar

i don't know what the script was doing when this occurred.

Naum

2009-05-15 17:34:32

That sometimes happens, it's a problem with WizzyPlugin, I think the FindTPAinTPA.

Just restart the script w/e :)

Sir R. M8gic1an

2009-05-15 18:49:07

before you call whatever caused that do:


try
//...
except end;

EvilChicken!

2009-05-15 18:56:26

That last error you got sounds like you might have forgotten to set the nickname of a player.

marpis

2009-05-15 20:22:47

From: EvilChicken!
That last error you got sounds like you might have forgotten to set the nickname of a player.


hmm, maybe i have used an invalid nick.
i do it automatically in my script, like
players.nick := copy(mFighter.name, 2, 4);
or something like that…

weird that this was the 1st time that happened and ive been using it for like a month now