i was having troubles with the P07 include and using the previous GetAmountBox, developed earlier in the thread, with it but I was able to edit it some more and now it works in the P07 include when ran with smart8- if anyone is intrested. sorry if grave digging, thought it would be useful to post on a relavent topic. idk maybe dannyrs will put it in the P07 include even though its about dead but i just called it GetAmountBox2
Code:
function GetAmountBox2(b: TBox): Integer; //Author Le Jingle, edited by ibot_dung11
var
i, m, x, y: Integer;
s: string; //String transformed into Integer
c: TIntegerArray; //Colors of gold money text
begin
Result := 0;
if not FindColor(x, y, 65536, b.X1, b.Y1, b.X2, b.Y2) then
Exit;
c := [65535, 65278, 16777215, 8453888];
for i := 0 to high(c) do
begin
s := GetTextAtExWrap(b.X1-2, b.Y1-2, b.X2+3, b.Y2+2, 0, 5, 2, c[i], 0, StatChars); //A box to read the 5 possible digits
if (Length(s) > 0) then
begin
m := 1; //Multiply result by 1 if there is not a K or M (ex. 100)
if (Pos('K', s) > 0) then //Multiply result if there's a K or M (ex. 500K or 50M)
m := 1000;
if (Pos('M', s) > 0) then
m := 1000000;
Break;
end;
end;
s := ReplaceRegExpr('[oO]', s, '0', True); //Replace mis-read o's or O's with zero's.
s := ReplaceRegExpr('[^0-9]', s, '', True); //Trim non-numbers from string
Result := (StrToIntDef(GetNumbers(s), 1) * m); //Thus
end;
function GetAmount2(x, y: integer): integer; //Author: Coh3n, edited by ibot_dung11
begin
result := GetAmountBox2(invBox(coordsToItem(x, y)));
end;