OsAvatarName2Key
From OpenSimulator
(Difference between revisions)
m (Oops and fix the script too) |
|||
(3 intermediate revisions by one user not shown) | |||
Line 7: | Line 7: | ||
// | // | ||
// osAvatarName2Key Script Exemple | // 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() | ||
{ | { | ||
+ | // 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."); | ||
} | } | ||
− | + | ||
+ | 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); | ||
+ | } | ||
+ | } | ||
+ | </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) | touch_start(integer number) | ||
{ | { | ||
− | string AvatarName = osAvatarName2Key(FirstName, LastName); | + | // Get the name of the avatar who touched the object |
− | llSay(PUBLIC_CHANNEL, " | + | 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> | </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