# touchAttachment

Touches an attachment of the bot (HUD or wearable object).

```javascript
Bot.touchAttachment(objectName, linkNumber);
```

```snippet playground-input-2k8u0pPON3
`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:

| Variable | Type | Description |
|----------|------|-------------|
| `success` | bool | True if command completed successfully. |
| `error`  | string | Error string if command has failed. |

## Return value

* If the object is not found, the bot returns `result.success = false` and an error message in `result.error` (use `.then(function(result)` to catch this).
* If `linkNumber` is invalid (less than 1 or greater than the number of child prims), the function returns success but no touch occurs.

## Comments

Remember that the bot must load all objects from Second Life before touching them. Therefore:

* After logging in, give the bot about 30 seconds to load surrounding objects.
* Do the same after teleporting.

### Determining the link number   ![](https://nyc3.digitaloceanspaces.com/smartbots-docs/uploads/20adbcf8-a916-46eb-b77b-ad6944665550/ffb82ab7-805a-4c13-ac17-469cd29ae96c/Get_object_linknum.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=DO801JV4MUMY3YAEJCWC%2F20261113%2Fnyc3%2Fs3%2Faws4_request&X-Amz-Date=20261113T141500Z&X-Amz-Expires=86400&X-Amz-Signature=da1751d9acb374290655266e76976ae6fdbf8bfcdbca28a674c4580f6b6cf3f6&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject "right-50 =294x264")

The root prim is always `1` (so `linkNumber = 1` for single-prim objects as well).

To get the link number of a specific child prim, use the **Phoenix Firestorm Viewer**:


1. Start editing your object.
2. Check the “Edit linked” option.
3. Select the required child prim.
4. See the “Link number” value.

## Examples

Touch a special test attachment object (contact SmartBots support to get it):

```javascript
// Touch the button of the "Touch tester v2.0" object:
Bot.touchAttachment("Touch tester v2.0", 2);

// Gracefully exit since we're done

exit();
```