Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looking a script...

Skarlet Rutledge
The Pool Lady
Join date: 21 Sep 2004
Posts: 68
02-12-2006 10:04
... that tells me who is in my hearing distance for general chat. Can someone tell me were to find one?

Thanks!!! :D
Hillary Melville
Emotionally Anarchic
Join date: 5 Jun 2005
Posts: 16
02-12-2006 13:29
There are several radar attachments and HUDs that do what you want. If you want to write your own, start with the example here:

http://secondlife.com/badgeo/wakka.php?wakka=sensor
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
02-12-2006 16:24
Here's the script that I use for my HUD chat notifier.
CODE

// Chat notifier script
// by Ordinal Malaprop

// Global list of people here at previous scan
list gHere = [];

default
{
state_entry()
{
llOwnerSay("Chat range alerter initialised");
// Clear any text hanging around
llSetText("", <0,1,0>, 1.0);
llSetAlpha(1.0, ALL_SIDES);
// Start a sensor for agents within 20m
llSensorRepeat("", NULL_KEY, AGENT, 20.0, PI, 2.0);
}

no_sensor()
{
// If nobody is detected, everyone has left
// Go through old list and say that everyone on it has gone
llSetText("", <0,1,0>, 1.0);
if (gHere != []) {
integer f;
integer c = llGetListLength(gHere);
for (f=0; f<c; f++) { // go through old list
llOwnerSay(llList2String(gHere, f) + " has left chat range");
}
gHere = [];
}
}

sensor(integer total_number)
{
integer f;
string name;
string display = "";
list here = [];
vector myPos = llGetPos();
// Make a list of people who are within range
for (f=0; f<total_number; f++) {
name = llDetectedName(f);
here += name;
display += name + " @ " + (string)llRound(llVecDist(llDetectedPos(f), myPos)) + "m\n";
if (llListFindList(gHere, [name]) == -1) llOwnerSay(name + " has entered chat range");
}
// Now check to see if anyone has left,
// based on the list from the last scan
here = llListSort(here, 1, TRUE); // sort list
integer c = llGetListLength(gHere);
if (here != gHere) { // if new list not the same as old one
for (f=0; f<c; f++) { // go through old list
name = llList2String(gHere, f);
// If anyone on old list is not on new list,
// say that they have left
if (llListFindList(here, [name]) == -1) llOwnerSay(name + " has left chat range");
}
}
// Update old list variable
gHere = here;
// Display the people who are here now
llSetText(display, <0,1,0>, 1.0);
}

touch_start(integer n)
{
// Turn it off when touched by owner
if (llDetectedKey(0) == llGetOwner()) state dormant;
}
}

state dormant
{
state_entry()
{
llOwnerSay("Chat range alerter switched off");
llSetText("", <0,0,0>, 1.0);
llSetAlpha(0.5, ALL_SIDES);
gHere = [];
}

touch_start(integer n)
{
// Turn it back on if touched by owner
if (llDetectedKey(0) == llGetOwner()) state default;
}
}


If you don't want to cut and paste there's a full mod full copy working version of it at my home area showroom - Theretra 169,199,97 - for L$1, with a nice texture and an info notecard.

I have this one on pretty much all the time - I'd be lost without it. People are always sneaking up on me while I'm building and I never notice them otherwise.