SRL Archive - Research & Development Lounge

DropAllLogs


A G E N T

2008-10-17 20:10:28

Hi all,
This idea sort of just popped into mind while I was thinking about DTMs, blacklists, and such…
A quick function to find the position of all logs (any type) in your inventory. I thought it might come in handy for woodcutting scripts, probably a bit faster and less memory-intensive than DTMs.
The function: (couldn't think of a name.)

function CheckLogs : TIntegerArray;
var
i, n : integer;
Box : TBox;
ResArr : Array of integer;
begin
GameTab(4);
n := 0;
for i:=1 to 28 do
begin
Box := InvBox(i);
if(CountColor(65536, Box.x1, Box.y1, Box.x2, Box.y2) = 85)then
begin
SetArrayLength(ResArr, (n+1));
ResArr[n] := i;
Inc(n);
end;
end;
Result := ResArr;
end;

Usage:

TheArr := CheckLogs;
for x := 0 to GetArrayLength(TheArr) do
begin
DropItem(TheArr[x]);
end;

-Agent

Tniffoc

2008-10-17 20:22:50

I really like this idea even though I think it should be made by the scripters themselves. If you developed something like DropItemsByID for Reflection, it might get added but, who am I to know? My suggestions never get added :P :)

Method

2008-10-17 20:56:08

From: tniffoc
I really like this idea even though I think it should be made by the scripters themselves. If you developed something like DropItemsByID for Reflection, it might get added but, who am I to know? My suggestions never get added :P :)


Dropping inventory items by ID isn't possible without interfaces being implemented (meaning Ben has to implement 2D array support).