OsAgentSaveAppearance

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Add See Also)
(Simplify script exemples)
Line 28: Line 28:
 
         if (llGetAgentSize(toucher) != ZERO_VECTOR)
 
         if (llGetAgentSize(toucher) != ZERO_VECTOR)
 
         {
 
         {
             string FullName = osKey2Name(toucher);
+
             key result = osAgentSaveAppearance(toucher, (string)toucher);
            list buffer = llParseString2List(FullName, " ", []);
+
            string FirstName = llList2String(buffer, 0);
+
            string LastName = llList2String(buffer, 1);
+
            string NotecardName = FirstName + " " + LastName + " " + llGetTimestamp();
+
            llSay(PUBLIC_CHANNEL, "Attempting to create an Notecard \"" + NotecardName + "\".");
+
+
            key result = osAgentSaveAppearance(toucher, NotecardName);
+
 
   
 
   
 
             if (result && result != NULL_KEY)
 
             if (result && result != NULL_KEY)
 
             {
 
             {
                 llSay(PUBLIC_CHANNEL, "Notecard \"" + NotecardName + "\" created with success.");
+
                 llSay(PUBLIC_CHANNEL, "Notecard \"" + (string)toucher + "\" saved with success.");
 
             }
 
             }
 
   
 
   
 
             else
 
             else
 
             {
 
             {
                 llSay(PUBLIC_CHANNEL, "Notecard \"" + NotecardName + "\" created without success.");
+
                 llSay(PUBLIC_CHANNEL, "Notecard \"" + (string)toucher + "\" saved without success.");
 
             }
 
             }
 
         }
 
         }
Line 77: Line 70:
 
         if (llGetAgentSize(toucher) != ZERO_VECTOR)
 
         if (llGetAgentSize(toucher) != ZERO_VECTOR)
 
         {
 
         {
            string FullName = osKey2Name(toucher);
 
            list buffer = llParseString2List(FullName, " ", []);
 
            string FirstName = llList2String(buffer, 0);
 
            string LastName = llList2String(buffer, 1);
 
            string NotecardName = FirstName + " " + LastName + " " + llGetTimestamp();
 
            llSay(PUBLIC_CHANNEL, "Attempting to create an Notecard \"" + NotecardName + "\".");
 
 
 
             key result;
 
             key result;
 
   
 
   
 
             if (includeHuds == TRUE)
 
             if (includeHuds == TRUE)
 
             {
 
             {
                 result = osAgentSaveAppearance(toucher, NotecardName, TRUE);
+
                 result = osAgentSaveAppearance(toucher, (string)toucher, TRUE);
 
             }
 
             }
 
   
 
   
 
             else
 
             else
 
             {
 
             {
                 result = osAgentSaveAppearance(toucher, NotecardName, FALSE);
+
                 result = osAgentSaveAppearance(toucher, (string)toucher, FALSE);
 
             }
 
             }
 
   
 
   
 
             if (result && result != NULL_KEY)
 
             if (result && result != NULL_KEY)
 
             {
 
             {
                 llSay(PUBLIC_CHANNEL, "Notecard \"" + NotecardName + "\" created with success.");
+
                 llSay(PUBLIC_CHANNEL, "Notecard \"" + (string)toucher + "\" saved with success.");
 
             }
 
             }
 
   
 
   
 
             else
 
             else
 
             {
 
             {
                 llSay(PUBLIC_CHANNEL, "Notecard \"" + NotecardName + "\" created without success.");
+
                 llSay(PUBLIC_CHANNEL, "Notecard \"" + (string)toucher + "\" saved without success.");
 
             }
 
             }
 
         }
 
         }

Revision as of 16:19, 4 December 2020

key osAgentSaveAppearance(key agentId, string notecard)

key osAgentSaveAppearance(key agentId, string notecard, integer includeHuds)

Save an arbitrary avatar's appearance to a notecard in the prim's inventory. This includes body part data, clothing items and attachments. If a notecard with the same name already exists then it is replaced. The avatar must be present in the region when this function is invoked. The baked textures for the avatar (necessary to recreate appearance on the NPC) are saved permanently.

The first variant will include HUDs, the second variant allows control that. incluceHuds 1 (TRUE) will include 0(FALSE) will not

Threat Level VeryHigh
Permissions ESTATE_MANAGER,ESTATE_OWNER
Extra Delay 0 seconds
Example(s)
//
// osAgentSaveAppearance Script Example
// Author: djphil
//
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osAgentSaveAppearance usage.");
    }
 
    touch_start(integer number)
    {
        key toucher = llDetectedKey(0);
 
        if (llGetAgentSize(toucher) != ZERO_VECTOR)
        {
            key result = osAgentSaveAppearance(toucher, (string)toucher);
 
            if (result && result != NULL_KEY)
            {
                llSay(PUBLIC_CHANNEL, "Notecard \"" + (string)toucher + "\" saved with success.");
            }
 
            else
            {
                llSay(PUBLIC_CHANNEL, "Notecard \"" + (string)toucher + "\" saved without success.");
            }
        }
 
        else
        {
            llInstantMessage(toucher, "You need to be in the same region to use this function ...");
        }
    }
}

And with "includeHuds"

//
// osAgentSaveAppearance (with option) Script Example
// Author: djphil
//
 
integer includeHuds = TRUE;
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osAgentSaveAppearance (with option) usage.");
    }
 
    touch_start(integer number)
    {
        key toucher = llDetectedKey(0);
 
        if (llGetAgentSize(toucher) != ZERO_VECTOR)
        {
            key result;
 
            if (includeHuds == TRUE)
            {
                result = osAgentSaveAppearance(toucher, (string)toucher, TRUE);
            }
 
            else
            {
                result = osAgentSaveAppearance(toucher, (string)toucher, FALSE);
            }
 
            if (result && result != NULL_KEY)
            {
                llSay(PUBLIC_CHANNEL, "Notecard \"" + (string)toucher + "\" saved with success.");
            }
 
            else
            {
                llSay(PUBLIC_CHANNEL, "Notecard \"" + (string)toucher + "\" saved without success.");
            }
        }
 
        else
        {
            llInstantMessage(toucher, "You need to be in the same region to use this function ...");
        }
    }
}
Notes
This function was added in 0.7.2-post-fixes, huds control added in 0.9.2


Personal tools
General
About This Wiki