Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Proximity

Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
10-23-2006 09:53
I'm wanting to build something that reacts to the proximity of an avatar, except mine maybe. What should I be searching on because "Proximity" itself doesn't yield the answers I'm looking for. I'm wanting to do something that records the names of the people who pass a point in my build, so it's only looking for people at a 0m range effectively.

Any ideas/pointers?

Cheers!
_____________________
<VOTE PROPOSITION 4968/>
http://jira.secondlife.com/browse/VWR-4968
For SecondLife Builders who need better mapping for better building
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
10-23-2006 09:54
VolumeDetect.
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
10-23-2006 10:50
From: Llauren Mandelbrot
VolumeDetect.


Llauren's solution is best for when people are passing through a particular doorway/hallway. if you just want to know when someone gets near your build a llSensor or llSensorRepeat would be needed.
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
HtF Visconti
Registered User
Join date: 21 Jul 2006
Posts: 123
10-23-2006 10:54
I'd say it depends on the exact demand which is a tad unspecific.

Scanners have a bit of a problem because they will not really report all avatars (if there's a whole bunch) and scanners seem to be a bit more load intensive than the volume detect function.

So - if the distance to check for is moderately small (like below 20 or so meters) llVolumeDetect() would probably be a good choice, not many prims needed to cover the area - if we're talking a large perimeter here a scanner is the best option, becaus eit would use way too many prims to cover the area :)
.
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
10-23-2006 11:30
Fair enough, but Landing Normandy asked for a "zero range" sensor. :)
Vares Solvang
It's all Relative
Join date: 26 Jan 2005
Posts: 2,235
10-23-2006 20:08
I just modified my sensor driven visitor counter to be volumedetect activated. You can just put it in an invisible prim that is across the doorway or hallway you want to monitor.

CODE
// Global variables
list visitor_list;


// Functions
integer isNameOnList( string name )
{
integer found= llListFindList( visitor_list, [ name ]);
if(found >= 0) return TRUE;
return FALSE;
}

// States
default
{
on_rez (integer whatever)
{
llResetScript();
}
state_entry()
{
llSay(0, "Visitor List Maker started...");
llSay(0, "The owner can say '/10 help' for instructions.");
llVolumeDetect(TRUE);
llListen(10, "", "", "");
}


collision_start(integer number_detected)
{
integer i;
for( i = 0; i < number_detected; i++ )
{
if( llDetectedKey( i ) != llGetOwner() )
{
string detected_name = llDetectedName( i );
if( isNameOnList( detected_name ) == FALSE )
{
visitor_list += detected_name;
}
}
}
}

listen( integer channel, string name, key id, string message )
{
if( id != llGetOwner() )
{
return;
}

if( message == "help" )
{
llOwnerSay( "This object records the names of everyone who passes through it" );
llOwnerSay( "Commands the owner can say on channel 10:" );
llOwnerSay( "'help' - Shows these instructions." );
llOwnerSay( "'say list' - Says the names of all visitors on the list.");
llOwnerSay( "'reset list' - Removes all the names from the list." );
}
else
if( message == "say list" )
{
llOwnerSay( "Visitor List:" );
integer len = llGetListLength( visitor_list );
integer i;
for( i = 0; i < len; i++ )
{
llOwnerSay( llList2String(visitor_list, i) );
}
llOwnerSay( "Total = " + (string)len );
}
else
if( message == "reset list" )
{
visitor_list = llDeleteSubList(visitor_list, 0, llGetListLength(visitor_list));
llOwnerSay( "Done resetting.");
}
}
}

_____________________
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
10-24-2006 02:10
Thanks guys. What will actually happen is that I have 'laserbeams' that cross the hall way, I want to know if anyone breaks them, so the Volume one sounds like what I'm after.

I'll try it and see how it goes, thanks!
_____________________
<VOTE PROPOSITION 4968/>
http://jira.secondlife.com/browse/VWR-4968
For SecondLife Builders who need better mapping for better building
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
10-24-2006 03:09
V, need to change your isNameOnList function. Its based on the first version I wrote thats so awful I should have been hung for the crime of not reading the wikki.

CODE
integer isNameOnList( string name )
{
integer found= llListFindList( visitor_list, [ name ]);
if(found >= 0) return TRUE;
return FALSE;
}


No need to check for owner as you have already set the listen to only listen to the owner.

CODE
llListen(10, "", llGetOwner(), "");


What you probably should do is reset the script on change of owner, if you ever gave the unit away that is.

style thing else if goes on one line not two!!!! :)
Vares Solvang
It's all Relative
Join date: 26 Jan 2005
Posts: 2,235
10-24-2006 12:12
Actually I didn't write this script at all, it's a freebie script I found somewhere. I have it sitting out on my land near my vendors, and when I read the OP I figured it would be pretty east to convert. All I did was replace the sensor functions with volume detect functions. So basically, I only changed two lines and then deleted the variables that were used to set the range and interval of the sensor. :p

Reading my previous post I guess it does kind of sound like I was saying I wrote it, sorry! :o


Edit: I went ahead and edited it to change the things you suggested though. After all, you are the script wizzaurd! :D

I just checked and the original script is by Aaron Linden. I also corrected the Help instructions is says because it still referred to the range and interval of the sensor and since I had removed the variables it wouldn't compile. It works now. :)
_____________________
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
10-25-2006 02:00
From: Vares Solvang
Actually I didn't write this script at all, it's a freebie script I found somewhere. I have it sitting out on my land near my vendors, and when I read the OP I figured it would be pretty east to convert. All I did was replace the sensor functions with volume detect functions. So basically, I only changed two lines and then deleted the variables that were used to set the range and interval of the sensor. :p

Reading my previous post I guess it does kind of sound like I was saying I wrote it, sorry! :o


Edit: I went ahead and edited it to change the things you suggested though. After all, you are the script wizzaurd! :D

I just checked and the original script is by Aaron Linden. I also corrected the Help instructions is says because it still referred to the range and interval of the sensor and since I had removed the variables it wouldn't compile. It works now. :)



Well the IsNameOnList bit is from my first visitor list maker, I recognise my signature :)
I used a freebie script as a basis but no idea where or who.