Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

List avatar in the simulator

Jim Bunderfeld
The Coder
Join date: 1 Mar 2004
Posts: 161
04-06-2004 00:27
Free to use make any changes you like, open source.

Just say "list sim" to get a list of all the avatar in the Simulator.


CODE

////////////////////////
//List Sim
//By: Jim Bunderfeld
////////////////////////


integer t;
integer x;
key owner; // Key Id for the owner of the script.
default
{
on_rez(integer start_param)
{
owner = llGetOwner(); //Sets the key to the owner of rezzer
}
state_entry()
{
owner = llGetOwner();
llListen(0,"",owner,""); //Listens on channel 0 for the owner
}
listen(integer c,string n,key i,string m)
{
if(i == owner) //Listens to commands of owner
{
if(m == "list sim")
{
llSensor("","",AGENT,256,PI);

}
}
}
sensor(integer total_detected)
{

t = total_detected - 1;
for(x = 0;x <= t;x++)
{
llSay(0,llDetectedName(x)+ " is in the sim");
}
}
}
Julian Fate
80's Pop Star
Join date: 19 Oct 2003
Posts: 1,020
04-06-2004 15:14
Does llSensor() only return results for the sim you're in or will it return everyone out to the limit of its range even if they're in other sims? Also, the wiki says, "The limit of range is 96m. Values greater than 96 will work, but will be treated as 96 metres." Does that mean any value over 96, like 256, will be damped down to 96? And isn't it the function limited to 16 results?
Cyanide Leviathan
Xtreme Loser Squad
Join date: 12 Jun 2003
Posts: 408
04-07-2004 16:00
Hey, you do know that sensors only reach 96 meters, it happens to most of us, i thought it was 128 for the longest time
_____________________
Bino Arbuckle
Registered User
Join date: 31 Dec 2002
Posts: 369
04-07-2004 19:35
Jim, do you know about the sensor detecting and range limits?

Sensors are guaranteed accurate upto 30m according to the documentation. They are fairly accurate upto 96m.

However, sensors only return a maximum of 16 detections. So you could have 40 avs in a sim, but it will only return the names of 16 of them.
Jim Bunderfeld
The Coder
Join date: 1 Mar 2004
Posts: 161
04-08-2004 21:32
But there is no other way...is there?
Alpha Zaius
llLol()
Join date: 13 Mar 2004
Posts: 1,187
06-07-2004 08:18
well.. ill be happy if someone does this...
you have a main center.
you have the main object listen in on a certain channel (etc: 44)


each quadrant is 1/2 of a sim width and length wise.
so the measurements is 128/128..

We have the main object rez 5 Objects. One going to the middle of A, other to B,another to C, one at D, and the last one right dab at 128,128.

each object takes a sensor *snapshot of avatars in the sim, travel back to the main object (still listen ing on channel 44)

After it travels back, ecch object tells the main object who was there.
Then the main object tells the 5 objects to delete

then...

there will be doubles in the big long list of avatars
so we need to remove them

so it does a for command that steps through the list and looksto see if there is more than one of those. and then whichit deletes that entry and moves on. otherwise. it moves on..

...

Then it says all of the avatars that are in a sim (whch can be 40 since all 5 objects have a limit of 16. Which would ne 16 * 4.
see?

That aint so hard, Im jsut typing fast and not reading what I typed. so. there. I just finished this tutorial in about 3 minutes
enjoy.
ps:
would it be really a tutorial
lol
:D
:D
:D
_____________________
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
06-14-2004 11:21
only problem is that the sim goes up to 4096... which means alot of sensors... something like 270 give or take 30...
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Raphael Rutherford
Resident Resident
Join date: 26 Mar 2004
Posts: 236
09-18-2004 07:10
Unfortunately this won't work when there's more than 16 av's in a corner of the sim.


What happens if a name is given to llSensor. Would it detect that single name in a crowd of 40 people ?
Anyone knows ?

/RR
Evil Fool
"==" != "="
Join date: 30 Jul 2004
Posts: 110
09-18-2004 19:41
From: someone
Originally posted by Strife Onizuka
only problem is that the sim goes up to 4096... which means alot of sensors... something like 270 give or take 30...


you can't move objects past 768m...

And... you can go higher than 4096m
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
09-18-2004 22:47
When searching for a specific name or key, you'll get a hit (if you should be) no matter how many other objects or agents there are. The 16 limit is just for the number of results returned.

With overlapping sensors, you can use llDetectedPos of each to prevent repeats. For example, spread your sensors in a grid every 67 meters x, y, and z over the range you wish to detect. With a sensor range of 96 meters, that gives complete coverage. To prevent overlap giving multiple results for targets at the border between sensors, check each result's position at make sure its x, y, and z values are all less than 67 meters away from the sensor.
_____________________
~ Tiger Crossing
~ (Nonsanity)
Morgaine Dinova
Active Carbon Unit
Join date: 25 Aug 2004
Posts: 968
09-20-2004 17:48
Looks like we're going to have to flood-fill the whole grid with a regular array of sensors just to get some some decent occupancy data back, and maybe have players wear the SL version of RFID tags. :-)

Perhaps when all the sims are running at 100% load just with housekeeping traffic, LL might realize that placing range limits on sensing by a plot owner on the owner's own land is ridiculous and pointless.

Sensing limits do have a purpose in gaming, but not in plot administration. Apply them only to sensing on non-owned soil.

Or even better, leave sensing for gaming, and provide some decent data-gathering functions for plot owners!
_____________________
-- General Mousebutton API, proposal for interactive gaming
-- Mouselook camera continuity, basic UI camera improvements
Doops Lomax
Registered User
Join date: 1 May 2004
Posts: 4
09-21-2004 10:37
Check out fx Industires, Flyte Xevious has something that works like an av detector but for the whole sim.
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
09-21-2004 13:01
I've got half a sim, and it only takes four sensors. Check out the active map under the TigerTor lobby in Celadon. One of the sensors in the grid is hanging high in the air above it, and the other three are similarly place around the land.
_____________________
~ Tiger Crossing
~ (Nonsanity)
Raphael Rutherford
Resident Resident
Join date: 26 Mar 2004
Posts: 236
09-23-2004 06:45
Tiger, I tried making a llSensorRepeat with a specified name, and went to the welcome area in Aherm to test it.

The sensor range was set to 90 meters.

There was about 20-25 people there, and the sensor could NOT reliably detect the AV I specified.

Moving in closer would sometimes work, but on a few occations, I stood right beside an AV, and still did not get a valid sensor response. But if I moved around, the sensor would suddenly trigger for the same AV that it didnt find a minute earlier.


/RR