SCAR Code:
{*******************************************************************************
function GetAmount(itemx, itemy: Integer): Integer;
By: masquerader || Improved by Freddy1990 ||Updated June 4 2007 by Boreas
Description: Returns the ammount of an item at a certain position.
*******************************************************************************}
function GetAmount(itemx, itemy: Integer): Integer;
//uses font cropped to work with "Opponent's Offer"
//coords are same as ones from istextinarea, but
//you probably shouldnt use this function directly (others use it)
//'K' and 'M' work (for approx values)
//non-stackable =1
//blank = 0
var
amountstr: string;
tempx, tempy, color: Integer;
begin
if findcolor(tempx, tempy, 65535, itemx, itemy, itemx + 10, itemy + 10) then
color := 65535;
if color = 0 then
if findcolor(tempx, tempy, 16777215, itemx, itemy, itemx + 10, itemy + 10) then
color := 16777215;
if color = 0 then
if findcolor(tempx, tempy, 8453888, itemx, itemy, itemx + 10, itemy + 10) then
color := 8453888;
amountstr := Trim(GetTextAtEx(itemx + 1, itemy + 3, 0, tradeChars, False, False,
0, 2, color, 5, True, tr_AlphaNumericChars));
if (Length(amountstr) > 0) then
begin
if (Pos('K', amountstr) > 0) then
begin
Delete(amountstr, Length(amountstr), Length(amountstr));
Result := StrToInt(amountstr) * 1000;
end else
if (Pos('M', amountstr) > 0) then
begin
Delete(amountstr, Length(amountstr), Length(amountstr));
Result := StrToInt(amountstr) * 1000000;
end else
Result := StrToInt(amountstr);
end else
if (FindColor(tempx, tempy, 65536, itemx, itemy, itemx + 30, itemy + 30)) then
Result := 1;
end;