Difference between revisions of "FirstFreeInArray"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Speedo
imported>Haama
(Updated)
 
Line 4: Line 4:


'''Syntax:'''
'''Syntax:'''
  (Index: long) FirstFreeInArray ArrayID:long
(Index: long) FirstInArray ArrayID:long ''Used:Short'' ''Start:long'' ''Stop:long''
  (Index: long) FirstFreeInArray ArrayID:long ''Used:Short'' ''Start:long'' ''Stop:long''


Returns the index of the first Index containing no value.
Returns the index of the first Index containing either a value or no value.
*Returns -1 if all the array indexes contains each one a value, or if the array does not exist.
*To search for an index without a value, set Used to 0 or leave it unspecified.
**To search for an index with a value, set Used to 1.
*Set Start to begin the search from a certain index (inclusive). By default it is 0
**Set Stop to end the search at a certain index (inclusive). By default it is the last index of the array
*If the value is not in the array or the array does not exist, it returns -1.
 
 
'''Examples'''
 
With this array
{| border="2" cellpadding="5" cellspacing="0"
|-
!style="background:#ffdead;" |Index
|style="background:#ffeded;" |Value
|-
!style="background:#ffdead;" |Index 0
|style="background:#ffeded;" |3
|-
!style="background:#ffdead;" |Index 1
|style="background:#ffeded;" |10
|-
!style="background:#ffdead;" |Index 2
|style="background:#ffeded;" |(empty)
|-
!style="background:#ffdead;" |Index 3
|style="background:#ffeded;" |8
|-
!style="background:#ffdead;" |Index 4
|style="background:#ffeded;" |(empty)
|-
!style="background:#ffdead;" |Index 5
|style="background:#ffeded;" |(empty)
|-
!style="background:#ffdead;" |Index 6
|style="background:#ffeded;" |15
|}
 
FirstInArray ArrayID
will return 2
FirstInArray ArrayID 1
will return 0
FirstInArray ArrayID 0 2
will return 2
FirstInArray ArrayID 0 3
will return 4
FirstInArray ArrayID 1 2
will return 3
FirstInArray ArrayID 0 4 5
will return 4
FirstInArray ArrayID 1 4 5
will return -1


[[Category: Functions (Pluggy)]]
[[Category: Functions (Pluggy)]]
[[Category: Array Functions (Pluggy)]]
[[Category: Array Functions (Pluggy)]]

Latest revision as of 15:28, 29 February 2008


A command for Pluggy

Syntax:

(Index: long) FirstInArray ArrayID:long Used:Short Start:long Stop:long
(Index: long) FirstFreeInArray ArrayID:long Used:Short Start:long Stop:long

Returns the index of the first Index containing either a value or no value.

  • To search for an index without a value, set Used to 0 or leave it unspecified.
    • To search for an index with a value, set Used to 1.
  • Set Start to begin the search from a certain index (inclusive). By default it is 0
    • Set Stop to end the search at a certain index (inclusive). By default it is the last index of the array
  • If the value is not in the array or the array does not exist, it returns -1.


Examples

With this array

Index Value
Index 0 3
Index 1 10
Index 2 (empty)
Index 3 8
Index 4 (empty)
Index 5 (empty)
Index 6 15
FirstInArray ArrayID

will return 2

FirstInArray ArrayID 1

will return 0

FirstInArray ArrayID 0 2

will return 2

FirstInArray ArrayID 0 3

will return 4

FirstInArray ArrayID 1 2

will return 3

FirstInArray ArrayID 0 4 5

will return 4

FirstInArray ArrayID 1 4 5

will return -1