View Full Version : getFreeSlots
KeepBotting
08-06-2014, 04:24 PM
getFreeSlots() returns a TIntegerArray of the free backpack slots (1-28).
To only return the integer amount of free backpack slots, length(getFreeSlots()) can be used.
function getFreeSlots():TIntegerArray;
var
i:integer;
theArray:TIntegerArray;
begin
if (not gameTabs.isTabActive(TAB_BACKPACK)) then
gameTabs.openTab(TAB_BACKPACK);
for i := BACKPACK_SLOT_LOW to BACKPACK_SLOT_HIGH do
begin
if (not tabBackpack.isItemInSlot(i)) then
begin
theArray.append(i);
end;
end;
writeLn('Free backpack slots are: ' + toStr(theArray));
result := theArray;
end;
function getFreeSlots():TIntegerArray;
var
i:integer;
begin
gameTabs.openTab(TAB_BACKPACK);
for i := BACKPACK_SLOT_LOW to BACKPACK_SLOT_HIGH do
if (not tabBackpack.isItemInSlot(i)) then
result.append(i);
writeLn('Free backpack slots are: ' + toStr(theArray));
end;
Shortened :p nice function though
KeepBotting
08-06-2014, 08:34 PM
Thanks :)
function getFreeSlots():TIntegerArray;
var
i:integer;
begin
gameTabs.openTab(TAB_BACKPACK);
for i := BACKPACK_SLOT_LOW to BACKPACK_SLOT_HIGH do
if (not tabBackpack.isItemInSlot(i)) then
result.append(i);
writeLn('Free backpack slots are: ' + toStr(theArray));
end;
Shortened :p nice function though
bonsai
08-07-2014, 08:57 AM
Thanks :)
Why not make it a backpack function?
function TRSTabBackpack.getFreeSlots():TIntegerArray;
var
i:integer;
begin
gameTabs.openTab(TAB_BACKPACK);
for i := BACKPACK_SLOT_LOW to BACKPACK_SLOT_HIGH do
if (not self.isItemInSlot(i)) then
result.append(i);
writeLn('Free backpack slots are: ' + toStr(theArray));
end;
KeepBotting
08-07-2014, 11:22 AM
Why not make it a backpack function?
function TRSTabBackpack.getFreeSlots():TIntegerArray;
var
i:integer;
begin
gameTabs.openTab(TAB_BACKPACK);
for i := BACKPACK_SLOT_LOW to BACKPACK_SLOT_HIGH do
if (not self.isItemInSlot(i)) then
result.append(i);
writeLn('Free backpack slots are: ' + toStr(theArray));
end;
True :P it's more to type tabBackpack.getFreeSlots() though
bonsai
08-07-2014, 02:57 PM
True :P it's more to type tabBackpack.getFreeSlots() though
tabBackpack is a variable of type TRsTabBackpack so if you did it as above you would indeed call it as tabBackpack.getFreeSlots()
var tabBackpack: TRSTabBackpack;
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.