Jump to content

AbaddonDarkness

New Resident
  • Posts

    1
  • Joined

  • Last visited

Everything posted by AbaddonDarkness

  1. @Mak7ka Your script almost worked. I think this is a working version detecting correctly people leaving as well. float timer_interval = 10.0; // how often to scan the area list im_recipients = []; // a list of the keys of the people who will get IMed, if blank owner is set list current_visitors; // keeps a list of current and previous people who were in the area, global values to preserve them between scans list previous_visitors; string region_name; default { on_rez () { llResetScript(); } changed (integer changed) { if (changed & CHANGED_OWNER) { llResetScript(); } } state_entry () { if (im_recipients == []) { im_recipients = llGetOwner(); } region_name = llGetRegionName(); llSetTimerEvent (timer_interval); // start the timer (and wait for it to trigger) } timer () { list arrivals; list departures; integer count; current_visitors = llGetAgentList (AGENT_LIST_PARCEL, []); // get the list of who's here now count = llGetListLength (current_visitors); while (count) // for each current visitor (if any), working backwards through the list (beacuse it's easier) { key visitor = llList2Key (current_visitors, --count); // decrement the counter (to convert it to a list index, and also set it up for the while loop test next iteration) and get the visitor's key if (llListFindList (previous_visitors, [visitor]) == -1) // are they in the list of people who were here last time? { arrivals += llGetDisplayName (visitor); // if not, add their name to the list of new arrivals llInstantMessage (im_recipients, "Arrival of " + visitor + " at " + region_name); } } count = llGetListLength (previous_visitors); while (count) // for each visitor who was here last time { key visitor = llList2Key (previous_visitors, --count); if (llGetAgentSize (visitor) == ZERO_VECTOR) { departures += llGetDisplayName (visitor); // if not, add their name to the list of departures llInstantMessage (im_recipients, "Departure of " + visitor + " from " + region_name); // Note that avatar names not present can not be resolved } } previous_visitors = current_visitors; // save the list of current visitors for next time; } }
×
×
  • Create New...