summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2017-07-14 22:18:53 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2017-07-14 22:18:53 +0100
commit41f7f7a68ee3d9b3eee55437ef0ffcd1d0277227 (patch)
tree6ea7d9afc0d54d1582f39fec0b0bb52372fa40bc
parent99effd37ab6cc6611f75cdca9146cc3c46a86482 (diff)
SL-751 - lsl scripts for control of animated objects within a region
-rw-r--r--indra/newview/lltoolpie.cpp6
-rw-r--r--scripts/testing/lsl/axon_test_region_driver.lsl54
-rw-r--r--scripts/testing/lsl/cycle_object_animations.lsl105
3 files changed, 145 insertions, 20 deletions
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index fc052ae3aa..a1b3caf38b 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -1764,6 +1764,12 @@ BOOL LLToolPie::handleRightClickPick()
{
return TRUE; // unexpected, but escape
}
+#if 0 // AXON TBD
+ if (object->asAvatar() && object->asAvatar()->isControlAvatar())
+ {
+ return TRUE; // control avatars are not people...
+ }
+#endif
// Object is an avatar, so check for mute by id.
LLVOAvatar* avatar = (LLVOAvatar*)object;
diff --git a/scripts/testing/lsl/axon_test_region_driver.lsl b/scripts/testing/lsl/axon_test_region_driver.lsl
new file mode 100644
index 0000000000..dfcbb9871a
--- /dev/null
+++ b/scripts/testing/lsl/axon_test_region_driver.lsl
@@ -0,0 +1,54 @@
+list buttons = ["anim start", "anim stop", " ", "verbose on", "verbose off", " "];
+string dialogInfo = "\nPlease make a choice.";
+
+key ToucherID;
+integer dialogChannel;
+integer listenHandle;
+integer commandChannel;
+
+default
+{
+ state_entry()
+ {
+ dialogChannel = -1 - (integer)("0x" + llGetSubString( (string)llGetKey(), -7, -1) );
+ commandChannel = -2001;
+ }
+
+ touch_start(integer num_detected)
+ {
+ ToucherID = llDetectedKey(0);
+ llListenRemove(listenHandle);
+ listenHandle = llListen(dialogChannel, "", ToucherID, "");
+ llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
+ llSetTimerEvent(60.0); // Here we set a time limit for responses
+ }
+
+ listen(integer channel, string name, key id, string message)
+ {
+ if (message == "-")
+ {
+ llDialog(ToucherID, dialogInfo, buttons, dialogChannel);
+ return;
+ }
+
+ llListenRemove(listenHandle);
+ // stop timer since the menu was clicked
+ llSetTimerEvent(0);
+
+ llOwnerSay("Sending message " + message + " on channel " + (string)commandChannel);
+ llRegionSay(commandChannel, message);
+ }
+
+ timer()
+ {
+ // stop timer
+ llSetTimerEvent(0);
+
+ llListenRemove(listenHandle);
+ llWhisper(0, "Sorry. You snooze; you lose.");
+ }
+}
+
+// Local Variables:
+// shadow-file-name: "$SW_HOME/axon/scripts/testing/lsl/axon_test_region_driver.lsl"
+// End:
diff --git a/scripts/testing/lsl/cycle_object_animations.lsl b/scripts/testing/lsl/cycle_object_animations.lsl
index 79c8ff4151..e7a378889a 100644
--- a/scripts/testing/lsl/cycle_object_animations.lsl
+++ b/scripts/testing/lsl/cycle_object_animations.lsl
@@ -1,50 +1,115 @@
-cycle_animations()
+integer listenHandle;
+integer verbose;
+integer current_animation_number;
+string NowPlaying;
+
+say_if_verbose(integer channel, string message)
+{
+ if (verbose)
+ {
+ llSay(0, message);
+ }
+}
+
+stop_all_animations()
{
- list AnimationList;
integer count = llGetInventoryNumber(INVENTORY_ANIMATION);
string ItemName;
string NowPlaying;
while (count--)
{
ItemName = llGetInventoryName(INVENTORY_ANIMATION, count);
- if (NowPlaying != "")
- {
- //llSay(0, "Stopping " + NowPlaying);
- llStopObjectAnimation(NowPlaying);
- }
- //llSay(0, "Starting " + ItemName);
- llStartObjectAnimation(ItemName);
- NowPlaying = ItemName;
- llSleep(10);
+ say_if_verbose(0, "Stopping " + ItemName);
+ llStopObjectAnimation(ItemName);
}
+}
+
+start_cycle_animations()
+{
+ current_animation_number = llGetInventoryNumber(INVENTORY_ANIMATION);
+ next_animation(); // Do first iteration without waiting for timer
+ llSetTimerEvent(5.0);
+}
+
+next_animation()
+{
+ string ItemName;
if (NowPlaying != "")
{
- //llSay(0, "Stopping " + NowPlaying);
+ say_if_verbose(0, "Stopping " + NowPlaying);
llStopObjectAnimation(NowPlaying);
- llSleep(10);
}
+ if (current_animation_number--)
+ {
+ ItemName = llGetInventoryName(INVENTORY_ANIMATION, current_animation_number);
+ say_if_verbose(0, "Starting " + ItemName);
+ llStartObjectAnimation(ItemName);
+ NowPlaying = ItemName;
+ }
+ else
+ {
+ // Start again at the top
+ current_animation_number = llGetInventoryNumber(INVENTORY_ANIMATION);
+ }
+}
+
+stop_cycle_animations()
+{
+ llSetTimerEvent(0);
}
default
{
state_entry()
{
- llSay(0, "Animated Object here");
+ say_if_verbose(0, "Animated Object here");
+ listenHandle = llListen(-2001,"","","");
+ verbose = 0;
+
+ stop_all_animations();
}
- touch_start(integer total_number)
+ listen(integer channel, string name, key id, string message)
{
- llSay(0, "Touch started.");
- while (1)
+ llOwnerSay("got message " + name + " " + (string) id + " " + message);
+ list words = llParseString2List(message,[" "],[]);
+ string command = llList2String(words,0);
+ string option = llList2String(words,1);
+ if (command=="anim")
+ {
+ stop_all_animations();
+ if (option=="start")
+ {
+ start_cycle_animations();
+ }
+ else if (option=="stop")
+ {
+ stop_cycle_animations();
+ }
+ }
+ if (command=="verbose")
{
- cycle_animations();
+ if (option=="on")
+ {
+ verbose = 1;
+ }
+ else if (option=="off")
+ {
+ verbose = 0;
+ }
}
+ }
+ timer()
+ {
+ say_if_verbose(0, "timer triggered");
+ next_animation();
}
- touch_end(integer total_number)
+ touch_start(integer total_number)
{
- llSay(0, "Touch ended.");
+ say_if_verbose(0, "Touch started.");
+ start_cycle_animations();
}
}