SRL Archive - Help and Support

Finding the amount of coins


[S]paz

2008-02-21 14:13:44

ok im having great difficulty in finding the exact number of coins on ones inventory.
i know DTM's wont work but i tried

MMouse(x, y, 1, 1);
Try
B := StrToInt(GetTextAtEx(x-16, y-17, 5, StatChars, False, False, 0, 2, 841718, 8, False, tr_AlphaNumericChars));
Except writeln('Could not get Coin amount');
end;
Result := B;


but i always get a 0 ammount
any ideas?

~Spaz

Wizzup?

2008-02-21 14:15:14

From: spaztaz666
ok im having great difficulty in finding the exact number of coins on ones inventory.
i know DTM's wont work but i tried

MMouse(x, y, 1, 1);
Try
B := StrToInt(GetTextAtEx(x-16, y-17, 5, StatChars, False, False, 0, 2, 841718, 8, False, tr_AlphaNumericChars));
Except writeln('Could not get Coin amount');
end;
Result := B;


but i always get a 0 ammount
any ideas?

~Spaz


I suggest you try to use the concept I used in GetMMLevels. (FindColors, get box bounds, and gettextatex with a small offset)

[S]paz

2008-02-21 15:31:12

ok bare with me (extreme noobiness), whats GetMMLevels, and how do u use it

cos im confused
and i cant find it in any includes i look in … srry for noobyness

~Spaz

MylesMadness

2008-02-21 15:50:28

From Gametab.scar:
{*******************************************************************************
function Function GetMMLevels(LevelType : String;var ColorSign : String): integer;
By: Raymond / Wizzup
Description: Returns the level shown next to the minimap.
Colorsign returns the color of the text (Green,Yellow,Orange,Red).
Returns -1 if failed.
*******************************************************************************}

Function GetMMLevels(LevelType : String; var ColorSign : String): integer;
var
TP : TPoint;
I: Integer;
Colors : TIntegerArray;
P: TPointArray;
B: TBox;
Signs : TStringArray;
begin;
Result := -1;
ColorSign := '';
Case LowerCase(Leveltype) of
'health','hp','hitpoints' : TP := Point(729,29);
'prayer','pray' : TP := Point(746,68);
'run','energy' : TP := Point(740,107);
else
begin;
Writeln('Wrong leveltype.');
Exit;
end;
end;
Colors := [65280,65535,2070783,255];
Signs := ['Green','Yellow','Orange','Red'];
For I := 0 to 3 do
Begin
FindColorsTolerance(P, Colors[I], TP.X - 5, TP.Y - 5, TP.X + 40, TP.Y + 20, 0);
If Length(P) < 1 Then
Continue;
B := GetTPABounds(P);
Result := StrToIntDef(GetNumbers(GetTextAtEx(B.X1 - 1 , B.Y1 - 1, 0, statChars,
False, False, 0, 4, Colors[I], 20, False, tr_Digits)), 1);
ColorSign := Signs[I];
End;
end;

[S]paz

2008-02-21 15:59:36

ok after a loong look at it, i cant see how i can apply this to counting coins,

my guess would be
FindColorsTolerance(P, Colors[I], TP.X - 5, TP.Y - 5, TP.X + 40, TP.Y + 20, 0);
If Length(P) < 1 Then
Continue;
B := GetTPABounds(P);
Result := StrToIntDef(GetNumbers(GetTextAtEx(B.X1 - 1 , B.Y1 - 1, 0, statChars,
False, False, 0, 4, Colors[I], 20, False, tr_Digits)), 1);
ColorSign := Signs[I];
but… this seems to involve crating a box around the numbers and using StrToIntDef and counting them

am i right? if so i need to read some tuts on box making cos i have no idea :P

~Spaz