updating to latest huffware set.
[feisty_meow.git] / huffware / huffotronic_tools_n_testers_v6.5 / die_on_demand_v0.3.txt
diff --git a/huffware/huffotronic_tools_n_testers_v6.5/die_on_demand_v0.3.txt b/huffware/huffotronic_tools_n_testers_v6.5/die_on_demand_v0.3.txt
new file mode 100755 (executable)
index 0000000..b0d5a44
--- /dev/null
@@ -0,0 +1,34 @@
+
+
+// huffware script: die on demand, by fred huffhines.
+//
+// a super simple script that merely makes an object subject to self-termination
+// if it is told a secret phrase.
+//
+// this script is licensed by the GPL v3 which is documented at: http://www.gnu.org/licenses/gpl.html
+// do not use it in objects without fully realizing you are implicitly accepting that license.
+//
+
+//////////////
+// API for the die on demand feature.  saying the message below on the channel
+// referenced will cause any listening object to zap itself out of the grid.
+string DIE_ON_DEMAND_MESSAGE = "die-on-demand";
+integer DIE_ON_DEMAND_CHANNEL = 4826;
+//////////////
+
+default
+{
+    state_entry()
+    {
+        llListen(DIE_ON_DEMAND_CHANNEL, "", NULL_KEY, "die-on-demand");
+    }
+    
+    listen(integer channel, string name, key id, string message) {
+        if ( (channel ==  DIE_ON_DEMAND_CHANNEL)
+            && (llGetOwnerKey(id) == llGetOwnerKey(llGetKey()))
+            && (message == DIE_ON_DEMAND_MESSAGE) ) {
+            llWhisper(0, "removing object.");
+            llDie();
+        }
+    }
+}