SRL Archive - SRL Suggestions

ExistsSlotDTM:Boolean;


Sin

2012-11-14 10:49:18

function ExistsSlotDTM(DTM,InvSlot,x,y:Integer):Boolean;
var
Box:TBox;
begin
Box := InvBox(InvSlot);
Result := FindDTM(DTM,x,y,Box.X1,Box.Y1,Box.X2,Box.Y2);
end;

Used for finding a DTM in a specific slot.

P1ng

2012-11-14 14:31:00

Looks pretty handy, I don't know if it's suggestion worthy, but certainly a nice little snippet. +rep :)

Sin

2012-11-14 14:39:57

Thanks, although im not too sure if it already exists. I know "ExistsItemDTM" is there, but it doesn't search a specific slot.

How I used it:


procedure CheckInvDTMs;
var
i,lobDTM,sDTM,tDTM:Integer;
foodCount,j,x,y:Integer;
aDTM:TIntegerArray; //array of DTM/Integer
begin
aDTM := [lobDTM,sDTM,tDTM];
for i := 1 to 28 do
for j := Low(aDTM) to High(aDTM) do
begin
if ExistsSlotDTM(aDTM[j],i,x,y) then
foodCount := foodCount + 1;
end;
if (foodCount <= 5) then g
begin
Action := 'travelF';
SSTele;
end;
FreeDTMs(aDTM);
end;