Manipulating Attachments

Corrade implements getattachments to retrieve a list of attachment points to attachment names, attach to attach a list of attachments and detach to detach attachments. Provided you are a master of the bot, you can also give Corrade items by drag and dropping them into the IM session or directly onto the avatar.

To attach items, you use the attach command:

        llInstantMessage(CORRADE, wasKeyValueEncode(
            [
                "command", "attach",
                "group", GROUP,
                "password", PASSWORD,
                "callback", URL,
                "attachments", wasListToCSV(
                    [
                        "Skull", "hellobox",
                        "Mouth", "Bottle",
                        "Nose", "606679e2-fed0-412a-ac36-e1140c2dfff6"
                    ]
                )
            ])
        );

where attachments is a list of attachment points followed by primitive names or UUIDs. The example above will attach an item called hellobox in Corrade's inventory to its skull, an item named Bottle to the mouth attachment point and an item with UUID 606679e2-fed0-412a-ac36-e1140c2dfff6 to its nose. Corrade will always replace any previous item on the attachment point.

Thus, the parameter passed to the attachments property is a list of comma-separated values where attachment names or UUIDs are preceded by attachment points. Corrade implements libomv's list of attachment points (from the documentation):

Member Description
DefaultRight hand if object was not previously attached
ChestChest
SkullSkull
LeftShoulderLeft shoulder
RightShoulderRight shoulder
LeftHandLeft hand
RightHandRight hand
LeftFootLeft foot
RightFootRight foot
SpineSpine
PelvisPelvis
MouthMouth
ChinChin
LeftEarLeft ear
RightEarRight ear
LeftEyeballLeft eyeball
RightEyeballRight eyeball
NoseNose
RightUpperArmRight upper arm
RightForearmRight forearm
LeftUpperArmLeft upper arm
LeftForearmLeft forearm
RightHipRight hip
RightUpperLegRight upper leg
RightLowerLegRight lower leg
LeftHipLeft hip
LeftUpperLegLeft upper leg
LeftLowerLegLeft lower leg
StomachStomach
LeftPecLeft pectoral
RightPecRight pectoral
HUDCenter2HUD Center position 2
HUDTopRightHUD Top-right
HUDTopHUD Top
HUDTopLeftHUD Top-left
HUDCenterHUD Center
HUDBottomLeftHUD Bottom-left
HUDBottomHUD Bottom
HUDBottomRightHUD Bottom-right
NeckNeck
RootAvatar Center

Detaching is much easier because you do not have to specify the attachment point from which you want to detach an item. Instead, you just supply a list of names or UUIDs to the attachments parameter of Corrade.

Detaching objects can be performed with the detach command. In order to do this, we issue:

        llInstantMessage(CORRADE, wasKeyValueEncode(
            [
                "command", "detach",
                "group", GROUP,
                "password", PASSWORD,
                "callback", URL,
                "type", "path",
                "attachments", wasListToCSV(
                    [
                        "/My Inventory/Cool Stuff/Helmet",
                        "/My Inventory/Cool Stuff/Milk Bottle"
                    ]
                )
            ])
        );

Depending on the type parameter, there are several ways of detaching items from Corrade.

Index


secondlife/scripted_agents/corrade/tutorials/manipulating_attachments.txt ยท Last modified: 2022/11/24 07:45 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.