Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Finding avatar name?

Mostorm Fleming
Second Life Resident
Join date: 2 Nov 2004
Posts: 4
10-22-2005 19:59
I would like a user to type a avies first name and my script to locate the avie close by and return their whole name in a string. Some idea how i can do this please?

Thanks!
Ushuaia Tokugawa
Nobody of Consequence
Join date: 22 Mar 2005
Posts: 268
10-22-2005 20:37
CODE

// channel to say the name on
integer channel = 123;

string find;

default {
on_rez(integer start) {
llResetScript();
}

state_entry() {
llListen(channel, "", llGetOwner(), "");
}

listen(integer channel, string name, key id, string message) {
find = llToLower(message);

llSensor("", "", AGENT, 96.0, PI);
}

sensor(integer sensed) {
integer i;

for (i = 0; i < sensed; i++) {
string name = llToLower(llDetectedName(i));

if (llSubStringIndex(name, find) == 0) {
llOwnerSay(llDetectedName(i));

return;
}
}

llOwnerSay("Avatar not found.");
}

no_sensor() {
llOwnerSay("Avatar not found.");
}
}
_____________________
Lestat Llewelyn
Memnochs Madness
Join date: 27 Jul 2004
Posts: 19
hi
10-22-2005 20:59
string person;

default
{
state_entry()
{
llListen(0,"",llGetOwner(),"";);
}

listen(integer channel,string name,key id,string message)
{
person = message;
llSensor("",NULL_KEY,AGENT,96.0,TWO_PI);
}

sensor(integer num_detected)
{
integer i;
for (i = 0;i < num_detected;i++)
{
list temp = llParseString2List(llDetectedName(i),[" "],[]);
if (person == llList2String(temp,0))
{
llOwnerSay(llDetectedName(i));
}
}
}
}

this is the easiest way i can thin of to do it :)
_____________________
Memnochs Madness
rentals, vendors, organisers, collars and much more

[CENTER] @ the Grange | @ Beverly Hills
Mostorm Fleming
Second Life Resident
Join date: 2 Nov 2004
Posts: 4
10-22-2005 21:21
works perfect!! thank you!
MistySue Wallaby
Registered User
Join date: 22 Apr 2005
Posts: 40
11-24-2005 09:39
here's a further question about this. How to store the detected name in a global variable?
I declared a global string (called gName) and tried in the sensor event to do "gName = DetectedName (i);" , but when I test it back where the llSensor call is, gName is a null string
_____________________
Please visit us at:

Windows to the Soul Boutique - Tiretta (161,189,65)

Home to ~*Creations by Padme*~, Carpe Noctum, Ice Ice Baby, Pleasure Bound Studio, and Padme's Ponygirls

Thank you for your support :)