SRL Archive - Research & Development Lounge

CountItemDTM(DTM:Integer):Integer


rotflmfwao

2007-08-22 23:34:16

Yeah, I looked for this in srl and all I found was one for bitmaps so I switched some stuff around a bit and got this:
function CountItemDTM(DTM: Integer): Integer;//Based off of the
var //one in srl for bmps
i, x, y: Integer;
TB: Tbox;
begin
GameTab(4);
for i := 1 to 28 do
begin
TB := InvBox(i);
if ExistsItem(i) then
if FindDTM(DTM, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then// Thanks 4 the input
Inc(Result);
end;
end;

mat_de_b

2007-08-23 03:48:03

This used to be in xInventory.scar but that isnt in SRL4, this is a very handy procedure

XcanadamanX

2007-08-23 09:22:09

lmfao i made the EXACT same thing yesterday. it was for private use but…wow…lol

JuKKa

2007-08-23 09:24:22

I made a little different one, it uses TPoints and Color instead of DTM, A bit faster i guess.

Markus

2007-08-23 09:45:37

Looks nice, but why the DTMRotated?
As items never rotate, FindDTM would be sufficient and way faster.

itSchRis917

2007-08-23 10:28:45

Yea, i made one for my fisher also.. Just like mine, i just switched a few things and.. presto. worked.

R0b0t1

2007-08-23 15:13:57

Lol. I made the exact same thing and posted it somewhere, but I think in the members.


Are you ROFLMAOing me?

Lalaji

2007-08-23 15:42:08

Nice, I alwaus used the find bmp one…

Kik

2007-08-23 17:28:20

whoa. I also made the same exact thing a few days ago for private/member app use. This is getting a little bit creepy…

btw, this is a very good function for counting a certain number of items in your inventory. Very useful.

Santa_Clause

2007-08-24 05:51:56

I thought there was one already in SRL…?

mat_de_b

2007-08-24 14:39:39

Its in xinventory

rotflmfwao

2007-08-24 16:17:15

But not anymore XD I'll use FindDTM instead of rotated… It works faster, you're right!

rogeruk

2007-08-28 12:23:12

I'm getting bad errors while trying to use it..
[Runtime Error] : Exception: Access violation at address 006FFBEA in module 'scar.exe'.


aoaklogs:=CountItemDTM(oaklogdtm);