scripting:reference:system_functions:playerinventoryandwealthfunctions
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
scripting:reference:system_functions:playerinventoryandwealthfunctions [2020/01/29 04:51] – created mit | scripting:reference:system_functions:playerinventoryandwealthfunctions [2020/02/07 03:17] (current) – mit | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ==== 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 | | ||
+ | // | ||
+ | < | ||
+ | { | ||
+ | $hasKeys = sysPlayerInventory( " | ||
+ | if ( $hasKeys == 0 ) | ||
+ | { | ||
+ | *msg %PLAYER% You cannot access this building without keys | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== sysAddToInventory ==== | ||
+ | ^ Format | sysAddToInventory ( Item, Amount )| | ||
+ | ^ Description | Attempts to add an item to the current player' | ||
+ | ^ 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' | ||
+ | // | ||
+ | < | ||
+ | { | ||
+ | $added = sysAddToInventory( " | ||
+ | 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' | ||
+ | ^ 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. | | ||
+ | // | ||
+ | < | ||
+ | { | ||
+ | $loop = 0 | ||
+ | while( $loop < 64 ) | ||
+ | { | ||
+ | | ||
+ | if ( $itemNum != 0 ) | ||
+ | { | ||
+ | *msg %PLAYER% Item $loop : $itemNum | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
==== sysAddWealth ==== | ==== sysAddWealth ==== | ||
- | TBD: | + | ^ Format | sysAddWealth ( Amount, |
+ | ^ 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 [[scripting: | ||
+ | ^ 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** | | ||
+ | // | ||
+ | < | ||
+ | { | ||
+ | *grantitem %PLAYER% -1 WelfareCheque | ||
+ | sysAddWealth( 1000, " | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
==== sysRemoveWealth ==== | ==== sysRemoveWealth ==== | ||
TBD: sysRemoveWealth( Amount, ACCOUNT_SOURCE ) | TBD: sysRemoveWealth( Amount, ACCOUNT_SOURCE ) | ||
+ | |||
+ | ===== Related System Values ===== | ||
+ | Some information regarding the player wealth inventory is provided through [[scripting: | ||
+ | \\ | ||
+ | \\ | ||
+ | **$gPlayerCash**, | ||
+ | |||
scripting/reference/system_functions/playerinventoryandwealthfunctions.1580295084.txt.gz · Last modified: 2020/01/29 04:51 by mit