SRL Archive - SRL Archives

countInvStack


munk

2008-04-14 04:37:07


function countInvStack(slot:integer):integer;
var
i:integer;
str:string;
tpa:TpointArray;
cols:TintegerArray;
slotBox,textBox:Tbox;
begin
if not loggedIn then exit;
if existsItem(slot) then
begin
cols:=[65535,16777215,8453888];
slotBox:=invBox(slot);
for i:=low(cols) to high(cols) do
begin
findColorsTolerance(tpa,cols[i],slotBox.x1,slotBox.y1,slotBox.x2,slotBox.y2,0);
if length(tpa)<1 then continue;
textBox:=getTPAbounds(tpa);
str:=trim(getTextAtEx(textBox.x1-1,textBox.y1-1,0,statChars,false,false,0,2,cols[i],7,true,tr_AlphaNumericChars));
if str<>'' then
begin
case uppercase(getLetters(str)) of
'K': result:=strToInt(trimLetters(str))*1000;
'M': result:=strToInt(trimLetters(str))*1000000;
else result:=strToInt(str);
end;
exit;
end;
end;
end;
end;

EvilChicken!

2008-04-14 04:46:10

Nice and useful function, but what about the ones that are in SRL already? Don't they work? If not, I think this should be the replacement function.

munk

2008-04-14 14:55:03

From: EvilChicken!
Nice and useful function, but what about the ones that are in SRL already? Don't they work? If not, I think this should be the replacement function.


amount.scar has so many bugs for me :( and I think at one time there was one in inventory.scar, but its definately not there now. I think this idea (taken from GetMMLevels :) ) is a much better alternative to coord sets.

P1nky

2008-04-16 16:39:39

yeah this is really usefull so the srl 1 is buggy?

Sir R. M8gic1an

2008-04-27 03:34:51

nice function, i was wondering why Low() and High() if its a static Array? and i'm guessing that's the free different colors that the number of items might have…

~RM

EvilChicken!

2008-04-27 04:35:56

I think this function should get more attention from the devs.. Get on the SRL chat and talk to one of the devs and link him/her to this function.

Wait, yo've been there already. Just remembered you. Anyway, link one of the devs here.

n3ss3s

2008-04-27 05:47:56

Nice function munk, but you only need one FindColor of the digit/text color in the InvBox of the item, and do a GetTextAtEx at the coords.

munk

2008-05-03 21:15:56

From: n3ss3s
Nice function munk, but you only need one FindColor of the digit/text color in the InvBox of the item, and do a GetTextAtEx at the coords.


uhh…that wouldnt work….