
Originally Posted by
Narcle
Do you have this get amount? Its in Dev svn.
SCAR Code:
{*******************************************************************************
function GetAmount(ItemX, ItemY: Integer): Integer;
By: Zeph, N1ke & Narcle
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
Col: TIntegerArray;
X, Y, I: Integer;
B: TBox;
TPA: TPointArray;
S: String;
begin
Result := 0;
If Not FindColor(X, Y, 65536, ItemX-30, ItemY-30, ItemX+30, ItemY+30)then
Exit;
Inc(Result);
Col := [65535, 16777215, 8453888];
For I:=0 to 2 do
If FindColor(X, Y, Col[I], ItemX-22, ItemY-22, ItemX+22, ItemY+22)then
begin
FindColors(TPA, Col[i], ItemX-22, ItemY-22, ItemX+22, ItemY+22);
B := GetTPABounds(TPA);
S := Trim(GetTextAtEx(B.X1-1, B.Y1-1, 0, StatChars, False, False, 0, 1, Col[I], 5, True, tr_AllChars));
Result := StrToIntDef(GetNumbers(S), 1);
Case I of
1: Result := Result * 1000;
2: Result := Result * 1000000;
end;
Exit;
end;
end;
I just updated today. I should.
SCAR Code:
{*******************************************************************************
function GetAmount(ItemX, ItemY: Integer): Integer;
By: Zeph, N1ke & Narcle
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
Col: TIntegerArray;
X, Y, I: Integer;
B: TBox;
TPA: TPointArray;
S: String;
begin
Result := 0;
If Not FindColor(X, Y, 65536, ItemX-30, ItemY-30, ItemX+30, ItemY+30)then
Exit;
Inc(Result);
Col := [65535, 16777215, 8453888];
For I:=0 to 2 do
If FindColor(X, Y, Col[I], ItemX-22, ItemY-22, ItemX+22, ItemY+22)then
begin
FindColors(TPA, Col[i], ItemX-22, ItemY-22, ItemX+22, ItemY+22);
B := GetTPABounds(TPA);
S := Trim(GetTextAtEx(B.X1-1, B.Y1-1, 0, StatChars, False, False, 0, 1, Col[I], 5, True, tr_AllChars));
Result := StrToIntDef(GetNumbers(S), 1);
Case I of
1: Result := Result * 1000;
2: Result := Result * 1000000;
end;
Exit;
end;
end;
Same thing, no?
It returns 1 for the amount of coins instead of 33477.
PHP Code:
Creating the NickTPA.
Found Coins
Amount: 1
Cost is: 83
Going to buy: 0