From 6fdbbbb0a348e3ec3249089f6f735e06fedfb0fd Mon Sep 17 00:00:00 2001 From: Fred Beckhusen Date: Tue, 17 Dec 2019 20:33:18 -0600 Subject: [PATCH] New scripts ro load Signed-off-by: Fred Beckhusen --- FlashLamp/Object/Flash.lsl | 37 ++ GameOfFireAndIce | 1 + HG Teleporter/HG Teleporter.sol | 3 + HG Teleporter/HG Teleporter/HG Teleporter.prj | 8 + .../HG Teleporter/Object/Destinations | 29 ++ HG Teleporter/HG Teleporter/Object/Script.lsl | 480 ++++++++++++++++++ Lag Meter/Lag Meter.sol | 3 + Lag Meter/Lag Meter/Lag Meter.prj | 6 + .../Object/Open Source Lag meter.lsl | 87 ++++ .../Move-From-Point-To-Point.sol | 3 + .../Move-From-Point-To-Point.prj | 6 + .../Mover Prim/Mover Script.lsl | 44 ++ .../Opensim VIsitors List.sol | 3 + .../Opensim VIsitors List/Object/Script.lsl | 117 +++++ .../Opensim VIsitors List.prj | 6 + Trash Collector NPC/Trash Collector NPC.sol | 3 + .../NPC Box/Trash Collector script.lsl | 180 +++++++ .../Trash Collector NPC.prj | 6 + 18 files changed, 1022 insertions(+) create mode 100644 FlashLamp/Object/Flash.lsl create mode 160000 GameOfFireAndIce create mode 100644 HG Teleporter/HG Teleporter.sol create mode 100644 HG Teleporter/HG Teleporter/HG Teleporter.prj create mode 100644 HG Teleporter/HG Teleporter/Object/Destinations create mode 100644 HG Teleporter/HG Teleporter/Object/Script.lsl create mode 100644 Lag Meter/Lag Meter.sol create mode 100644 Lag Meter/Lag Meter/Lag Meter.prj create mode 100644 Lag Meter/Lag Meter/Object/Open Source Lag meter.lsl create mode 100644 Move-From-Point-To-Point/Move-From-Point-To-Point.sol create mode 100644 Move-From-Point-To-Point/Move-From-Point-To-Point/Move-From-Point-To-Point.prj create mode 100644 Move-From-Point-To-Point/Move-From-Point-To-Point/Mover Prim/Mover Script.lsl create mode 100644 Opensim VIsitors List/Opensim VIsitors List.sol create mode 100644 Opensim VIsitors List/Opensim VIsitors List/Object/Script.lsl create mode 100644 Opensim VIsitors List/Opensim VIsitors List/Opensim VIsitors List.prj create mode 100644 Trash Collector NPC/Trash Collector NPC.sol create mode 100644 Trash Collector NPC/Trash Collector NPC/NPC Box/Trash Collector script.lsl create mode 100644 Trash Collector NPC/Trash Collector NPC/Trash Collector NPC.prj diff --git a/FlashLamp/Object/Flash.lsl b/FlashLamp/Object/Flash.lsl new file mode 100644 index 00000000..dec8e92f --- /dev/null +++ b/FlashLamp/Object/Flash.lsl @@ -0,0 +1,37 @@ + +integer root = 0 ; // change to the number of a prim that you want to flash +float timeval = 0.1; //the interval between events, smaller = faster +integer counter = 0; + +On() { + llSetLinkPrimitiveParamsFast(root,[PRIM_POINT_LIGHT, TRUE, <1,1,1>, 1.0, 10, .1, PRIM_FULLBRIGHT, ALL_SIDES,TRUE, PRIM_GLOW, ALL_SIDES, 1.0]); +} +Off() { + llSetLinkPrimitiveParamsFast(root,[PRIM_POINT_LIGHT, FALSE, <1,1,1>, 1.0, 10, .1, PRIM_FULLBRIGHT, ALL_SIDES,FALSE, PRIM_GLOW, ALL_SIDES, 0.0]); +} +default +{ + state_entry() + { + Off(); + } + touch_start(integer total_number) + { + llSetTimerEvent(timeval); // between events + } + timer() + { + if (counter == 0) + On(); + else if (counter == 1) + Off(); + else if (counter == 2) + On(); + else if (counter >= 3) { + Off(); + counter = -1; + llSetTimerEvent(0); + } + counter++; + } +} \ No newline at end of file diff --git a/GameOfFireAndIce b/GameOfFireAndIce new file mode 160000 index 00000000..d446b505 --- /dev/null +++ b/GameOfFireAndIce @@ -0,0 +1 @@ +Subproject commit d446b50561b080dff4666a0c70263808992ec7cb diff --git a/HG Teleporter/HG Teleporter.sol b/HG Teleporter/HG Teleporter.sol new file mode 100644 index 00000000..08a50db0 --- /dev/null +++ b/HG Teleporter/HG Teleporter.sol @@ -0,0 +1,3 @@ + + + diff --git a/HG Teleporter/HG Teleporter/HG Teleporter.prj b/HG Teleporter/HG Teleporter/HG Teleporter.prj new file mode 100644 index 00000000..b8f60910 --- /dev/null +++ b/HG Teleporter/HG Teleporter/HG Teleporter.prj @@ -0,0 +1,8 @@ + + + + + + + diff --git a/HG Teleporter/HG Teleporter/Object/Destinations b/HG Teleporter/HG Teleporter/Object/Destinations new file mode 100644 index 00000000..a4edadc1 --- /dev/null +++ b/HG Teleporter/HG Teleporter/Object/Destinations @@ -0,0 +1,29 @@ + +// Example notecard + +// Enter each destination in the form : +// grid | region | x,y (global location) | url | x,y,z (optional landing point) + +// The optional landing point is useful in the case of sims that not been designed +// for direct teleport, when your avatar lands underwater or in a closed room. +Raels World|The High castle|2359,1466||| +Raels World|Tomb raider Temple| 2409,1516||| +Raels World|Sleepless City| 2399,1506||| +Raels World|Raels World| 2339,1446 ||| +Raels World|Raels habitat| 2349,1456||| +Raels World|Raels Freebee mall|2389,1496||| +Raels World|Raels flight test ground|2379,1486||| +Raels World|Raels club|2419,1526||| +Raels World|Doomed city|2369,1476|||martin + + +// Example notecard + +// Enter each destination in the form : +// grid | region | x,y (global location) | url | x,y,z (optional landing point) + +// The optional landing point is useful in the case of sims that not been designed +// for direct teleport, when your avatar lands underwater or in a closed room. + + +Raels World | The High castle | 2359,1466 || 92.232.227.241| \ No newline at end of file diff --git a/HG Teleporter/HG Teleporter/Object/Script.lsl b/HG Teleporter/HG Teleporter/Object/Script.lsl new file mode 100644 index 00000000..5c3ad9a1 --- /dev/null +++ b/HG Teleporter/HG Teleporter/Object/Script.lsl @@ -0,0 +1,480 @@ + + +//LSL-Editor ONLY code - delete this to actually work in-Openim + +osMessageObject(key id, string str) {} +osSetDynamicTextureData( string dynamicID, string contentType, string data, string extraParams, integer timer) {} +string osSetPenColor(string drawList, string color) { return "";} +string osMovePen(string drawList, integer x, integer y) { return "";} +string osDrawRectangle(string drawList, integer width, integer height) { return "";} +string osDrawFilledRectangle(string drawList, integer width, integer height) {return "";} +string osDrawText(string drawList, string texts) {return "";} +string osSetPenSize(string drawList, integer penSize) {return "";} +string osSetFontSize(string drawList, integer fontSize) {return "";} +osTeleportAgent(key agent, string regionName, vector position, vector lookat) {} + + + +// (c) The owner of Avatar Jeff Kelley, 2010 +// +// This script is licensed under Creative Commons BY-NC-SA +// See +// +// You may not use this work for commercial purposes. +// You must attribute the work to the author, Jeff Kelley. +// You may distribute, alter, transform, or build upon this work +// as long as you do not delete the name of the original author. +// +// *** UPDATED *** +// Fix to allow the boards to work under Opensim 0.8.1 official release and later +// by Aine Caoimhe March 2015 +// - removed 4096-region distance check as distance is no longer limitted as of 0.8.0.x +// - fixed: change to TP code handling requires that grid url and port be stripped from local tp +// To use this fix you must add your own local grid's url and port here (example "refugegrid.com:8002") +string localGrid="world.narasnook.com:8900"; + +integer DEBUG_ON = FALSE; +DEBUG(string message) {if (DEBUG_ON) llOwnerSay(message);} + + +/////////////////////////////////////////////////////////////////// +// Part 1 : Datasource +/////////////////////////////////////////////////////////////////// + +// The goal of the datasource is to read a file in script's memory +// At the moment, we support three datasources: +// +// http:// A web file +// card://cardname A notecard in the objects's inventory +// card://uuid/cardname A notecard from the LSL server 'uuid' +// (requires a server script, not included) +// +// Edit the 'datasource' string to fit your need +// +//string datasource = "card://Destinations"; +//string datasource = "card://e511d6c0-7588-4157-a684-8ca5f685a077/Destinations"; +//string datasource = "http://my_web_server/path_to_file/Destinations"; + +string datasource = "card://Destinations"; + +string datasorceData; // The content of the datasource + +readFile(string source) { + list parse = llParseString2List (source, ["/"],[]); + string s0 = llList2String (parse, 0); + string s1 = llList2String (parse, 1); + string s2 = llList2String (parse, 2); + + // Web server: fall through http_response event + + if (s0 == "http:") sendHTTPRequest (source); + + // LSL server : fall through dataserver event + // If no UUID : fall through dataserver event + + if (s0 == "card:") + if (isUUID(s1)) osMessageObject ((key)s1, "READ "+s2); + else readNotecard (s1); +} + +integer isUUID (string s) { + list parse = llParseString2List (s, ["-"],[]); + return ((llStringLength (llList2String (parse, 0)) == 8) + && (llStringLength (llList2String (parse, 1)) == 4) + && (llStringLength (llList2String (parse, 2)) == 4) + && (llStringLength (llList2String (parse, 3)) == 4) + && (llStringLength (llList2String (parse, 4)) == 12)); +} + +/////////////////// +// Notecard reader +/////////////////// + +// Since osGetNotecard has Threat Level = VeryHigh +// we stick to the old, slow, clumsy notecard reader + +string ncName; // Name of the notecard to be read +key ncQueryID; // id of dataserver queries +integer ncLine; // Current line being read + +readNotecard (string name) { + ncName = name; + ncLine = 0; + ncQueryID = llGetNotecardLine(ncName, ncLine++); // request first line +} + +addtoNotecard (string data) { + datasorceData += data+"\n"; + ncQueryID = llGetNotecardLine(ncName, ncLine++); // Request next line +} + +/////////////////// +// Http stuff +/////////////////// + +key httpQueryId; + +sendHTTPRequest (string url) { + httpQueryId = llHTTPRequest(url, + [ HTTP_METHOD, "GET", HTTP_MIMETYPE,"text/plain;charset=utf-8" ], ""); +} + +string URI2hostport (string uri) { + list parse = llParseString2List (uri, [":"], []); + return llList2String (parse, 0) + +":" + llList2String (parse, 1); +} + + +/////////////////////////////////////////////////////////////////// +// Part 2 : Parsing & accessors +/////////////////////////////////////////////////////////////////// + +list destinations; // Strided list for destinations + +integer NAME_IDX = 0; // Index of region name in list +integer COOR_IDX = 1; // Index of grid coordinates in list +integer HURL_IDX = 2; // Index of hypergrid url in list +integer HGOK_IDX = 3; // Index of validity flag in list +integer LAND_IDX = 4; // Index of landing point in list +integer N_FIELDS = 5; // Total number of fields + +parseFile (string data) { + list lines = llParseString2List (data,["\n"],[]); + integer nl = llGetListLength (lines); + integer i; for (i=0;i; +// vector ourLoc = llGetRegionCorner()/256; +// integer ok =( llAbs(llFloor(hisLoc.x - ourLoc.x)) < 4096 ) +// && ( llAbs(llFloor(hisLoc.y - ourLoc.y)) < 4096 ) +// && ( hisLoc != ourLoc); + integer ok=TRUE; +// *** END CHANGE + + // Parse and check landing point + + parse = llParseString2List (coor, [","],[]); + integer xland = llList2Integer (parse, 0); // X landing point + integer yland = llList2Integer (parse, 1); // Y landing point + integer zland = llList2Integer (parse, 2); // Z landing point + + vector land = ; + if (land == ZERO_VECTOR) land = <128,128,20>; + + // Note: grid and region names merged into one field + destinations += [grid+" "+name, gloc, hurl, ok, land]; +} + +/////////////////// +// List accessors +/////////////////// + +string dst_name (integer n) { // Get name for destination n + return llList2String (destinations, N_FIELDS*n +NAME_IDX); +} + +string dst_coord (integer n) { // Get coords for destination n + return llList2String (destinations, N_FIELDS*n +COOR_IDX); +} + +vector dst_landp (integer n) { // Get landing point for destination n + return llList2Vector (destinations, N_FIELDS*n +LAND_IDX); +} + +string dst_hgurl (integer n) { // Get hypergrid url for destination n + return llList2String (destinations, N_FIELDS*n +HURL_IDX); +} + +integer dst_valid (integer n) { // Get validity flag for destination n + return llList2Integer (destinations, N_FIELDS*n +HGOK_IDX); +} + + +//////////////////////////////////////////////////////////// +// Part 3 : Drawing +//////////////////////////////////////////////////////////// + +integer TEXTURE_SIZE = 512; +integer DISPLAY_SIDE = 4; +integer FONT_SIZE = 10; // Depends on TEXTURE_SIZE +integer COLUMNS = 2; +integer ROWS = 16; + +string validCellColor = "CadetBlue"; +// string invalCellColor = "IndianRed"; +string invalCellColor = "CadetBlue"; +string emptyCellColor = "DarkGray"; +string cellBorderColor = "White"; +string backgroundColor = "Gray"; + +string drawList; + +displayBegin() { + drawList = ""; +} + +displayEnd() { + osSetDynamicTextureData ( "", "vector", drawList, + "width:"+(string)TEXTURE_SIZE+",height:"+(string)TEXTURE_SIZE, 0); +} + +drawCell (integer x, integer y) { + integer CELL_HEIGHT = TEXTURE_SIZE / ROWS; + integer CELL_WIDHT = TEXTURE_SIZE / COLUMNS; + integer xTopLeft = x*CELL_WIDHT; + integer yTopLeft = y*CELL_HEIGHT; + + // Draw grid + + drawList = osSetPenColor (drawList, cellBorderColor); + drawList = osMovePen (drawList, xTopLeft, yTopLeft); + drawList = osDrawRectangle (drawList, CELL_WIDHT, CELL_HEIGHT); + + integer index = (y+x*ROWS); + string cellName = dst_name(index); + integer cellValid = dst_valid(index); + + string cellBbackground; + if (cellName == "") cellBbackground = emptyCellColor; else + if (cellValid) cellBbackground = validCellColor; else + cellBbackground = invalCellColor; + + // Fill background + + drawList = osSetPenColor (drawList, cellBbackground); + drawList = osMovePen (drawList, xTopLeft+2, yTopLeft+2); + drawList = osDrawFilledRectangle (drawList, CELL_WIDHT-3, CELL_HEIGHT-3); + + xTopLeft += 2; // Center text in cell + yTopLeft += 6; // Center text in cell + drawList = osSetPenColor (drawList, "Black"); + drawList = osMovePen (drawList, xTopLeft, yTopLeft); + drawList = osDrawText (drawList, cellName); +} + +drawTable() { + displayBegin(); + + drawList = osSetPenSize (drawList, 1); + drawList = osSetFontSize (drawList, FONT_SIZE); + + drawList = osMovePen (drawList, 0, 0); + drawList = osSetPenColor (drawList, backgroundColor); + drawList = osDrawFilledRectangle (drawList, TEXTURE_SIZE, TEXTURE_SIZE); + + integer x; integer y; + for (x=0; x + + diff --git a/Lag Meter/Lag Meter/Lag Meter.prj b/Lag Meter/Lag Meter/Lag Meter.prj new file mode 100644 index 00000000..fc84339c --- /dev/null +++ b/Lag Meter/Lag Meter/Lag Meter.prj @@ -0,0 +1,6 @@ + + + + + diff --git a/Lag Meter/Lag Meter/Object/Open Source Lag meter.lsl b/Lag Meter/Lag Meter/Object/Open Source Lag meter.lsl new file mode 100644 index 00000000..5e3fdcc7 --- /dev/null +++ b/Lag Meter/Lag Meter/Object/Open Source Lag meter.lsl @@ -0,0 +1,87 @@ +//:AUTHOR: Chaser.Zaks + +//Link two boxes then put the script inside. + +//By Chaser.Zaks. +//Feel free to redistribute and use in projects(even in sold products, just keep it open source). +//DO NOT CLOSE SOURCE OR SELL ALONE. + +//Configuration: +integer MeasureNonParcelPrims=FALSE; +//Variables, these are dynamically set, don't bother with them. +string region; +string sim; +vector color; +integer avatars; +integer lastrestart; +integer days; +integer hours; +integer minutes; +integer seconds; +integer lastrestartedcalc; +list same_params =[PRIM_SLICE, <0.5, 1.0, 0.0>,PRIM_FULLBRIGHT,ALL_SIDES,TRUE,PRIM_TEXTURE,ALL_SIDES,TEXTURE_BLANK,ZERO_VECTOR,ZERO_VECTOR,0]; + +default +{ + state_entry() + { + + llSetObjectName("Open Source Lag Meter v3"); + llSetLinkPrimitiveParams(1,same_params+[PRIM_COLOR,ALL_SIDES,<0,0,0>,.4,PRIM_SIZE,<.5,.5,4>]); + llSetLinkPrimitiveParams(2,same_params+[PRIM_COLOR,ALL_SIDES,<0,1,0>,1.,PRIM_SIZE,<.4,.4,3.8>,PRIM_POS_LOCAL,<0,0,.04>]); + llSetText("Initalizing...",<1,1,0>, 1.0); + //First start, Set some stuff. + lastrestart = llGetUnixTime(); + llSetTimerEvent(0.5); //One second is too much checking. Let's not be a resource hog. + } + changed(integer change) + { + if(change & CHANGED_REGION_START) + lastrestart = llGetUnixTime(); + } + timer(){ + region = llGetRegionName(); + avatars = llGetListLength(llGetAgentList(AGENT_LIST_REGION, [])); + //Restart time + lastrestartedcalc = llGetUnixTime()-lastrestart; + days=0; + hours=0; + minutes=0; + seconds=0; + do{ + if(lastrestartedcalc>=86399){ + days++; + lastrestartedcalc=lastrestartedcalc-86399; + }else if(lastrestartedcalc>=3599){ + hours++; + lastrestartedcalc=lastrestartedcalc-3599; + }else if(lastrestartedcalc>=59){ + minutes++; + lastrestartedcalc=lastrestartedcalc-59; + }else{ + seconds++; + lastrestartedcalc--; + } + }while(lastrestartedcalc>=0); + float region_time_dilation=llGetRegionTimeDilation(); + if(region_time_dilation>=0.75) + color=<0,1,0>; + else if(region_time_dilation>=0.50) + color=<1,1,0>; + else + color=<1,0,0>; + integer primsused=llGetParcelPrimCount(llGetPos(), PARCEL_COUNT_TOTAL, MeasureNonParcelPrims); + integer maxprims=llGetParcelMaxPrims(llGetPos(), MeasureNonParcelPrims); + llSetText( + "Region: "+region+ + "\nAvatars: "+(string)avatars+ + "\nPrims left: "+(string)(maxprims-primsused)+" ("+(string)primsused+"/"+(string)maxprims+")"+ + "\nDilation: "+llGetSubString((string)((1.-region_time_dilation)*100.), 0, 3)+"%"+ + "\nFPS: "+llGetSubString((string)llGetRegionFPS(), 0, 5)+ + "\nLast restart:\n"+(string)days+" Days, "+(string)hours+" Hours, "+(string)minutes+" Minutes, and "+(string)seconds+" Seconds ago.", + //"\nLast restart:\n"+(string)days+":"+(string)hours+":"+(string)minutes+":"+(string)seconds, + color, 1.0); + //llSetLinkPrimitiveParamsFast(2,[PRIM_SLICE,<0,(region_time_dilation),0>,PRIM_COLOR,ALL_SIDES,color,1]); + llSetLinkPrimitiveParamsFast(2,[PRIM_SLICE, <0.5, 1., 0.0>,PRIM_SIZE,<0.4, 0.4, 3.80*region_time_dilation>,PRIM_COLOR,ALL_SIDES,color,1]); + } +} \ No newline at end of file diff --git a/Move-From-Point-To-Point/Move-From-Point-To-Point.sol b/Move-From-Point-To-Point/Move-From-Point-To-Point.sol new file mode 100644 index 00000000..7db895a3 --- /dev/null +++ b/Move-From-Point-To-Point/Move-From-Point-To-Point.sol @@ -0,0 +1,3 @@ + + + diff --git a/Move-From-Point-To-Point/Move-From-Point-To-Point/Move-From-Point-To-Point.prj b/Move-From-Point-To-Point/Move-From-Point-To-Point/Move-From-Point-To-Point.prj new file mode 100644 index 00000000..b9d98222 --- /dev/null +++ b/Move-From-Point-To-Point/Move-From-Point-To-Point/Move-From-Point-To-Point.prj @@ -0,0 +1,6 @@ + + + + + diff --git a/Move-From-Point-To-Point/Move-From-Point-To-Point/Mover Prim/Mover Script.lsl b/Move-From-Point-To-Point/Move-From-Point-To-Point/Mover Prim/Mover Script.lsl new file mode 100644 index 00000000..4362611e --- /dev/null +++ b/Move-From-Point-To-Point/Move-From-Point-To-Point/Mover Prim/Mover Script.lsl @@ -0,0 +1,44 @@ +//:Author: Unknown +//:CATEGORY: Mover + +float delay = 0.1; +integer m_STEPS = 64; + +motionTo(vector dest,rotation rot) { + integer i; + vector currentpos = llGetPos(); + vector step = (dest - currentpos) / m_STEPS; + + for (i = 1;i <= m_STEPS; i++) + { + if (i == (m_STEPS / 2)) + { + llSetRot(rot); + } + llSetPos(currentpos + (step * i)); + + } + llSensor("Track",NULL_KEY,ACTIVE | PASSIVE,10,PI/4); +} + +default { + state_entry() { + llSensor("Track",NULL_KEY,ACTIVE | PASSIVE,10,PI/4); + } + changed(integer what) { + if (what & CHANGED_REGION_START){ + llResetScript(); + } + } + sensor(integer n) { + motionTo(llDetectedPos(0) +(llRot2Fwd(m_NEXTROT) / 10),llDetectedRot(0)); + } + no_sensor() + { + llSetTimerEvent(10); + } + timer() { + llSensor("Track",NULL_KEY,ACTIVE | PASSIVE,10,PI/4); + llSetTimerEvent(0); + } +} \ No newline at end of file diff --git a/Opensim VIsitors List/Opensim VIsitors List.sol b/Opensim VIsitors List/Opensim VIsitors List.sol new file mode 100644 index 00000000..f6f54138 --- /dev/null +++ b/Opensim VIsitors List/Opensim VIsitors List.sol @@ -0,0 +1,3 @@ + + + diff --git a/Opensim VIsitors List/Opensim VIsitors List/Object/Script.lsl b/Opensim VIsitors List/Opensim VIsitors List/Object/Script.lsl new file mode 100644 index 00000000..e97d6308 --- /dev/null +++ b/Opensim VIsitors List/Opensim VIsitors List/Object/Script.lsl @@ -0,0 +1,117 @@ + +list gDetected = []; +list gVisitors = []; +string gTime = ""; + + +display() +{ + string body = "width:512,height:512,aplha:FALSE,bgcolour:black"; + string draw = ""; + string log = "";//~ visitatori ~"; + string ad0 = " * Welcome to My World * \n"; + string ad1 = ""; + string ad2 = ""; + + integer visitors = llGetListLength(gVisitors) / 3; + + while(visitors--) + { + log = log + "\n" + + llList2String(gVisitors, visitors * 3 + 2) + " - " + + llList2String(gVisitors, visitors * 3 + 1) + " - " + + llList2String(gVisitors, visitors * 3); + } + + draw = osSetFontSize(draw, 12); + draw = osMovePen(draw, 16, 16); + draw = osSetPenColor(draw, "white"); + draw = osDrawText(draw, ad2 + "\n" + ad0 + "\n"+ ad1 + "\n" + log); + + osSetDynamicTextureDataBlendFace("", "vector", draw, body, FALSE, 2, 0, FALSE, 4); +} + +string time() +{ //0123 4 56 7 89 0 12 3 45 + //YYYY - MM - DD T hh : mm:ss.ff..fZ + string now = llGetTimestamp(); + return llGetSubString(now,0,9) + " " + + llGetSubString(now,11,15); +} + +string duration(string timeIn, string timeOut) +{ + integer came = ((integer)llGetSubString(timeIn,11,12) * 60) + (integer)llGetSubString(timeIn,14,15); + integer went = ((integer)llGetSubString(timeOut,11,12) * 60) + (integer)llGetSubString(timeOut,14,15); + + if (came == went) if(llGetSubString(timeIn,8,9) != llGetSubString(timeOut,8,9)) went = went + 1440; + + if (came > went) went = went + 1440; + went = went - came; + + return llGetSubString("00" + (string)((went - (went % 60)) / 60), -2, -1) + ":" + + llGetSubString("00" + (string)(went % 60), -2, -1); +} + +detectVisitorInOut(list avatars) +{ + integer avatar = llGetListLength(avatars); + string name = ""; + + while(avatar--) + { + name = llList2String(avatars, avatar); + if (llSubStringIndex((string)gDetected, name) == -1) gVisitors = gVisitors + [name, "00:00", gTime]; + + if (llGetListLength(gVisitors) >= 63) gVisitors = llDeleteSubList(gVisitors, 0, 2); + } + + avatar = llGetListLength(gDetected); + name = ""; + + while(avatar--) + { + name = llList2String(gDetected, avatar); + if (llSubStringIndex((string)avatars, name) == -1) + { + integer position = llListFindList(gVisitors, [name, "00:00"]) + 1; + string time = duration(llList2String(gVisitors, position + 1), gTime); + gVisitors = llListReplaceList(gVisitors, [time], position, position); + } + } +} + +visitorOut() +{ + integer avatar = llGetListLength(gDetected); + string name = ""; + + while(avatar--) + { + name = llList2String(gDetected, avatar); + integer position = llListFindList(gVisitors, [name, "00:00"]) + 1; + string time = duration(llList2String(gVisitors, position + 1), gTime); + gVisitors = llListReplaceList(gVisitors, [time], position, position); + } +} + +default +{ + state_entry() { llSetTimerEvent(10.0); } + + timer() + { + list avatarList = osGetAgents(); + + if ((string)avatarList != (string)gDetected) + { + gTime = time(); + + if (avatarList != []) detectVisitorInOut(avatarList); + else visitorOut(); + + gDetected = avatarList; + display(); + } + } +} \ No newline at end of file diff --git a/Opensim VIsitors List/Opensim VIsitors List/Opensim VIsitors List.prj b/Opensim VIsitors List/Opensim VIsitors List/Opensim VIsitors List.prj new file mode 100644 index 00000000..487c0eaf --- /dev/null +++ b/Opensim VIsitors List/Opensim VIsitors List/Opensim VIsitors List.prj @@ -0,0 +1,6 @@ + + + + + diff --git a/Trash Collector NPC/Trash Collector NPC.sol b/Trash Collector NPC/Trash Collector NPC.sol new file mode 100644 index 00000000..887621fd --- /dev/null +++ b/Trash Collector NPC/Trash Collector NPC.sol @@ -0,0 +1,3 @@ + + + diff --git a/Trash Collector NPC/Trash Collector NPC/NPC Box/Trash Collector script.lsl b/Trash Collector NPC/Trash Collector NPC/NPC Box/Trash Collector script.lsl new file mode 100644 index 00000000..e41d6de2 --- /dev/null +++ b/Trash Collector NPC/Trash Collector NPC/NPC Box/Trash Collector script.lsl @@ -0,0 +1,180 @@ +//:AUTHOR:Unknown +//:Name:Trash Collector NPC script + +// comment out for runtime, for LSLEditor use +integer OS_NPC_NO_FLY = 1; + +float WAIT = 10; +float range = 15; +vector start_location = <355.80, 326.80, 44>; + +// define a box in front of the NPC size 'range' +vector top; +vector right; +vector left; + +list positions; +integer destination; +key NPCKey; // storage for NPC Key + +float iWaitCounter; +vector newDest; +integer checkAV; + +integer debug = TRUE; + +DEBUG(string str) +{ + if (debug) llSay(0,str); +} + +string pickup="pick up from ground animation"; + +TimerEvent(float timesent) +{ + DEBUG("Setting timer: " + (string) timesent); + llSetTimerEvent(timesent); +} +create_path(vector start,vector goal) +{ + vector pos = llGetPos(); + integer direct; + list results = llCastRay(start, goal, [ RC_MAX_HITS, 1] ); + direct=llList2Integer(results, -1); + if (!direct) + { + positions = [start, goal]; + return; + } + if (pos.y < goal.y) + positions= [start,top, goal]; + else if (goal.x < pos.x) + positions= [start,top,left,goal]; + else if (goal.x > pos.x) + positions= [start,top,right,goal]; + return; +} + +send_path(integer homewardbound, list path) +{ + integer length=llGetListLength(path); + + if(destination < length && destination >= -length) + { + DEBUG((string) destination); + newDest = llList2Vector(path,destination); + iWaitCounter = WAIT; // wait to get to a destination. + osNpcMoveToTarget(NPCKey, newDest, OS_NPC_NO_FLY ); + TimerEvent(1); + return; + } else if (destination == length) { + osNpcPlayAnimation(NPCKey,pickup); + TimerEvent(3.0); + } else if (destination <= -length) { + osNpcRemove(NPCKey); + TimerEvent(480); + checkAV=TRUE; + return; + } + + destination= -1; + TimerEvent(1); + iWaitCounter = WAIT; + DEBUG((string)destination); + +} + +init() +{ + vector pos = llGetPos(); + top = pos + <0,range,0>; + right = pos + ; + left = pos - ; + destination=0; + TimerEvent(480); // 8 minutes !!! + checkAV=FALSE; + destination=0; + create_path(start_location,randompos()); + DEBUG((string)positions); + NPCKey=osNpcCreate("Trash", "Bot", start_location, "Trash Bot"); + send_path(TRUE, positions); +} + +vector randompos() +{ + vector pos= llGetPos(); + if(llFrand(1)<0.5) + { + float randx= 18*((llRound(llFrand(1))*2)-1); + //llOwnerSay((string)randx); + float randy=18*((llRound(llFrand(1))*2)-1); + //llOwnerSay((string)randy); + return pos+; + } + else + { + return pos+; + } +} +check_agents() +{ + integer nNew = 0; + list avis = llGetAgentList(AGENT_LIST_REGION, []); + integer howmany = llGetListLength(avis); + integer i; + for ( i = 0; i < howmany; i++ ) { + if ( ! osIsNpc(llList2Key(avis, i)) ) + nNew++; // only non-NPC's + } + if (nNew>0) + { + checkAV=FALSE; + destination=0; + create_path(start_location,randompos()); + DEBUG((string)positions); + NPCKey=osNpcCreate("Trash", "Bot", start_location, "Trash Bot"); + send_path(TRUE, positions); + + } +} +default +{ + state_entry() + { + init(); + } + touch_start(integer total_number) + { + checkAV=FALSE; + destination=0; + create_path(start_location,randompos()); + //llOwnerSay((string)positions); + NPCKey=osNpcCreate("Trash", "Bot", start_location, "Trash Bot"); + send_path(TRUE, positions); + } + timer() { + if (checkAV) + { + check_agents(); + } + if (--iWaitCounter) { + + vector tDest = newDest; + tDest.z = 0; + vector hisDest = osNpcGetPos(NPCKey); + hisDest.z = 0; + + if (llVecDist(hisDest, newDest) > 1) { + return; + } + } + //llSetTimerEvent(0); + if (destination >= 0) + destination++; + else + destination--; + + send_path(TRUE, positions); + } + +} \ No newline at end of file diff --git a/Trash Collector NPC/Trash Collector NPC/Trash Collector NPC.prj b/Trash Collector NPC/Trash Collector NPC/Trash Collector NPC.prj new file mode 100644 index 00000000..af945bf6 --- /dev/null +++ b/Trash Collector NPC/Trash Collector NPC/Trash Collector NPC.prj @@ -0,0 +1,6 @@ + + + + +