Difference between revisions of "Getinventorylist"

From Hercules Wiki
Jump to: navigation, search
(Created page with "== Syntax == * getinventorylist; == Description == This command sets a bunch of arrays with a complete list of whatever the invoking character has in its inventory, inclu...")

Revision as of 03:22, 5 December 2013

Syntax

  • getinventorylist;

Description

This command sets a bunch of arrays with a complete list of whatever the invoking character has in its inventory, including all the data needed to recreate these items perfectly if they are destroyed. Here's what you get:

@inventorylist_id[]        - array of item ids.
@inventorylist_amount[]    - their corresponding item amounts.
@inventorylist_equip[]     - whether the item is equipped or not.
@inventorylist_refine[]    - for how much it is refined.
@inventorylist_identify[]  - whether it is identified.
@inventorylist_attribute[] - whether it is broken.
@inventorylist_card1[]     - These four arrays contain card data for the
@inventorylist_card2[]       items. These data slots are also used to store
@inventorylist_card3[]       names inscribed on the items, so you can
@inventorylist_card4[]       explicitly check if the character owns an item
                             made by a specific craftsman.
@inventorylist_expire[]    - expire time (Unix time stamp). 0 means never 
                             expires.
@inventorylist_count       - the number of items in these lists.
@inventorylist_bound       - whether it is an account bounded item or not.

This could be handy to save/restore a character's inventory, since no other command returns such a complete set of data, and could also be the only way to correctly handle an NPC trader for carded and named items who could resell them - since NPC objects cannot own items, so they have to store item data in variables and recreate the items.

Notice that the variables this command generates are all temporary, attached to the character, and integer.

Be sure to use @inventorylist_count to go through these arrays, and not getarraysize, because the arrays are not automatically cleared between runs of getinventorylist.

Example

visit npc/custom.itembind.txt