Jump to content

Ways to take attendance with llSensor()


Shymus Roffo
 Share

You are about to reply to a thread that has been inactive for 3889 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have been trying to learn sensor and the fire department i'm in needs ways of taking attendance whenever we go on scenes but i don't know how to use sensor that well :matte-motes-mad: The attendance also taken at a scene will go to a server at the station so chiefs can see how many fires the firefighters have been too. 

Link to comment
Share on other sites

Shymus, what exactely is your question? I don't think that saying that it is about the usage of llSensor nn taking attendance in a fire department really help to understabd. Actually, my first reaction would be: What has that to do with sensors at all ;)

All I can say at the moment: look at llSensor and read carefully. it's explained quite well.

Link to comment
Share on other sites

Yes, this is possible.

First, you need everyone to activate the same group tag. Then, assign that group tag to an object with a script running a llSensorRepeat() that scans only for agents (avatars). Test each avatar found to see if they're a member of your group with llDetectedGroup(). If they're a member, add them to a list (if not already found within the list). At the end of the fire alarm event, send the list to your off-world database.

 

float SCAN_RANGE = 96.0;float SCAN_RATE = 60.0; // once per minutelist responders;default {   state_entry() {      llSensorRepeat("", "", AGENT, SCAN_RANGE, PI, SCAN_RATE);   }   sensor(integer num) {      while (num-- > 0) {         if (llDetectedGroup(num)) {            string name = llDetectedName(num);            if (~llListFindList(responders, [name]) {               responders += [name];            }         }      }   }}

 You could get fancy and add an "Alarm Event" ID number to each list in order to keep logs for different fire events. When you initialize the script at the scene, have the ID generated and added to the list first.

You could even add a "Time On Scene" component. This could be done by storing a llGetUnixTime() with each entry into the list along with placeholder for a "seconds" counter in the list. Then, if a name already exists in the list, instead of ignoring it, calculate the time difference between the current llGetUnixTime() and the initial time stored in the list. Replace the list item for "seconds" with the difference.

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3889 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...