Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

find other avatars position using llSensor

LordHighBen Hathor
Registered User
Join date: 8 Aug 2004
Posts: 6
12-22-2004 13:25
I have been trying to use the llSensor command, and make it use a string value i say, for the avatar nameit searches for, but i don't know how to tell the code to "When you hear this name, search for it", a detailed guide or example code would be useful.
Upshaw Underhill
Techno-Hobbit
Join date: 13 Mar 2003
Posts: 293
12-22-2004 15:36
CODE

integer i;
default
{
state_entry()
{
llListen(0,"",llGetOwner(),""); //listen only for you on default chat channel
}
listen(integer channel, string name, key id, string message)
{
llSensor(message,NULL_KEY,AGENT,10.0,PI); //fire the sensor for the AV named
}
sensor(integer total_number)
{
for ( i = 0; i < total_number; i++ ) //loop through number of detected AVs
{
llWhisper( 0, llDetectedName(i) + " located at " + (string)llDetectedPos(i) ); //Whisper their name and coordinates
}
}
}



uncompiled but mostly cut and pasted from the wiki so ought to compile

Secondlife Wiki

L8r,
UU
LordHighBen Hathor
Registered User
Join date: 8 Aug 2004
Posts: 6
12-22-2004 16:50
From: Upshaw Underhill
CODE

default
{
state_entry()
{
llListen(0,"",llGetOwner(),""); //listen only for you on default chat channel
}
listen(integer channel, string name, key id, string message)
{
llSensor(message,NULL_KEY,AGENT,10.0,PI); //fire the sensor for the AV named
}
sensor(integer total_number)
{
for ( i = 0; i < total_number; i++ ) //loop through number of detected AVs
{
llWhisper( 0, llDetectedName(i) + " located at " + llDetectedPos(i) ); //Whisper their name and coordinates
}
}
}


uncompiled but mostly cut and pasted from the wiki so ought to compile

Secondlife Wiki

L8r,
UU

where abouts in the site did you find this? Also, this doesn't work, i get type mismatches in the lldetectedname and pos.
Upshaw Underhill
Techno-Hobbit
Join date: 13 Mar 2003
Posts: 293
12-22-2004 20:22
sorry, forgot to declare my variables, add:

integer i;

before the default line

did that in both my responses today.
will check here in a second after the new update downloads

L8r,
UU


edit: oh, whoops, forgot to cast detectedpos as a string too... original post is edited to a fully functioning script now :)
Pete Fats
Geek
Join date: 18 Apr 2003
Posts: 648
12-23-2004 00:03
Need to change this too:

llWhisper( 0, llDetectedName(i) + " located at " + (string)llDetectedPos(i) );
_____________________
LordHighBen Hathor
Registered User
Join date: 8 Aug 2004
Posts: 6
12-23-2004 05:42
From: Upshaw Underhill
sorry, forgot to declare my variables, add:

integer i;

before the default line

did that in both my responses today.
will check here in a second after the new update downloads

L8r,
UU


edit: oh, whoops, forgot to cast detectedpos as a string too... original post is edited to a fully functioning script now :)

THank you, i can't describe how much this has helped my understanding of llSensor :).