Table of Contents

sysPlayerInventory

Format sysPlayerInventory ( Item )
Description Returns the number of an item the current player currently possesses
Returns Amount carried
Notes Item parameter can be the name or number of the item

Example:

Event( "PreAccessBuilding", "10" )
{
    $hasKeys = sysPlayerInventory( "Keys" )
    if ( $hasKeys == 0 )
    {
       *msg %PLAYER% You cannot access this building without keys
       CancelTransaction()
    }
}

sysAddToInventory

Format sysAddToInventory ( Item, Amount )
Description Attempts to add an item to the current player's inventory.
Returns [Amount added] - The actual amount of the item that was added
Notes Item parameter can be the name or number of the item. This is an alternate method to calling *grantitem [PlayerName] [Amount] [Item] but the sys function does not message the player unlike *grantitem. Also, this function adheres to the player's capacity limit (*grantitem ignores it) - no items will be added if the player's inventory is already full.

Example:

Event( "UseSkill", "Baker" )
{
    $added = sysAddToInventory( "Bread", 3 )
    if ( $added > 0 )
    {
        *msg %PLAYER% You made yourself $added Bread
    }
    else
    {
        *alert %PLAYER% You're carrying too much stuff
    }
}

sysGetInventoryItemIndex

Format sysGetInventoryItemIndex ( index )
Description Returns the item in the current player's inventory.
Returns [ItemNum] - The item number in the specified inventory slot (or 0 if the slot is empty)
Notes Parameter is the inventory slot number. Players currently have up to 64 inventory slots.

Example:

Event( "Custom", "ListInventory" )
{
    $loop = 0
    while( $loop < 64 )
    {
       $itemNum = sysGetInventoryItemIndex( $loop )
       if ( $itemNum != 0 )
       {
          *msg %PLAYER% Item $loop : $itemNum
       }
    }
}

sysAddWealth

Format sysAddWealth ( Amount, [ACCOUNT_SOURCE] )
Description Gives money to the player. This is an alternative to the *grantcash [PLAYER] [AMOUNT] command; money given to the player via grantcash always appears on their in-game accounts as 'Gifts from God', where the sysAddWealth gives you the extra option of specifying the Account Source - if you're making a full economy world and it can be important for the players to have the accounts view available and this data can also be used to generate econ stats delivered to an external website.
Returns Amount added. Usually the same as you requested but there are some settings that can limit the amount of cash the player can have, and these restrictions are applied here.
Notes [Amount] is cash to be given in denari

Example:

Event( "UseItem", "WelfareCheque" )
{
    *grantitem %PLAYER% -1 WelfareCheque
    sysAddWealth( 1000, "Welfare" )
}

sysRemoveWealth

TBD: sysRemoveWealth( Amount, ACCOUNT_SOURCE )

Some information regarding the player wealth inventory is provided through System Values - relevant ones are:

$gPlayerCash, $gPlayerCashSheckles, $gPlayerInventoryFree, $gPlayerInventoryUsed,