diff --git a/Nanite Systems/charger.lsl b/Nanite Systems/charger.lsl index 2c7576b..adbbff2 100644 --- a/Nanite Systems/charger.lsl +++ b/Nanite Systems/charger.lsl @@ -156,7 +156,7 @@ default if (m == "probe") { llSay(channelLightBus, "add charger"); } else if (m == "remove charger") { llOwnerSay("Removing charger."); } else if (m == "add-confirm") { llSay(channelLightBus, "add-command toggle"); } - else if (m == "charge start" || m == "off" ) { turnOff("Charge disabled."); } + else if (m == "charge start" || m == "off" && running ) { turnOff("Charge disabled."); } else if (m == "peek " + (string)llGetOwner()) { statusMessage() ;} else if (llGetSubString(m,0,9) == "power 0.99") { turnOff("Charge complete!"); } else if (llGetSubString(m,0,8) == "power 0.1") { turnOn("Low power. Charge enabled..."); } diff --git a/Nanite Systems/holdntext.lsl b/Nanite Systems/holdntext.lsl new file mode 100644 index 0000000..8d58ef6 --- /dev/null +++ b/Nanite Systems/holdntext.lsl @@ -0,0 +1,61 @@ +string anim ="hold"; +list display = []; +vector color = ZERO_VECTOR; +default +{ + state_entry() + { + llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); + llStartAnimation(anim); + } + + attach(key wearer) + { + if(wearer == NULL_KEY) + { + llStopAnimation(anim); + llSetTimerEvent(0); + } + else + { + llRequestPermissions(wearer,PERMISSION_TRIGGER_ANIMATION); + } + } + + run_time_permissions(integer permissions) + { + if (PERMISSION_TRIGGER_ANIMATION & permissions) + { + llStartAnimation(anim); + llSetTimerEvent(15); + } + } + timer() + { + llStartAnimation(anim); + } + + link_message(integer l, integer n, string m, key k) + { + if (l == LINK_ROOT) { + //llOwnerSay("l :" + (string)l + " n: " + (string)n + " m: " + m + " k: " + (string)k); + display = display + (string)k; + if ((string)k == "INIT") { display = []; } + if (llGetListLength(display) > 8) { + display = llDeleteSubList(display, 0, 0); + } + string text = llDumpList2String(display,"\n"); + text += "\n·\n·\n·\n·\n·\n·\n·\n·\n"; + if (llGetListLength(display) == 0) { text = ""; } + if (m == "<0.00000, 0.00000, 0.00000>") { m = "<0.00000, 1.00000, 0.00000>"; } + string temp = llGetSubString(m,1,-2); + list vectorList = llParseString2List(temp, [", "],[""]); + color.x = llList2Float(vectorList, 0); + color.y = llList2Float(vectorList, 1); + color.z = llList2Float(vectorList, 2); + llSetColor(color, 0); + llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POINT_LIGHT, TRUE, color, 1, 0.1, 0]); + llSetText(text, color, 0.5); + } + } +} diff --git a/Nanite Systems/readme.txt b/Nanite Systems/readme.txt index e76e959..c9c4303 100644 --- a/Nanite Systems/readme.txt +++ b/Nanite Systems/readme.txt @@ -1,3 +1,11 @@ scripts to work with Nanite System units in Second Life http://develop.nanite-systems.com + + +charger.lsl is a wireless charger that works on the owner only + +sniff.lsl is a light bus listener + +scanner.lsl is a unit scaner, holdntext.lsl goes along with it +scanner goes into the root prim, where the cable comes from, holdntext goes into a second prim to handle the hold animation and the hovertext diff --git a/Nanite Systems/scanner.lsl b/Nanite Systems/scanner.lsl index 91a6241..dcf02df 100644 --- a/Nanite Systems/scanner.lsl +++ b/Nanite Systems/scanner.lsl @@ -5,9 +5,13 @@ integer listenOLB; list unitList; list keyList; +key unitKey; string unitName = "none"; vector unitColor; -key unitKey; +float unitRate; +float unitFan; +float unitTemp; +string unitPersona = "n/a"; integer unitLightBus; integer listenULB; @@ -18,7 +22,6 @@ integer getChannel(key UUID) { init() { updateText("INIT"); llParticleSystem([]); - hoverText(""); ownerKey = llGetOwner(); ownerLightBus = getChannel(ownerKey); listenOLB = llListen(ownerLightBus+1, "", NULL_KEY, ""); @@ -27,12 +30,8 @@ init() { } updateText(string message) { - llMessageLinked(LINK_ALL_OTHERS, 122, message, (string)color); -} - -displayVitals() { - string display = unitName + "\n----------\nPower: " + power; - updateText(display); + //llMessageLinked(LINK_ALL_OTHERS, 122, message, (string)unitColor); + llMessageLinked(LINK_ALL_OTHERS, 122, (string)unitColor, message); } scan(float range) { @@ -53,25 +52,34 @@ permission(key UUID) { } getPort(key UUID) { + llSay(unitLightBus, "color-q"); + llSay(unitLightBus, "persona-q"); if (UUID == NULL_KEY) { - llOwnerSay("sending [port-connect data-1]"); + //llOwnerSay("sending [port-connect data-1]"); llSay(unitLightBus, "port-connect data-1"); } else { - llOwnerSay("sending [port-connect " + (string)UUID + "]"); + //llOwnerSay("sending [port-connect " + (string)UUID + "]"); llSay(unitLightBus, "port-connect " + (string)UUID); } } connect(key UUID) { updateText("Unit: " + unitName); particles(UUID); + mainMenu(ownerKey); } disconnect() { + busSpam = FALSE; llParticleSystem([]); + unitName = "none"; + unitColor = <0,0,0>; + unitPersona = "n/a"; + unitLightBus = -25432122; llListenControl(listenULB, FALSE); llOwnerSay("Disconnecting scanner."); llSay(unitLightBus, "remove scanner"); updateText("Disconnected"); + mainMenu(ownerKey); } particles(key UUID) { @@ -82,8 +90,8 @@ particles(key UUID) { | PSYS_PART_TARGET_POS_MASK | PSYS_PART_RIBBON_MASK, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP, - PSYS_PART_START_COLOR, <1,1,1>, - PSYS_PART_END_COLOR, <1,1,1>, + PSYS_PART_START_COLOR, unitColor, + PSYS_PART_END_COLOR, unitColor, PSYS_PART_START_ALPHA, 1.0, PSYS_PART_END_ALPHA, 1.0, PSYS_PART_START_SCALE, <0.04, 0.04, 0>, @@ -96,19 +104,14 @@ particles(key UUID) { ]); } -beep() { updateText("beep"); llOwnerSay("beep"); } - -vector color = <1,1,1>; -hoverText(string input) { - llSetText(input, color, 0.5); -} +beep() { updateText("beep"); llWhisper(PUBLIC_CHANNEL, "beep"); } mainMenu(key UUID) { llListenControl(listenOLB, TRUE); llSetTimerEvent(60); string x = "Spam: off"; if (busSpam) { x = "Spam: on"; } - llDialog(UUID, "Select an option.\nCurrent unit: " + unitName + "\n" + x, ["SCAN","SPAM","DISPLAY","DISCONNECT","RESET"], ownerLightBus+1); + llDialog(UUID, "Select an option.\nCurrent unit: " + unitName + "\n" + x, ["SCAN","SPAM","DISPLAY","DISCONNECT","TEST","CLEAR","RESET"], ownerLightBus+1); } selectMenu(key UUID) { @@ -126,8 +129,8 @@ disableListen() { integer busSpam = FALSE; toggleSpam() { - if (!busSpam) { busSpam = TRUE; } - else { busSpam = FALSE; } + if (!busSpam) { busSpam = TRUE; updateText("Spam enabled..."); } + else { busSpam = FALSE; updateText("Spam disabled."); } } processCommand(string input) { @@ -137,7 +140,7 @@ processCommand(string input) { //hoverText("Heard params: " + params); if (command == "color") { messageColor(params); } if (command == "power") { messagePower(params); } - //if (command == "persona") { messagePersona(params); } + if (command == "persona") { messagePersona(params); } //if (command == "persona-eject") { messagePersona(""); } //if (command == "poke") { messagePoke(params); } //if (command == "peek") { messagePeek(params); } @@ -153,9 +156,10 @@ messageColor(string input) { messagePersona(string input) { if (input == "") { - hoverText("Changing persona..."); + updateText("Updating persona..."); } else { - hoverText("New persona: " + input); + unitPersona = input; + updateText("Persona: " + input); } } @@ -168,33 +172,50 @@ messagePower(string input) { } messagePoke(string input) { - hoverText("Poke: " + input); + updateText("Poke: " + input); } messagePeek(string input) { - hoverText("Peek: " + input); + updateText("Peek: " + input); } messageBolts(string input) { if (input == "off") { - hoverText("Unit unlocked"); + updateText("Unit unlocked"); } else { - hoverText("Unit locked"); + updateText("Unit locked"); } } messageCharge(string input) { if (input == "start") { - hoverText("Charge: started"); + updateText("Charge: started"); } else { - hoverText("Charge: ended"); + updateText("Charge: ended"); } } messageWeather(string input) { string weather = llGetSubString(input, 0, llSubStringIndex(input, " ")-1); integer temp = (integer)llGetSubString(input, llSubStringIndex(input, " ")+1, -1); - hoverText("Weather: " + weather + "\nTemp: " + (string)temp + "C"); + updateText("Weather: " + weather + "\nTemp: " + (string)temp + "C"); +} + +clearScreen() { + updateText("INIT"); + mainMenu(ownerKey); +} + +displayVitals() { + updateText(unitName + " : " + unitPersona); + updateText("unit make and model"); + updateText("unlocked permissions?"); + updateText("power voltage status"); + updateText("power settings"); + updateText("integrity etc temp"); + updateText("vox filters"); + updateText("network, motors, ftl, audio, mind, video"); + mainMenu(ownerKey); } default @@ -206,6 +227,8 @@ default disableListen(); if (m == "SCAN") { updateText("Scanning for units..."); scan(20); } else if (m == "DISCONNECT") { updateText("Disconnecting..."); disconnect(); mainMenu(ownerKey); } + else if (m == "TEST") { beep(); } + else if (m == "CLEAR") { clearScreen(); } else if (m == "RESET") { llResetScript(); } else if (m == "OK") { mainMenu(ownerKey); } else if (m == "SPAM") { toggleSpam(); mainMenu(ownerKey); } @@ -216,7 +239,7 @@ default } } if (c == unitLightBus) { - if (busSpam) { updateText(m); } + if (busSpam == TRUE) { llOwnerSay(unitName + " LB: " + m); updateText(m); } if (m == "accept " + (string)ownerKey) { llOwnerSay("Connection approved."); llSay(unitLightBus, "add scanner"); getPort(NULL_KEY); } else if (m == "add-confirm") { llOwnerSay("Device added."); } else if (m == "add-fail") { llOwnerSay("Connection failed."); } @@ -231,6 +254,7 @@ default llOwnerSay("Port forward to: " + (string)UUID); getPort(UUID); } + else { processCommand(m); } } }