mormonman
2009-08-01 00:48:44
Ok, so I added 3 new functions and they need explanations.
function FindGroundItem(var Itemx : TGroundItem; ID, maxSL : Integer) : Boolean
This is a simple, easy-to-use version of FindGroundItems. It only uses one ID and it returns the closest item with that ID.
Example:
function FindGroundItemsInBox(var Items : TGroundItemArray; IDs : TIntegerArray; Box : TBox) : Boolean
This function is for those areas that you know that the drops will always be in the same box.(Example: Drops from Ogres in King Lathas' Training Ground)
I made this because I don't want to search tiles that I know what have the items on them. Note: Does not sort them closest to farthest.
Here is how I use it:
procedure DebugGroundItems(Dist : Integer);
This is a debugging procedure that will tell you how many items were found, the ID of the items, and the tile they are on within the distance defined by Dist. Very useful for scripters.
Example:
Thanks, and have fun xD
function FindGroundItem(var Itemx : TGroundItem; ID, maxSL : Integer) : Boolean
This is a simple, easy-to-use version of FindGroundItems. It only uses one ID and it returns the closest item with that ID.
Example:
procedure PickupBones;
var
S : TGroundItem;
T : TPoint;
begin
if FindGroundItem(S, BonesID, 15{on minimap}) then
begin
if not TileOnMS(S.Tile, 1) then
begin
T := S.Tile;
WalkToTile(T, 1, 1);
end;
if TileOnMS(S.Tile, 1) then
begin
T := S.MS;
Mouse(T.X, T.Y, 10, 10, False);
R_ChooseOption('Pickup');//I don't know if that is even what it is...
end;
end;
end;
function FindGroundItemsInBox(var Items : TGroundItemArray; IDs : TIntegerArray; Box : TBox) : Boolean
This function is for those areas that you know that the drops will always be in the same box.(Example: Drops from Ogres in King Lathas' Training Ground)
I made this because I don't want to search tiles that I know what have the items on them. Note: Does not sort them closest to farthest.
Here is how I use it:
function GetTiles: TPointArray;
var
T: TGroundItemArray;
i, L, Hi: Integer;
begin
if FindGroundItemsInBox(T, [5321, 987, 985, 5300, 5295], IntToBox(2523, 3373, 2533, 3377)) then
begin
Hi := High(T);
for i := 0 to Hi do
if TileOnMS(T[i].Tile, 1) then
begin
SetArrayLength(Result, L + 1);
Result[L] := T[i].Tile;
Inc(L);
end;
end;
end;
procedure DebugGroundItems(Dist : Integer);
This is a debugging procedure that will tell you how many items were found, the ID of the items, and the tile they are on within the distance defined by Dist. Very useful for scripters.
Example:
program New;
{.include SRL/SRL/Misc/SMART.scar}
{.include SRL/SRL.scar}
{.include SRL/SRL/Reflection/Reflection.scar}
begin
Smart_Server := 70;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DebugGroundItems(15{again... on minimap});
end.
Thanks, and have fun xD