mirror of
https://github.com/liftedpixel/lslscripts.git
synced 2026-08-14 00:58:07 +00:00
made a ns lightbus sniffer
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
//A wireless charger for NS units
|
||||
//Jessyka Richard - Jessica Pixel
|
||||
//9/2017
|
||||
|
||||
//Particles via http://particles-lsl-generator.bashora.com/index.php
|
||||
string Texture;
|
||||
@@ -113,7 +115,7 @@ turnOn(string message) {
|
||||
turnOff(string message) {
|
||||
running = FALSE;
|
||||
llSetColor(<0.3,0.3,0.3>, ALL_SIDES);
|
||||
llSetText("disabled", color, 0.2);
|
||||
llSetText("disabled", <0.3,0.3,0.3>, 0.5);
|
||||
llTargetOmega(<0,0,0>,0,0);
|
||||
llParticleSystem([]);
|
||||
llOwnerSay(message);
|
||||
@@ -136,6 +138,7 @@ default
|
||||
{
|
||||
state_entry() {
|
||||
turnOff("Initializing...");
|
||||
llOwnerSay((string)llGetKey());
|
||||
ownerKey = llGetOwner();
|
||||
channelLightBus = -1 - (integer)("0x" + llGetSubString( (string) ownerKey, -7, -1) ) + 106;
|
||||
handleLightBus = llListen(channelLightBus, "", NULL_KEY, "");
|
||||
@@ -150,6 +153,7 @@ default
|
||||
if (m == "probe") { llSay(channelLightBus, "add charger"); }
|
||||
else if (m == "add-confirm") { llSay(channelLightBus, "add-command toggle"); }
|
||||
else if (m == "charge start" || m == "off" ) { turnOff("Charge disabled."); }
|
||||
//else if (m == "poke " + (string)llGetOwner()) { llDialog(llDetectedKey(0), "The menu will be here soon.", ["OK", "NOT OK"], channelLightBus); }
|
||||
else if (llGetSubString(m,0,9) == "power 0.99") { turnOff("Charge complete!"); }
|
||||
else if (llGetSubString(m,0,8) == "power 0.2") { turnOn("Low power. Charge enabled..."); }
|
||||
else if (m == toggleMessage) {
|
||||
@@ -0,0 +1,3 @@
|
||||
scripts to work with Nanite System units in Second Life
|
||||
|
||||
http://develop.nanite-systems.com
|
||||
@@ -0,0 +1,74 @@
|
||||
//A lightbus sniffer for NS units
|
||||
//Jessyka Richard - Jessica Pixel
|
||||
//9/2017
|
||||
|
||||
integer channelLightBus;
|
||||
integer listenLightBus;
|
||||
vector color;
|
||||
integer running = FALSE;
|
||||
|
||||
hoverText(string input) {
|
||||
llSetText(input, color, 1.0);
|
||||
}
|
||||
|
||||
messageColor(string input) {
|
||||
//from SitAnywhere Flicker
|
||||
list rgb = llParseString2List(input, [" "], []);
|
||||
color = <llList2Float(rgb, 0), llList2Float(rgb, 1), llList2Float(rgb, 2)>;
|
||||
//hoverText("New color: " + (string)color);
|
||||
}
|
||||
|
||||
messagePersona(string input) {
|
||||
if (input == "") {
|
||||
hoverText("Changing persona...");
|
||||
} else {
|
||||
hoverText("Current persona: " + input);
|
||||
}
|
||||
}
|
||||
|
||||
messagePower(string input) {
|
||||
float powerFloat = (float)input * 100;
|
||||
integer powerInt = (integer)powerFloat;
|
||||
hoverText("Current power: " + (string)powerInt + "%");
|
||||
}
|
||||
|
||||
messagePoke(string input) {
|
||||
hoverText("Poked object: " + input);
|
||||
}
|
||||
|
||||
messageBolts(string input) {
|
||||
if (input == "off") {
|
||||
hoverText("Bolts: unlocked");
|
||||
} else {
|
||||
hoverText("Bolts: locked");
|
||||
}
|
||||
}
|
||||
|
||||
processCommand(string input) {
|
||||
string command = llGetSubString(input, 0, llSubStringIndex(input, " ") - 1);
|
||||
string params = llGetSubString(input, llSubStringIndex(input, " ") + 1, -1);
|
||||
//hoverText("Heard: " + command);
|
||||
//hoverText("Heard: " + params);
|
||||
if (command == "color") { messageColor(params); }
|
||||
if (command == "power") { messagePower(params); }
|
||||
if (command == "persona") { messagePersona(params); }
|
||||
if (command == "persona-eject") { messagePersona(""); }
|
||||
//if (command == "poke") { messagePoke(params); }
|
||||
if (command == "bolts") { messageBolts(params); }
|
||||
}
|
||||
|
||||
default {
|
||||
state_entry() {
|
||||
key ownerKey = llGetOwner();
|
||||
channelLightBus = -1 - (integer)("0x" + llGetSubString( (string) ownerKey, -7, -1) ) + 106;
|
||||
hoverText("Channel: " + (string)channelLightBus);
|
||||
listenLightBus = llListen(channelLightBus, "", NULL_KEY, "");
|
||||
}
|
||||
|
||||
listen(integer c, string n, key k, string m) {
|
||||
if (c == channelLightBus) {
|
||||
//llOwnerSay(m);
|
||||
processCommand(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
scripts written more recently, probably mostly related to Nanite Systems until I have enough scripts for it's own folder.
|
||||
Reference in New Issue
Block a user