(Defined SLInvetory .Authorized(action,action) and gave a practical example) |
m |
||
Line 5: | Line 5: | ||
<pre> Space.Inventory.Authorize()</pre>}} | <pre> Space.Inventory.Authorize()</pre>}} | ||
− | {{ScriptFunction|void|Authorize|(Action onAuthorized | + | {{ScriptFunction|void|Authorize|(Action onAuthorized, |
− | Action onRejected | + | Action onRejected);|Requests access to inventory functions, must be called prior to attempting to access inventory. This is different from Authorize() as in it allows you to immediately take action based on the result.|5= |
<pre>--this script shows you how to use this function to take authorization and immediately | <pre>--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) | --take action based on the result all in a single prompt (a click in this case) |
The SInventory class allows you to access a users inventory
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'.
Space.Inventory.Authorize()
Requests access to inventory functions, must be called prior to attempting to access inventory. This is different from Authorize() as in it allows you to immediately take action based on the result.
--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)
Forces a check for external changes to the users inventory, can only be called once every 60 seconds
Space.Inventory.RequestRefresh()
Adds the first found instance of itemID to the players hotbar entry at slot 'index'.
Space.Inventory.AddToHotbar(2, 23423523)
Remove item at slot index from Hotbar
Space.Inventory.RemoveFromHotbar(2)
Returns the array of the users current inventory items
invItems = Space.Inventory.Items
Returns true if player has accepted access authorization request to his inventory
isAuthorized = Space.Inventory.Authorized
|