Difference between revisions of "Bot Playground/Commands/giveInventory"

From SmartBots Developers Docs
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:{{SUBPAGENAME}}}} <onlyinclude>Commands bot to send an inventory item or folder to specific avatar.</onlyinclude> <syntaxhighlight lang="javascript"> Bot.giveI...")
 
 
Line 11: Line 11:
 
{{API Variable Group|giveInventory}}
 
{{API Variable Group|giveInventory}}
 
{{API Variable|avatar|yes}} The avatar UUID.
 
{{API Variable|avatar|yes}} The avatar UUID.
{{API Variable|object|yes}} The inventory or folder UUID of the item. Use the [http://www.mysmartbots.com/docs/Personal_Bot_Control_Panel Personal Bot Control Panel] or [[HTTP_API/Bot_Commands/listinventory|listinventory]] API command to get this UUID.
+
{{API Variable|object|yes}} The inventory or folder UUID of the item. Use the [http://www.mysmartbots.com/docs/Personal_Bot_Control_Panel Personal Bot Control Panel] to get this UUID.
 
{{API Variable Group|Output}}
 
{{API Variable Group|Output}}
 
{{API Return promise}}
 
{{API Return promise}}

Latest revision as of 15:58, 1 July 2016

Commands bot to send an inventory item or folder to specific avatar.

Bot.giveInventory(avatar, object);

Reference

This command accepts the following parameters:

Variable Required Description


giveInventory:
avatar yes The avatar UUID.
object yes The inventory or folder UUID of the item. Use the Personal Bot Control Panel to get this UUID.
Output:
Function returns a Promise with the following data:
success bool true if command completed successfully
error string error string if command has failed

Error messages

Bot checks the permissions of the item before doing the delivery. The following error message is being returned if object is no-trans:

transfer permission not set

This does not apply for folders. Empty folder is being delivered if no transferable items found.

Comments

  1. The inventory is loading each time your bot restarts. Allow about 60 seconds for inventory to completely load.
  2. Bot automatically recognizes the inventory folders and delivers them accordingly.
  3. The commands freezes for about 15 seconds if object UUID is not exists in bot's inventory. To avoid this make sure you are using correct UUIDs.

Examples

Bot.giveInventory(avatar, object)
.then(function(result) {
  if(result.success) {
    console.log("The inventory item was send.");
  } else {
    console.log("Error executing giveInventory: " + result.error);
  }
});