From 2af5332e46b3917d6dce211e576a92d04c3eda8b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 30 Jun 2017 21:59:39 +0100 Subject: Added cycle_object_animations.lsl. Also change to test.cpp to see if it affects a g++ internal compiler error. --- scripts/testing/lsl/cycle_object_animations.lsl | 53 +++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 scripts/testing/lsl/cycle_object_animations.lsl (limited to 'scripts/testing/lsl/cycle_object_animations.lsl') diff --git a/scripts/testing/lsl/cycle_object_animations.lsl b/scripts/testing/lsl/cycle_object_animations.lsl new file mode 100644 index 0000000000..95fa99a191 --- /dev/null +++ b/scripts/testing/lsl/cycle_object_animations.lsl @@ -0,0 +1,53 @@ +cycle_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); + } + if (NowPlaying != "") + { + llSay(0, "Stopping " + NowPlaying); + llStopObjectAnimation(NowPlaying); + llSleep(10); + } +} + +default +{ + state_entry() + { + llSay(0, "Animated Object here"); + } + + touch_start(integer total_number) + { + llSay(0, "Touch started."); + while (1) + { + cycle_animations(); + } + + } + + touch_end(integer total_number) + { + llSay(0, "Touch ended."); + } +} + +// Local Variables: +// shadow-file-name: "$SW_HOME/axon/scripts/testing/lsl/cycle_object_animations.lsl" +// End: -- cgit v1.2.3 From f55667397e75991348fa25b6ad581a36de99acf0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Jul 2017 01:25:10 +0100 Subject: SL-722 - handle per-object animation requests, combine for control avatar animation state. --- scripts/testing/lsl/cycle_object_animations.lsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts/testing/lsl/cycle_object_animations.lsl') diff --git a/scripts/testing/lsl/cycle_object_animations.lsl b/scripts/testing/lsl/cycle_object_animations.lsl index 95fa99a191..79c8ff4151 100644 --- a/scripts/testing/lsl/cycle_object_animations.lsl +++ b/scripts/testing/lsl/cycle_object_animations.lsl @@ -9,17 +9,17 @@ cycle_animations() ItemName = llGetInventoryName(INVENTORY_ANIMATION, count); if (NowPlaying != "") { - llSay(0, "Stopping " + NowPlaying); + //llSay(0, "Stopping " + NowPlaying); llStopObjectAnimation(NowPlaying); } - llSay(0, "Starting " + ItemName); + //llSay(0, "Starting " + ItemName); llStartObjectAnimation(ItemName); NowPlaying = ItemName; llSleep(10); } if (NowPlaying != "") { - llSay(0, "Stopping " + NowPlaying); + //llSay(0, "Stopping " + NowPlaying); llStopObjectAnimation(NowPlaying); llSleep(10); } -- cgit v1.2.3 From 41f7f7a68ee3d9b3eee55437ef0ffcd1d0277227 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 14 Jul 2017 22:18:53 +0100 Subject: SL-751 - lsl scripts for control of animated objects within a region --- scripts/testing/lsl/cycle_object_animations.lsl | 105 +++++++++++++++++++----- 1 file changed, 85 insertions(+), 20 deletions(-) (limited to 'scripts/testing/lsl/cycle_object_animations.lsl') 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(); } } -- cgit v1.2.3 From 936ccff59f2045f5747a0730570784608f39a7b4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 31 Aug 2017 16:48:26 +0100 Subject: SL-751 - updated lsl test scripts with bug fix, added a version that uses the new command llGetObjectAnimationNames() --- scripts/testing/lsl/cycle_object_animations.lsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/testing/lsl/cycle_object_animations.lsl') diff --git a/scripts/testing/lsl/cycle_object_animations.lsl b/scripts/testing/lsl/cycle_object_animations.lsl index e7a378889a..46910e3656 100644 --- a/scripts/testing/lsl/cycle_object_animations.lsl +++ b/scripts/testing/lsl/cycle_object_animations.lsl @@ -7,7 +7,7 @@ say_if_verbose(integer channel, string message) { if (verbose) { - llSay(0, message); + llSay(channel, message); } } @@ -71,7 +71,7 @@ default listen(integer channel, string name, key id, string message) { - llOwnerSay("got message " + name + " " + (string) id + " " + message); + //llOwnerSay("got message " + name + " " + (string) id + " " + message); list words = llParseString2List(message,[" "],[]); string command = llList2String(words,0); string option = llList2String(words,1); -- cgit v1.2.3