Morrowind Mod:XNextStack

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

A function added by MWSE.

xNextStack returns the next item in the inventory stack. The parameter to this function is the third result from either xInventory or this function. Attempts to pass any other kind of reference to this function or use this reference with other functions will result in errors and possibly crash the game. If the inventory of the current NPC, creature, or container is changed (items added or removed) it will make the current stack reference invalid and you should get a new stack reference with xInventory.

Syntax[edit]

objectid (string) count (long) next (reference): xNextStack next (reference)

Example[edit]

Place following script on a container. When container is activated file containing IDs of items in the container will be created in Data Files\MWSE folder.

long ID
long count
long next_ref
short do

if ( onactivate == 1 )
        set do to 1
endif

ifx ( do )
        ifx ( next_ref )
                setx ID count next_ref to xNextStack next_ref
        else
                setx ID count next_ref to xInventory  ; get first reference
        endif

        xFileWriteText "Items_in_container.txt" "%s%n%" ID

        if ( next_ref == 0 )
                set do to 0     ; end of list
        endif
endif

See Also[edit]

xInventory
xContentList
xAddItem
xRemoveItem
xHasItemEquipped
xEquip
xDrop
xAddSpell
xRemoveSpell