OsAvatarName2Key

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(New page: // // Sample Script using osAvatarName2Key(first,last) to send Instant Message // string FirstName = "John"; string LastName = "Smith"; default { state_entry() { llSay(0,...)
 
 
(26 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
{{osslfunc
 +
|threat_level=Low
 +
|permissions=${OSSL|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
 +
|delay=0
 +
|function_syntax=key osAvatarName2Key(string FirstName, string LastName)
 +
|ossl_example=<source lang="lsl">
 
//
 
//
// Sample Script using osAvatarName2Key(first,last) to send Instant Message
+
// osAvatarName2Key Script Exemple
 +
// Author: djphil
 
//  
 
//  
 
+
 +
// Define the first and last names of the avatar
 
string FirstName = "John";
 
string FirstName = "John";
 
string LastName = "Smith";
 
string LastName = "Smith";
 +
 
default
 
default
 
{
 
{
 
     state_entry()
 
     state_entry()
 
     {
 
     {
         llSay(0, "Script running");
+
        // Display a message prompting users to touch the object to see how osAvatarName2Key is used
 +
         llSay(PUBLIC_CHANNEL, "Touch to see osAvatarName2Key usage.");
 
     }
 
     }
     touch_end(integer num)
+
 
 +
     touch_start(integer number)
 
     {
 
     {
         kAvatarKey = osAvatarName2Key(FirstName, LastName);
+
         // Concatenate the first and last names to form the full avatar name
         llInstantMessage(kAvatarKey, "Test Message Here");     
+
        string AvatarName = FirstName + " " + LastName;
 +
 
 +
        // Call osAvatarName2Key function to get the key of the avatar based on first and last names
 +
        key AvatarKey = osAvatarName2Key(FirstName, LastName);
 +
 
 +
        // Display the avatar name and key
 +
         llSay(PUBLIC_CHANNEL, "The avatar name is " + AvatarName); 
 +
        llSay(PUBLIC_CHANNEL, "The avatar key is " + (string)AvatarKey);   
 +
    }
 +
}
 +
</source>
 +
<source lang="lsl">
 +
//
 +
// osAvatarName2Key Script Exemple
 +
// Author: djphil
 +
//
 +
 
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        // Display a message prompting users to touch the object to see how osAvatarName2Key is used
 +
        llSay(PUBLIC_CHANNEL, "Touch to see osAvatarName2Key usage.");
 +
    }
 +
 
 +
    touch_start(integer number)
 +
    {
 +
        // Get the name of the avatar who touched the object
 +
        string AvatarName = llDetectedName(0);
 +
       
 +
        // Parse the avatar name to extract first and last names
 +
        list buffer = llParseString2List(AvatarName, [" "], []);
 +
        string FirstName = llList2String(buffer, 0);
 +
        string LastName = llList2String(buffer, 1);
 +
 
 +
        // Call osAvatarName2Key function to get the key of the avatar based on first and last names
 +
        key AvatarKey = osAvatarName2Key(FirstName, LastName);
 +
 
 +
        // Display the avatar name and key
 +
        llSay(PUBLIC_CHANNEL, "Your avatar name is " + AvatarName); 
 +
        llSay(PUBLIC_CHANNEL, "Your avatar key is " + (string)AvatarKey);     
 
     }
 
     }
 
}
 
}
 +
</source>
 +
|description=Returns an avatar's key, based on his/her first and last name.
 +
|additional_info=
 +
}}
 +
== See Also ==
 +
* [[osAvatarName2Key]]
 +
* [[osKey2Name]]

Latest revision as of 00:58, 7 March 2024

key osAvatarName2Key(string FirstName, string LastName)
Returns an avatar's key, based on his/her first and last name.
Threat Level Low
Permissions ${OSSL|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
Extra Delay 0 seconds
Example(s)
//
// osAvatarName2Key Script Exemple
// Author: djphil
// 
 
// Define the first and last names of the avatar
string FirstName = "John";
string LastName = "Smith";
 
default
{
    state_entry()
    {
        // Display a message prompting users to touch the object to see how osAvatarName2Key is used
        llSay(PUBLIC_CHANNEL, "Touch to see osAvatarName2Key usage.");
    }
 
    touch_start(integer number)
    {
        // Concatenate the first and last names to form the full avatar name
        string AvatarName = FirstName + " " + LastName;
 
        // Call osAvatarName2Key function to get the key of the avatar based on first and last names
        key AvatarKey = osAvatarName2Key(FirstName, LastName);
 
        // Display the avatar name and key
        llSay(PUBLIC_CHANNEL, "The avatar name is " + AvatarName);   
        llSay(PUBLIC_CHANNEL, "The avatar key is " + (string)AvatarKey);    
    }
}
//
// osAvatarName2Key Script Exemple
// Author: djphil
// 
 
default
{
    state_entry()
    {
        // Display a message prompting users to touch the object to see how osAvatarName2Key is used
        llSay(PUBLIC_CHANNEL, "Touch to see osAvatarName2Key usage.");
    }
 
    touch_start(integer number)
    {
        // Get the name of the avatar who touched the object
        string AvatarName = llDetectedName(0);
 
        // Parse the avatar name to extract first and last names
        list buffer = llParseString2List(AvatarName, [" "], []);
        string FirstName = llList2String(buffer, 0);
        string LastName = llList2String(buffer, 1);
 
        // Call osAvatarName2Key function to get the key of the avatar based on first and last names
        key AvatarKey = osAvatarName2Key(FirstName, LastName);
 
        // Display the avatar name and key
        llSay(PUBLIC_CHANNEL, "Your avatar name is " + AvatarName);   
        llSay(PUBLIC_CHANNEL, "Your avatar key is " + (string)AvatarKey);    
    }
}


[edit] See Also

Personal tools
General
About This Wiki