PDA

View Full Version : getArrayFromDtm, getItemAmountFromDtm



KeepBotting
07-10-2014, 07:13 PM
getArrayFromDtm() returns a TIntegerArray of backpack box slots that contain the specified DTM. Can be used for creating an array of nonstackable items in the inventory, or even multiple stacks of items that look the same (e.g. seeds).

function getArrayFromDtm(theDtm:integer):TIntegerArray;
var
theArray:TIntegerArray;
i:integer;
begin
for i := 1 to 28 do
begin
if tabBackpack.getSlotBox(i).dtmExists(theDtm) then
theArray.append(i);
end;
result := theArray;
end;

getItemAmountFromDtm() returns the amount of an item stack with the specified DTM. Useful for counting items that change slots, or if you're not sure what slot they're in.

function getItemAmountFromDtm(theDtm:integer):integer;
var
i:integer;
begin
for i := 1 to 28 do
begin
if tabBackpack.getSlotBox(i).dtmExists(theDtm) then
result := getItemAmount(tabBackpack.getSlotBox(i));
end;
end;

rj
07-10-2014, 07:21 PM
You should call this DTMPositionMulti :p

Olly
07-10-2014, 07:36 PM
arr := findItem(myDTM, tabBackpack.getSlotBoxes(), true);

:D

KeepBotting
07-10-2014, 07:47 PM
arr := findItem(myDTM, tabBackpack.getSlotBoxes(), true);

:D

stahp

i like my for..to..do loops


You should call this DTMPositionMulti :pmaybe
i can never think of good identifiers

stocky8
07-11-2014, 03:01 AM
Good work on this KeepBotting! If I can understand scripting more I would surely use it!