OsAvatarName2Key

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
 
(17 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{| width="100%" style="border: thin solid black"
+
{{osslfunc
| colspan="2" align="center" style=background:orange | '''{{SUBPAGENAME}}'''
+
|threat_level=Low
|-
+
|permissions=${OSSL|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
|'''Threat Level''' || <Threat Level goes here>
+
|delay=0
|-
+
|function_syntax=key osAvatarName2Key(string FirstName, string LastName)
|'''Function Syntax''' || <Syntax goes here>
+
|ossl_example=<source lang="lsl">  
|-
+
|'''Example(s)||<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)
+
    }
  {
+
 
      kAvatarKey = osAvatarName2Key(FirstName, LastName);
+
    touch_start(integer number)
      llInstantMessage(kAvatarKey, "Test Message Here");  
+
    {
   }
+
        // 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);    
 +
    }
 
}
 
}
 
</source>
 
</source>
|}
+
<source lang="lsl">
<Additional info/content goes here>
+
//
 +
// osAvatarName2Key Script Exemple
 +
// Author: djphil
 +
//
  
<!-- Edited with Kate -->
+
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.");
 +
    }
  
[[Category:OSSL Functions]]
+
    touch_start(integer number)
[[Category:OSSL]]
+
    {
[[Category:OSSL functions without threat level]]
+
        // Get the name of the avatar who touched the object
[[Category:OSSL functions without function syntax]]
+
        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 01: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