Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---settings----
- integer range = 96;
- integer rate = 15;
- list non_detect = ["348dc1b0-2d77-421f-90c5-813ec441a4fd","76095f37-ffb6-4908-abe9-60b22438f004"];//ad your AV-UUID
- integer debug = FALSE;
- //---var---------
- list visitors = [];
- list count = [];
- list on_land = [];
- list v_key = [];
- integer handle;
- integer menuChan;
- integer on_power = 0;
- //---functions---
- build_list(list av,list key_v)
- {
- integer num = llGetListLength(av);
- integer x;
- for(x=0;x<=(num-1);x++)
- {
- integer n = llListFindList(visitors,[llList2String(av,x)]);
- if(n == -1)
- {
- visitors += llList2String(av,x);
- count += "1";
- on_land += "1";
- v_key += llList2String(key_v,x);
- }
- string land = llList2String(on_land,n);
- if(land == "0" && n != -1)
- {
- integer z = (integer)llList2String(count,n) + 1;
- count = llListReplaceList(count, [(string)z],n,n);
- on_land = llListReplaceList(on_land, ["1"],n,n);
- }
- }
- integer nu = llGetListLength(visitors);
- integer i;
- for(i=0;i<=(nu-1);i++)
- {
- key v = (key)llList2String(v_key,i);
- string l = llList2String(on_land,i);
- if(l == "1")
- {
- if(llOverMyLand(v)==FALSE)
- {
- on_land = llListReplaceList(on_land, ["0"],i,i);
- }
- }
- }
- if(debug)
- {
- debug_out("in: "+llList2CSV(av));
- debug_out("visitors: "+llList2CSV(visitors));
- debug_out("count: "+llList2CSV(count));
- debug_out("land: "+llList2CSV(on_land));
- debug_out("key: "+llList2CSV(v_key));
- }
- }
- debug_out(string data)
- {
- llSay(0,data);
- }
- menu(key av)
- {
- list button = [];
- if(on_power == 0)
- {
- button += "Power On";
- }
- else
- {
- button += "Power Off";
- }
- button += "See List";
- button += "Reset List";
- llListenRemove(handle);
- menuChan = 50000 + (integer)llFrand(50000.00);
- handle = llListen(menuChan,"",NULL_KEY,"");
- llDialog(av,"Choose a Option",button,menuChan);
- llSetTimerEvent(30);
- }
- default
- {
- state_entry()
- {
- llOwnerSay("Add your AV-UUID to the 'non_detect' list in this script"),
- llOwnerSay("Add me to Landgroup");
- }
- touch_start(integer total_number)
- {
- integer f = llListFindList(non_detect,[(string)llDetectedKey(0)]);
- if(f != -1)
- {
- menu(llDetectedKey(0));
- }
- }
- listen(integer channel, string name, key id, string msg)
- {
- if(msg == "Power On")
- {
- llWhisper(0,"Start Sensor");
- on_power = 1;
- llSensorRepeat( "", "", AGENT, range, TWO_PI, rate );
- }
- if(msg == "Power Off")
- {
- llWhisper(0,"Remove Sensor");
- on_power = 0;
- llSensorRemove();
- }
- if(msg == "Reset List")
- {
- llWhisper(0,"List deleted, reset Script");
- llWhisper(0,"Turn me on now");
- llResetScript();
- }
- if(msg == "See List")
- {
- integer length = llGetListLength(visitors);
- integer t;
- for(t=0;t<=(length-1);t++)
- {
- llWhisper(0,llList2String(visitors,t)+":"+llList2String(count,t));
- }
- }
- llSetTimerEvent(0);
- llListenRemove(handle);
- }
- timer()
- {
- llSetTimerEvent(0);
- llListenRemove(handle);
- }
- on_rez(integer param)
- {
- llResetScript();
- }
- sensor(integer number_detected)
- {
- list visitor_found;
- list v_key_v;
- integer i;
- for(i = 0;i<number_detected;i++)
- {
- integer nu = llListFindList(non_detect,[(string)llDetectedKey(i)]);
- if(nu == -1)
- {
- visitor_found += llDetectedName(i);
- v_key_v += (string)llDetectedKey(i);
- }
- }
- build_list(visitor_found,v_key_v);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement