GetInventoryObject

< [[::Category:Functions|Category:Functions]]

A function added by the Fallout Script Extender.

Description

Returns the base form of the Nth item in a container.

Syntax

(baseform) Container.GetInventoryObject index:int 

Or:

(baseform) Container.GetNthObject index:int

Example

ref rItem

set rItem to PlayerREF.GetInventoryObject 21

Often you may wish to use this in a loop, to go through every item in an inventory:

int x
ref rItem

let x := PlayerREF.GetNumItems

while x > 0
    let x -= 1 ; decrement x, the first item is '0'
    let rItem := PlayerREF.GetInventoryObject x
    ; do something
loop

Notes

  • Beware removing items from a container within a loop, because it may change the index of those later.
  • Multiple instances of the same base form in a container are considered as just one item by the function.

See Also