diff options
author | Haru <haru@dotalux.com> | 2019-06-02 15:26:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-02 15:26:57 +0200 |
commit | db4a29905f97016a4945db2670b15452e4e8ad20 (patch) | |
tree | d30966cf77043637c64a5e8ec7fe5424463a5518 /doc | |
parent | 1e1942ccc51b7a4b27bb3d8deea5e5a1178b8531 (diff) | |
parent | 858e732e15c495f3073c8037b9612c6c20390f76 (diff) | |
download | hercules-db4a29905f97016a4945db2670b15452e4e8ad20.tar.gz hercules-db4a29905f97016a4945db2670b15452e4e8ad20.tar.bz2 hercules-db4a29905f97016a4945db2670b15452e4e8ad20.tar.xz hercules-db4a29905f97016a4945db2670b15452e4e8ad20.zip |
Merge pull request #2394 from bWolfie/buildin_delitemidx
Adds BUILDIN(delitemidx), which deletes an item at the given index.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/script_commands.txt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 9e5045c9c..bdcc11712 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -5361,6 +5361,34 @@ Check getitem2() to understand its expanded parameters. --------------------------------------- +*delitemidx(<index>{, <amount>{, <account id>}}) + +This command will remove an item at the given inventory index. Unlike the +'delitem()' counterpart, this doesn't check invalid Item ID, making it useful to remove +invalid item IDs in player's inventory. + +If <amount> is not specified, this will remove all of the items at the specified index. +Note that items with the 'ForceSerial' flag, not yet merged through 'mergeitem()', will only +be removed at the given index. + +The only way to get the inventory index is by using 'getinventorylist()'. After deleting +an item at the given index, that index can remain empty until the player relogs, so you +should recall 'getinventorylist()' again. If you try to delete an item at an invalid index, the +script will terminate with an error. + +This command is also useful to remove rental/bound items because 'delitem()' +does not discriminate at choosing which item to remove. + +Example: + + // This will remove all invalid Item ID in player's inventory + getinventorylist(); + for (.@i = 0; .@i < @inventorylist_count; ++.@i) + if (getiteminfo(@inventorylist_id[.@i], ITEMINFO_TYPE) == -1) + delitemidx(@inventorylist_idx[.@i]); + +--------------------------------------- + *countitem(<item id>) *countitem("<item name>") |