SRL Archive - RS3 Help

Adding to an array without specificying the index?


KeepBotting

2014-07-04 19:54:00

Say I've got a function that loops through my backpack slots (1 to 28) looking for a DTM.

I want the function to add the backpack box slot number to a TIntegerArray every time it finds a slot which contains my DTM.

Problem is, I only know how to add an index to an array whilst specifying the index to which I want to add, like so:
theArray[0] := value;

Obviously this will always add 'value' to the 0th index of theArray.

How can I append a value directly onto the end of an array, without having to specify an index?

Also, does a non-dynamic array begin with the 0th or the 1st index?

The Mayor

2014-07-04 20:03:28

Something like:


if tabBackPack.isItemInSlot(slot) then
myInterArray.append(slot);

KeepBotting

2014-07-04 20:05:35

From: The Mayor
Something like:


if tabBackPack.isItemInSlot(slot) then
myInterArray.append(slot);

PERFECT, thank you! That worked :)

Brandon

2014-07-04 20:33:21

From: KeepBotting
PERFECT, thank you! That worked :)



All arrays have 0 base indices. Only array that doesn't is a 'string' (aka an array of char under the hood), and has a base index of 1.