OsAvatarName2Key
From OpenSimulator
(Difference between revisions)
(Add another exemple) |
|||
(One intermediate revision by one user not shown) | |||
Line 10: | Line 10: | ||
// | // | ||
+ | // Define the first and last names of the avatar | ||
string FirstName = "John"; | string FirstName = "John"; | ||
string LastName = "Smith"; | string LastName = "Smith"; | ||
Line 17: | Line 18: | ||
state_entry() | 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."); | llSay(PUBLIC_CHANNEL, "Touch to see osAvatarName2Key usage."); | ||
} | } | ||
Line 22: | Line 24: | ||
touch_start(integer number) | touch_start(integer number) | ||
{ | { | ||
+ | // Concatenate the first and last names to form the full avatar name | ||
string AvatarName = FirstName + " " + LastName; | 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); | key AvatarKey = osAvatarName2Key(FirstName, LastName); | ||
+ | // Display the avatar name and key | ||
llSay(PUBLIC_CHANNEL, "The avatar name is " + AvatarName); | llSay(PUBLIC_CHANNEL, "The avatar name is " + AvatarName); | ||
llSay(PUBLIC_CHANNEL, "The avatar key is " + (string)AvatarKey); | llSay(PUBLIC_CHANNEL, "The avatar key is " + (string)AvatarKey); | ||
Line 40: | Line 46: | ||
state_entry() | 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."); | llSay(PUBLIC_CHANNEL, "Touch to see osAvatarName2Key usage."); | ||
} | } | ||
Line 45: | Line 52: | ||
touch_start(integer number) | touch_start(integer number) | ||
{ | { | ||
+ | // Get the name of the avatar who touched the object | ||
string AvatarName = llDetectedName(0); | string AvatarName = llDetectedName(0); | ||
+ | |||
+ | // Parse the avatar name to extract first and last names | ||
list buffer = llParseString2List(AvatarName, [" "], []); | list buffer = llParseString2List(AvatarName, [" "], []); | ||
string FirstName = llList2String(buffer, 0); | string FirstName = llList2String(buffer, 0); | ||
string LastName = llList2String(buffer, 1); | 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); | key AvatarKey = osAvatarName2Key(FirstName, LastName); | ||
+ | // Display the avatar name and key | ||
llSay(PUBLIC_CHANNEL, "Your avatar name is " + AvatarName); | llSay(PUBLIC_CHANNEL, "Your avatar name is " + AvatarName); | ||
llSay(PUBLIC_CHANNEL, "Your avatar key is " + (string)AvatarKey); | llSay(PUBLIC_CHANNEL, "Your avatar key is " + (string)AvatarKey); | ||
Line 57: | Line 70: | ||
</source> | </source> | ||
|description=Returns an avatar's key, based on his/her first and last name. | |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
- osAvatarName2Key
- osKey2Name