Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
943a1f3e
Commit
943a1f3e
authored
7 years ago
by
Brad Payne (Vir Linden)
Browse files
Options
Downloads
Plain Diff
merge
parents
a3366243
57bb63ba
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/testing/lsl/cycle_object_animations.lsl
+2
-2
2 additions, 2 deletions
scripts/testing/lsl/cycle_object_animations.lsl
scripts/testing/lsl/cycle_object_animations_v2.lsl
+133
-0
133 additions, 0 deletions
scripts/testing/lsl/cycle_object_animations_v2.lsl
with
135 additions
and
2 deletions
scripts/testing/lsl/cycle_object_animations.lsl
+
2
−
2
View file @
943a1f3e
...
@@ -7,7 +7,7 @@ say_if_verbose(integer channel, string message)
...
@@ -7,7 +7,7 @@ say_if_verbose(integer channel, string message)
{
{
if (verbose)
if (verbose)
{
{
llSay(
0
, message);
llSay(
channel
, message);
}
}
}
}
...
@@ -71,7 +71,7 @@ default
...
@@ -71,7 +71,7 @@ default
listen(integer channel, string name, key id, string message)
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,[" "],[]);
list words = llParseString2List(message,[" "],[]);
string command = llList2String(words,0);
string command = llList2String(words,0);
string option = llList2String(words,1);
string option = llList2String(words,1);
...
...
This diff is collapsed.
Click to expand it.
scripts/testing/lsl/cycle_object_animations_v2.lsl
0 → 100644
+
133
−
0
View file @
943a1f3e
integer listenHandle;
integer verbose;
integer current_animation_number;
string NowPlaying;
say_if_verbose(integer channel, string message)
{
if (verbose)
{
llSay(channel, message);
}
}
stop_all_animations()
{
list curr_anims = llGetObjectAnimationNames();
say_if_verbose(0,"stopping all, curr_anims are " + (string) curr_anims);
integer length = llGetListLength(curr_anims);
integer index = 0;
while (index < length)
{
string anim = llList2String(curr_anims, index);
say_if_verbose(0, "Stopping " + anim);
llStopObjectAnimation(anim);
// This check isn't really needed, just included to demonstrate is_animation_running()
if (is_animation_running(anim))
{
say_if_verbose(0, "ERROR - failed to stop " + anim + "!");
}
++index;
}
}
integer is_animation_running(string anim)
{
list curr_anims = llGetObjectAnimationNames();
return ~llListFindList(curr_anims, (list)anim);
}
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 != "")
{
say_if_verbose(0, "Stopping " + NowPlaying);
llStopObjectAnimation(NowPlaying);
}
if (current_animation_number--)
{
ItemName = llGetInventoryName(INVENTORY_ANIMATION, current_animation_number);
say_if_verbose(0, "Starting " + ItemName);
llStartObjectAnimation(ItemName);
key anim_id = llGetInventoryKey(ItemName);
say_if_verbose(0, "Started item " + ItemName + " inv key " + (string) anim_id);
NowPlaying = ItemName;
}
else
{
// Start again at the top
current_animation_number = llGetInventoryNumber(INVENTORY_ANIMATION);
}
}
stop_cycle_animations()
{
llSetTimerEvent(0);
}
default
{
state_entry()
{
say_if_verbose(0, "Animated Object here");
listenHandle = llListen(-2001,"","","");
verbose = 0;
stop_all_animations();
}
listen(integer channel, string name, key id, string message)
{
//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")
{
if (option=="on")
{
verbose = 1;
}
else if (option=="off")
{
verbose = 0;
}
}
}
timer()
{
say_if_verbose(0, "timer triggered");
next_animation();
}
touch_start(integer total_number)
{
say_if_verbose(0, "Touch started.");
start_cycle_animations();
}
}
// Local Variables:
// shadow-file-name: "$SW_HOME/axon/scripts/testing/lsl/cycle_object_animations_v2.lsl"
// End:
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment