SRL Archive - Reflection Development

Some Inventory Functions


JPHamlett

2011-08-23 02:51:28


Function getInventoryItemByID(Desire : integer): TInvItem;
var
items : TInvItemArray;
i : integer;
begin
items := R_GetInventoryItems;
for i := 0 to high(items) do
begin
if (items[i].ID = Desire) then
begin
result := items[i];
exit;
end;
end;
end;

Function getInventoryItemByName(Desire : String): TInvItem;
var
items : TInvItemArray;
i : integer;
begin
items := R_GetInventoryItems;
for i := 0 to high(items) do
begin
if (Pos(Desire, items[i].Name) > 0) then
begin
result := items[i];
exit;
end;
end;
end;


Not sure if this is really useful but here ya go.

mormonman

2011-08-23 03:24:34

We already have a function that passes a Variant.

TRiLeZ

2011-08-23 03:33:35

The R_ItemExists(..) function is what you're looking for.