Difference between revisions of "Bot Playground/Commands/touchAttachment"
From SmartBots Developers Docs
Line 13: | Line 13: | ||
{{API Variable|linkNumber|yes}} The link number of the prim (root prim = 1) | {{API Variable|linkNumber|yes}} The link number of the prim (root prim = 1) | ||
{{API Variable Group|Output}} | {{API Variable Group|Output}} | ||
− | {{API Return | + | {{API Return promise}} |
{{API Variables Table End}} | {{API Variables Table End}} | ||
+ | |||
+ | == Return value == | ||
+ | |||
+ | * If object is not found, bot returns ''result.success=false'' and error message in ''result.error'' (use ''.then(function(result)'' to catch this). | ||
+ | * If linkNumber is wrong (less than 1 or more than number of child prims), function returns a success but no touch happens. | ||
== Comment == | == Comment == |
Revision as of 21:20, 21 December 2016
Touches an attachment of the bot (HUD or wearable object)
Bot.touchAttachment(objectName, linkNumber);
Reference
This command accepts the following parameters:
Variable | Required | Description
| |
---|---|---|---|
Input: | |||
objectName | yes | The name of the object to touch. | |
linkNumber | yes | The link number of the prim (root prim = 1) | |
Output: | |||
Function returns a Promise with the following data: | |||
success | bool | true if command completed successfully | |
error | string | error string if command has failed |
Return value
- If object is not found, bot returns result.success=false and error message in result.error (use .then(function(result) to catch this).
- If linkNumber is wrong (less than 1 or more than number of child prims), function returns a success but no touch happens.
Comment
Remember that bot have to load all objects from SL before touching them. So:
- after logging in, give bot about 30 seconds to load surrounding objects,
- the same after teleporting.
Determining the link number
The root prim is always 1 (so, linkNumber=1 for 1-prim objects too).
To get the link number of the specific child prim use Phoenix Firestorm viewer:
- Start editing your object
- Check "Edit linked" option
- Select required child prim
- See the "Link number" value
Examples
Touch a special test attachment object (contact SmartBots support to get it):
// Touch the button of the "Touch tester v2.0" object:
Bot.touchAttachment("Touch tester v2.0", 2);
// Politely exit since we're done
exit();