SRL Archive - SRL Snippets

getArrayFromDtm, getItemAmountFromDtm


KeepBotting

2014-07-10 15:13:53

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

2014-07-10 15:21:50

You should call this DTMPositionMulti :p

Olly

2014-07-10 15:36:40

arr := findItem(myDTM, tabBackpack.getSlotBoxes(), true);

:D

KeepBotting

2014-07-10 15:47:18

From: Olly
arr := findItem(myDTM, tabBackpack.getSlotBoxes(), true);

:D


stahp

i like my for..to..do loops

From: Robert
You should call this DTMPositionMulti :p
maybe
i can never think of good identifiers

stocky8

2014-07-10 23:01:02

Good work on this KeepBotting! If I can understand scripting more I would surely use it!