Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

object to return name of avatar touching it...

Enkil Prototype
Junior Member
Join date: 7 Jul 2004
Posts: 7
07-13-2004 17:31
Ok.. so I'm a newb.. just hatched.

Anyway, for now I'm trying to find a function that returns the name of the avatar touching the scripted object. Ideally, this is what I want to happen:

(billy bob touches object)
(function gets name, checks against names in its little database, billy bob is not in the list.)
OBJECT: sorry billy bob, you do not have access to thiss area!
billy bob: Darn!

(petey paul touches object)
(funtion gfets name, looks thru list, no match)
OBJECT: sorry petey paul, you do not have access to this area!
petey paul: I'll hack you somehow, code!

(a user whose name DOES appear in the list touches the object)
(function gets name, searches the list...)
OBJECT: Click!
OBJECT: door opening for Enkil prototype...

(enkil passes thru)
OBJECT: door closing... thank you enkil prototype.

this should work not just for the owner of the object, but for any and all authorized, in group or no...

the search thru list in jusst a lon bool with names in it, so that is simple.. but I cant get the object to recognize the users name...

Is this possible? Ive been looking in the script guide and havent found anything helpful.
Pete Fats
Geek
Join date: 18 Apr 2003
Posts: 648
07-13-2004 17:56
This is off the top of my head, but I think it will compile.

CODE
list good_names = ["name one", "name two"];
default
{
touch_start(integer total)
{
if (llListFindList(good_names, [llDetectedName(0)) != -1)
{
llSay(0, llDetectedName(0) + " is on the list.";);
}
else
{
llSay(0, llDetectedName(0) + " isn't on the list.";);
}
}
}
Enkil Prototype
Junior Member
Join date: 7 Jul 2004
Posts: 7
07-13-2004 18:13
Hey, thanks for your help!

The function did exactly what I needed!