Apertura del repositorio

This commit is contained in:
2025-05-24 18:09:39 -03:00
parent 76e6359dad
commit d883ddd0d0
35253 changed files with 2891973 additions and 2 deletions
@@ -0,0 +1,54 @@
list buttons = ["anim start", "anim stop", "step", "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:
@@ -0,0 +1,118 @@
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()
{
integer count = llGetInventoryNumber(INVENTORY_ANIMATION);
string ItemName;
string NowPlaying;
while (count--)
{
ItemName = llGetInventoryName(INVENTORY_ANIMATION, count);
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 != "")
{
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);
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.lsl"
// End:
@@ -0,0 +1,133 @@
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:
@@ -0,0 +1,90 @@
integer listenHandle;
integer verbose;
integer num_steps = 12;
float circle_time = 5.0;
integer circle_step;
vector circle_pos;
vector circle_center;
float circle_radius;
start_circle(vector center, float radius)
{
vector currentPosition = llGetPos();
circle_center = center;
circle_radius = radius;
circle_step = 0;
llSetTimerEvent(circle_time/num_steps);
llTargetOmega(<0.0, 0.0, 1.0>, TWO_PI/circle_time, 1.0);
}
stop_circle()
{
llSetTimerEvent(0);
llTargetOmega(<0.0, 0.0, 1.0>, TWO_PI/circle_time, 0.0);
llSetRegionPos(circle_center);
}
next_circle()
{
float rad = (circle_step * TWO_PI)/num_steps;
float x = circle_center.x + llCos(rad)*circle_radius;
float y = circle_center.y + llSin(rad)*circle_radius;
float z = circle_center.z;
llSetRegionPos(<x,y,z>);
circle_step = (circle_step+1)%num_steps;
}
default
{
state_entry()
{
//llSay(0, "Hello, Avatar!");
listenHandle = llListen(-2001,"","","");
verbose = 0;
circle_center = llGetPos();
}
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")
{
if (option=="start")
{
start_circle(llGetPos(), 3.0);
}
else if (option=="stop")
{
stop_circle();
}
}
if (command=="verbose")
{
if (option=="on")
{
verbose = 1;
}
else if (option=="off")
{
verbose = 0;
}
}
if (command=="step")
{
llSetTimerEvent(0);
next_circle();
}
}
timer()
{
next_circle();
}
}
// Local Variables:
// shadow-file-name: "$SW_HOME/axon/scripts/testing/lsl/move_in_circle_using_llSetRegionPos.lsl"
// End: