Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sensor Greeter List Manipulation

Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
11-23-2007 18:40
hiyas Everyone,

I'm trying to create my own greeter using a sensor.

I've set up to detect each agent and determine whether they have been greeted once already while in sensor range (list lstDet;).

I've then saved that list as all agents detected in sensor range (list AllDet;).

Now, as agents leave the sensor range, I want to remove the agents from the (list AllDet;) and create a new (list lstDet;). So that as they re-enter the sensor range, the same agent will recieve another greeting.

I think I'm almost there but the "list" manipulation has proven a little mind boggling for me. Any help on this would be greatly appreciated! :-)



CODE

// Sensor Range
float range = 96.0;
//Sensor rate
float rate = 1.0;

//First Welcomed Avatars
list lstDet;
//All Detected Avatars
list AllDet;

//Detected Avatar
key DetAV;


default
{
state_entry()
{
llSensorRepeat( "", "", AGENT, range, TWO_PI, rate );
}

on_rez(integer start_params)
{
llResetScript();
}

sensor( integer number_detected )
{
integer j;
integer count = number_detected;

for (j = 0; j < count; j++)
{
DetAV = llDetectedKey(j);
if (llListFindList(lstDet, [DetAV]) == -1)
{
llWhisper(0," Welcome to Slow Circle Intents " + llKey2Name(DetAV) + ". Enjoy your stay here and have a great SL day!");
integer list_length = llGetListLength(lstDet);

if(list_length >= 200)
{
lstDet = llDeleteSubList(lstDet,0 , 100);
lstDet = (lstDet=[]) + lstDet + [DetAV];
}
lstDet = (lstDet=[]) + lstDet + [DetAV];
AllDet = lstDet;
}
}
}
}
Zena Juran
Registered User
Join date: 21 Jul 2007
Posts: 473
Thanx!!!
11-25-2007 02:39
I managed to script a nice Sensor Greeter using llSensor instead of llSensorRepeat and throwing in a timer. I found (after numerous attempts.... lol) that using llGetUnixTime was the best way to "tag" agents coming and going. And changing over to do/while loops from for loops made everything a lot more flexible. Now to add some bells and whistles... woo hooo. Thanx to everyone for all the help! :-)