SRL Archive - RS3 Help

Money Pouch


SoulShare

2014-07-15 01:00:52

Are there anyways of getting the money pouch value with the current SRL?

I have tried tabBackpack.getMoneyPouchAmount() but outputs an incorrect value (Had 15M, said I had integer 5).
I had a look at the chatbox functions hoping to possibly read the value from there but with no success.

Going to try fix the getMoneyPouchAmount function myself. Have any of you guys been successful getting money values recently?

Any help would be greatly appreciated.


Press Play

2014-07-15 21:09:46

Try this fix. You can just paste the code into the script - no need to replace the one in SRL. It will override the one in SRL.
function TRSTabBackpack.getMoneyPouchAmount(): integer; override;
var
b, bounds: TBox;
tpa: TPointArray;
colArr, tolArr: array [0..1] of integer;
s: string;
i: integer;
begin
result := 0;
{ green, white }
colArr := [895749, 14145238];
tolArr := [86, 72];

if (not self.open()) then
exit();

b := intToBox(gameTabs.TabArea.x1, gameTabs.TabArea.y2 - 35, gameTabs.TabArea.x2, gameTabs.TabArea.y2);

for i := 0 to 1 do
if (findColorstolerance(tpa, colArr[i], b, tolArr[i])) then
begin
bounds := tpa.getBounds();
bounds.edit(-1, -1, +1, +1);

s := getTextAtEx(bounds, 0, 4, 4, colArr[i], tolArr[i], upChars);

result := strToIntDef(ExtractFromStr(s, numbers), 0);

if pos('K', s) > 0 then
result := result * 1000;

if (pos('M', s) > 0) or (pos('@', s) > 0) then
result := result * 1000000;

print('tabBackpack.getMoneyPouchAmount(): result = ' + intToStr(result) +
' (' + s + ')', TDebug.SUB);
exit();
end;

print('tabBackpack.getMoneyPouchAmount(): Failed to find any text color, resulting as 0', TDebug.ERROR);
end;

The reasons why the function was failing is because of the colors of the text. Also, the 'M' that represents 'million' has a few extra pixels that confuses the text finder into thinking it's an '@'. This is just a temporary fix on my part. If someone wants to make a better/cleaner fix, go go go! :)
[ATTACH=CONFIG]23577[/ATTACH]

Jeroen

2014-07-16 09:24:56

Cant you just right click to examine? gives the exact amount of cash.

KeepBotting

2014-07-16 10:25:58

From: Jeroentjo
Cant you just right click to examine? gives the exact amount of cash.
You'd have to read chatbox text, same problem

Turpinator

2014-07-16 11:00:38

From: KeepBotting
You'd have to read chatbox text, same problem


Chatbox uses a different font actually. Might have better luck using that. But still… We arent using tesseract for this, so results still wont be perfect.

KeepBotting

2014-07-16 11:26:09

From: Turpinator
Chatbox uses a different font actually. Might have better luck using that. But still… We arent using tesseract for this, so results still wont be perfect.

afaik srl-6's inbuilt chatbox.findAnyText() has been broken for a while (ever since chatbox fonts changed) so you'd have to use tesseract for it

press play's method is better

Turpinator

2014-07-16 11:45:39

From: KeepBotting
afaik srl-6's inbuilt chatbox.findAnyText() has been broken for a while (ever since chatbox fonts changed) so you'd have to use tesseract for it

press play's method is better


they changed again? this is why we need that updated tesseract plugin, @Olly;… <_<

SoulShare

2014-07-16 15:28:50

From: Press Play
Try this fix. You can just paste the code into the script - no need to replace the one in SRL. It will override the one in SRL.
function TRSTabBackpack.getMoneyPouchAmount(): integer; override;
var
b, bounds: TBox;
tpa: TPointArray;
colArr, tolArr: array [0..1] of integer;
s: string;
i: integer;
begin
result := 0;
{ green, white }
colArr := [895749, 14145238];
tolArr := [86, 72];

if (not self.open()) then
exit();

b := intToBox(gameTabs.TabArea.x1, gameTabs.TabArea.y2 - 35, gameTabs.TabArea.x2, gameTabs.TabArea.y2);

for i := 0 to 1 do
if (findColorstolerance(tpa, colArr[i], b, tolArr[i])) then
begin
bounds := tpa.getBounds();
bounds.edit(-1, -1, +1, +1);

s := getTextAtEx(bounds, 0, 4, 4, colArr[i], tolArr[i], upChars);

result := strToIntDef(ExtractFromStr(s, numbers), 0);

if pos('K', s) > 0 then
result := result * 1000;

if (pos('M', s) > 0) or (pos('@', s) > 0) then
result := result * 1000000;

print('tabBackpack.getMoneyPouchAmount(): result = ' + intToStr(result) +
' (' + s + ')', TDebug.SUB);
exit();
end;

print('tabBackpack.getMoneyPouchAmount(): Failed to find any text color, resulting as 0', TDebug.ERROR);
end;

The reasons why the function was failing is because of the colors of the text. Also, the 'M' that represents 'million' has a few extra pixels that confuses the text finder into thinking it's an '@'. This is just a temporary fix on my part. If someone wants to make a better/cleaner fix, go go go! :)
[ATTACH=CONFIG]23577[/ATTACH]


Thanks man. Seems to work most of the time. Few numbers it still has troubles with (like 9) but for the most part its a lot better than before and a step forward for sure.