SInventory
Dans cette classeAuthorize
| Fonction | Authorize | Requests access to inventory functions, must be called prior to attempting to access inventory. |
| Fonction | CountCopiesOfItem | – |
| Fonction | AddToHotbar | Adds the first found instance of itemID to the players hotbar entry at slot 'index'. |
| Fonction | RemoveFromHotbar | Remove item at slot index from Hotbar |
| Fonction | RequestRefresh | Forces a check for external changes to the users inventory, can only be called once every 60 seconds |
| Propriété | Authorized | Returns true if player has accepted access authorization request to his inventory |
| Propriété | Items | Returns the array of the users current inventory items |
Fonctions
Authorize
Requests access to inventory functions, must be called prior to attempting to access inventory. As soon as the player has accepted the request, the Authorized attribute will be 'true'.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| onAuthorized | Closure | null |
| onRejected | Closure | null |
Valeurs de retour
void
Exemple
Space.Inventory.Authorize()
--or
Space.Inventory.Authorize(onAuth, onRej)
--this script shows you how to use this function to take authorization and immediately
--take action based on the result all in a single prompt (a click in this case)
function ifno()
Space.Log("not authorized")
end
function ifyes()
Space.Log("authorized")
--your next steps go here
end
function click()
Space.Inventory.Authorize(ifyes,ifno)
end
Space.Host.ExecutingObject.AddClickable()
Space.Host.ExecutingObject.Clickable.OnClick(click)
CountCopiesOfItem
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| itemID | int | – |
Valeurs de retour
int
Exemple
numOfCopies = Space.Inventory.CountCopiesOfItem(38384839)
AddToHotbar
Adds the first found instance of itemID to the players hotbar entry at slot 'index'.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| index | int | – |
| itemID | int | – |
Valeurs de retour
void
Exemple
Space.Inventory.AddToHotbar(2, 23423523)
RemoveFromHotbar
Remove item at slot index from Hotbar
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| index | int | – |
Valeurs de retour
void
Exemple
Space.Inventory.RemoveFromHotbar(2)
RequestRefresh
Forces a check for external changes to the users inventory, can only be called once every 60 seconds
Valeurs de retour
void
Exemple
Space.Inventory.RequestRefresh()
Propriétés
AuthorizedLecture seule
Returns true if player has accepted access authorization request to his inventory
Exemple
isAuthorized = Space.Inventory.Authorized
ItemsLecture seule
Returns the array of the users current inventory items
Exemple
invItems = Space.Inventory.Items



