Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

nnKey2FirstName - Turns a key into a first name

Nepenthes Ixchel
Broadly Offended.
Join date: 6 Dec 2005
Posts: 696
03-26-2006 00:03
Sometimes it's nice to use an avatar's first name only, instead of their entire name. This simple function will take a key and return an avatars first name.

CODE


//////////////////////////////////////////////////////////
//
// nnKey2FirstName
// By Nepenthes Ixchel
//
// arguments:
// (key) id: the id of the aganet to return the firstname of.
//
// Return value:
// (string) The agents first name (all text before the first space, or entire name if there is no space.)
//
// License:
// This code is free to use for any purpose provided a comment of some sort is included in
// the code attributing it to Nepenthes Ixchel. (even if the script is distributed no-mod)

string nnKey2FirstName(key id)
{
return (llGetSubString(llKey2Name(id),0,-1+llSubStringIndex(llKey2Name(id)," ")));
}



////////////////////////////
//
// simple testbed code

default
{

touch_start(integer total_number)
{
llSay(0, "Hello "+nnKey2FirstName(llDetectedKey(0)));
}
}

Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
03-27-2006 07:03
/54/99/96330/1.html
_____________________
i've got nothing. ;)