SRL Archive - SRL Archives

Amount.scar - some "duplicate" functions...


n3ss3s

2008-04-05 10:13:35

Well CountItemsDTM and CountItemsBMP are just bumping up the compiling time since there is the CountItems in Inventory.scar…

drizzt

2008-04-05 10:20:01

am i wrong or does countitems in inventory.scar count all the items in the inventory? and CountitemsDTM and BMP count a certain item, for use in a proggy or any other reason you would use them.

Cazax

2008-04-05 10:35:33

Same as n3ss, if it doesnt give me some errors, it gives me a 'Mined : 0 Rocks' at my progress report….(Using CountItemsBmp and CountItemsDtm)…

drizzt

2008-04-05 10:39:54

yea i heard it was outdated, but not "duplicate". maybe be taken out, but not for being duplicated

and n3ss said it was just a rumour

n3ss3s

2008-04-05 12:07:42

Atleast the whole amount.scar isn't outdated.


am i wrong or does countitems in inventory.scar count all the items in the inventory? and CountitemsDTM and BMP count a certain item, for use in a proggy or any other reason you would use them.


Bah. If you would bother to view the functions CountItemsDTM, CountItemsBMP etc use, you would see they do the same as the CountItems in inventory.scar, which counts how many instances of an item is there in the inventory, not stacks.

Amount<identifier> is for stacks, and the Count ones count the instances.

Cazax

2008-04-05 12:40:53

From: n3ss3s
Atleast the whole amount.scar isn't outdated.




Bah. If you would bother to view the functions CountItemsDTM, CountItemsBMP etc use, you would see they do the same as the CountItems in inventory.scar, which counts how many instances of an item is there in the inventory, not stacks.

Amount<identifier> is for stacks, and the Count ones count the instances.


Problem solved i think, rev #15 is out.

n3ss3s

2008-04-05 12:58:56

Well it wasn't any actual "problem", but it was just plain stupid to have two of the function with same purpose, and no, it isn't fixed.

Wizzup?

2008-04-05 13:00:54

From: n3ss3s
Well it wasn't any actual "problem", but it was just plain stupid to have two of the function with same purpose, and no, it isn't fixed.


That is because I only saw this thread just now…

n3ss3s

2008-04-05 13:27:25

But you haven't been on MSN today except for like 5 minutes, which was when I forgot about this thread :p Come to msn…

If you come I will give you a cookie and a TPA ChooseOption ;)

king vash

2008-04-05 23:49:16

I use CountItemsDTM and it's nice.
but it is true that having the duplicate is pointless, however DTM's are harder than bitmaps so some noobs might want to use them, and DTM's are better so all the smart people use DTM's

n3ss3s

2008-04-06 04:13:21

But look -


{*******************************************************************************
function CountItems(identifier: Integer; identifiertype: string; tol: TIntegerArray): Integer;
By: WT-Fakawi / Sumilion
Description: Performs a count of inventory items by "identifier" with tol[0]
as color tolerance, tol[1] as contour tolerance in case of bmp masks. Valid identifiertypes are :
bmp, mask, color, dtm.
*******************************************************************************}

function CountItems(identifier: Integer; identifiertype: string; tol: TIntegerArray): Integer;
var
i, x, y, coltol, contol: Integer;
TB: Tbox;
begin
result := 0;
case LowerCase(identifiertype) of
'bmpmask', 'bitmapmask', 'bmp mask', 'bitmap mask', 'mask':
try
begin coltol := tol[0]; contol := tol[1] end;
except
srl_Warn('CountItems', 'Tol was incorrect', warn_AllVersions);
Exit;
end;
'dtm': begin end;
'bmp', 'bitmap', 'color':
try
coltol := tol[0];
except
srl_Warn('CountItems', 'Tol was incorrect', warn_AllVersions);
Exit;
end;
else begin
srl_Warn('CountItems', 'Invalid identifier type: ' + identifiertype, warn_AllVersions);
Exit;
end;
end;

GameTab(4);
for i := 1 to 28 do
begin
TB := InvBox(i);
if ExistsItem(i) then
try
case LowerCase(identifiertype) of
'bmp', 'bitmap':
if FindBitmapSpiralTolerance(identifier, x, y, TB.x1, TB.y1, TB.x2, TB.y2, coltol) then
Inc(Result);
'bmpmask', 'bitmapmask', 'bmp mask', 'bitmap mask', 'mask':
if FindBitmapMaskTolerance(identifier, x, y, TB.x1, TB.y1, TB.x2, TB.y2, coltol, contol) then
Inc(Result);
'color':
if FindColorTolerance(x, y, identifier, TB.x1, TB.y1, TB.x2, TB.y2, coltol) then
Inc(Result);
'dtm':
if FindDtm(identifier, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then
Inc(Result);
end;
except end;
end;
end;


You can use a bitmap, mask or a dtm with it! So, CountItemsDTM and CountItemsBMP are useless.