What is it?
It’s NOT an AO, it was created as an extension to an existing AO, giving further control over what animation you want to play. Made to hold hundreds and hundreds of animations. I added also the option to animate someone else, using sensor to scan nearby (96m range) for other avatars. Although made to work using a single prim, it uses llDetectedTouchFace to utilize two faces of one prim, one face when touched, opens a menu, the other stops any and all animations playing.
How-to/Info:
•Copy paste the script below into a new script inworld.
•Save it & then put the script into an object (if not there already).
•Taper the prim so faces 1 and 3 are facing the same direction.
(Taper X = 0.0 Y = 1.00, Top Shear X = 0.0 Y = -0.25)
•Shrink the object so it better fits a HuD position.
•Wear it as a HuD attachment and add some animations.
•Touch it.
It’s NOT an AO, it was created as an extension to an existing AO, giving further control over what animation you want to play. Made to hold hundreds and hundreds of animations. I added also the option to animate someone else, using sensor to scan nearby (96m range) for other avatars. Although made to work using a single prim, it uses llDetectedTouchFace to utilize two faces of one prim, one face when touched, opens a menu, the other stops any and all animations playing.
How-to/Info:
•Copy paste the script below into a new script inworld.
•Save it & then put the script into an object (if not there already).
•Taper the prim so faces 1 and 3 are facing the same direction.
(Taper X = 0.0 Y = 1.00, Top Shear X = 0.0 Y = -0.25)
•Shrink the object so it better fits a HuD position.
•Wear it as a HuD attachment and add some animations.
•Touch it.
PHP Code:
//Made for a single 2 faced button =) Use taper;
//Updates will be kept at the Open Source ReSource.
//Face 1 = Stop animations & play undeformer animation;
//Face 3 = Menu;
key owner;
key Animate;
key reqid;
string Animation;
integer dMenu;
integer Parts;
list AnimButtons;
list tList;
string URL = "http://w-hat.com/name2key";
//UDF to create list from prims inventory
aLoad(){integer i;
tList = [];
Parts=0;
for(i=0; i < = -1 + llGetInventoryNumber(INVENTORY_ANIMATION);i++){
tList += [llGetInventoryName(INVENTORY_ANIMATION,i)];
Parts++;
}
}
//UDF to build dialog from list
aMenu(){integer i;
llSetTimerEvent(45.0);
AnimButtons = [];
if(dMenu > 0)
AnimButtons += ["< <•"];
else
AnimButtons += ["•"];
AnimButtons += ["1st Page"];
if(dMenu*8+8 < Parts - 1)
AnimButtons += ["•>>"];
else
AnimButtons += ["•"];
for(i=dMenu*8; (i < = dMenu*8+8) && (i <= Parts - 1);i++){
AnimButtons += [llGetInventoryName(INVENTORY_ANIMATION, i)];
}
llDialog(llGetOwner(), "
*Select desired Animation;
(Select \"Ignore\" when done;)
((Note~ You can add anims to this button ;))", AnimButtons, myChannel);
}
//UDF to stop animations & play underformer animation
StopAnims(){integer n;
list anims = llGetAnimationList(llGetOwner());
for ( n=0; n<llGetListLength( anims ) ;n++ ){
llStopAnimation( llList2String( anims,n ));
}
llStartAnimation("*Undeformer*");
llStartAnimation("stand");
}
StopTheirAnims(){integer n;
list anims = llGetAnimationList(Animate);
for ( n=0; n<llGetListLength( anims ) ;n++ ){
llStopAnimation( llList2String( anims,n ));
}
llStartAnimation("*Undeformer*");
llStartAnimation("stand");
}
//Our menu lists
integer myChannel;//Out menu(s() channel
integer Listen;//Our handle to remove the listen by timer
list MainButtons = ["!Follower","R-P-S","Anims","Expressions","Emotes","SL Anims","•","STOP","•","•","Anim Some1","•"];
list rspButtons = [ "-Main-","•","•","Rock","Scissors","Paper","•","Countdown","•"];
list FollowerButtons = [ "-Main-","•","•","•","Down","•","Left","Center","Right","Forward","Up","Back"];
list slAnimButtons = [ "-Main-","away","`0' >>","angry_tantrum","angry_fingerwag","backflip","blowkiss","clap","dead","jumpforjoy","kissmybutt","peace"];
list slAnimButtons2 = [ "< < `0'","point_me","point_you","salute","stretch","whistle","wink_hollywood","yes_happy","yes_head"];
list ExpressionButtons = [ "-Main-","afraid","^_^ >>","anger","bored","cry","disdain","embarrased","frown","kiss","laugh","open_mouth"];
list ExpressionButtons2 = [ "< < ^_^","smile","tongue_out","toothsmile","sad","repulsed","shrug","surprise","wink","worry"];
list EmoteButtons = [ "-Main-","afraid","*_* >>","anger","bored","cry","embarrassed","laugh","repulsed","sad","shrug","surprise"];
list EmoteButtons2 = [ "< < *_*","wink","worry"];
//Our dialog User Defined Functions
MainMenu(){
llDialog(owner, "
*!Follower = Anti-Follower anims.
*R-P-S = Rock, Paper, Scissors.
*Anims = This buttons inventory list.
*Expressions = SL inbuilt expressions.
*Emotes = SL inbuilt emotes.
*STOP = Stop all animations.
*Anim Some1 = Animate someone else.
*SL Anims = Anims not fitting into emote or expressions category.", MainButtons, myChannel);
llSetTimerEvent(30.0);
}
rspMenu(){
llDialog(owner, "\n\n*These anims allow you to play the \"Rock, Paper, Scissors\" game with friends :)\n\nNOTE >> Remove this script & drop it into a box & pass to your friend if they don't have dhud =)\n\n (Select \"Ignore\" when done;)", rspButtons, myChannel);
llSetTimerEvent(30.0);
}
slAnimMenu(){
llDialog(owner, "\n\n*These are all random in nature, SL anims that aren't emotes etc.\n\n (Select \"Ignore\" when done;)", slAnimButtons, myChannel);
llSetTimerEvent(30.0);
}
slAnimMenu2(){
llDialog(owner, "\n\n*These are all random in nature, SL anims that aren't emotes etc.\n\n (Select \"Ignore\" when done;)", slAnimButtons2, myChannel);
llSetTimerEvent(30.0);
}
FollowerMenu(){
llDialog(owner, "\n\n*These options let you move your \"Visible\" avatar position, this helps make some nasty followers useless or less effective.\n\n (Select \"Ignore\" when done;)", FollowerButtons, myChannel);
llSetTimerEvent(30.0);
}
ExpressionMenu(){
llDialog(owner, "\n\n*These options will animate your face (Facial Expressions), often for only a very brief period.\n\n (Select \"Ignore\" when done;)", ExpressionButtons, myChannel);
llSetTimerEvent(30.0);
}
ExpressionMenu2(){
llDialog(owner, "\n\n*These options will animate your face, often for only a very brief period.\n\n (Select \"Ignore\" when done;)", ExpressionButtons2, myChannel);
llSetTimerEvent(30.0);
}
EmoteMenu(){
llDialog(owner, "\n\n*These options will animate your face (Facial Emotes), often for only a very brief period.\n\n (Select \"Ignore\" when done;)", EmoteButtons, myChannel);
llSetTimerEvent(30.0);
}
EmoteMenu2(){
llDialog(owner, "\n\n*These options will animate your face (Facial Emotes), often for only a very brief period.\n\n (Select \"Ignore\" when done;)", EmoteButtons2, myChannel);
llSetTimerEvent(30.0);
}
OurListen(){
Listen = llListen(myChannel, "", owner, "");
}
//Our sensor menu
float ScanRadius = 50;
integer aSwitch = 0;//switch to know whether loading inventory anims is for us or another av
integer gPos = 0;
integer gStride = 9;
list names;
list fullname;
Sensor3D(){
integer nTop = gPos + gStride -1;
list buttons = llList2List(names, gPos, nTop);
string msg = llDumpList2String(buttons, "\n");
while(llGetListLength(buttons) % 3 != 0){
buttons = llListInsertList(buttons, [" "], gStride);
}
if (gPos >= gStride){
buttons += ["< <Back"];
}
if (nTop - 1 < llGetListLength(names)){
buttons += ["Next>>"];
}
llDialog(owner, "\nSelect your desired target;\n\nNOTE>> Select \"*Undeformer*\" to STOP animations for the given target.", buttons, myChannel);
}
// UDF to return full name if cut by llGetSubString
string Name_2_full(string str1){
integer u=0;
for(;u < llGetInventoryNumber (INVENTORY_ANIMATION);u++){
if(llGetSubString(llGetInventoryName(INVENTORY_ANIMATION,u),0,23)==str1)
return llGetInventoryName(INVENTORY_ANIMATION,u);
}
return "";
}
default{
//
state_entry(){
if (llGetAttached())
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
owner = llGetOwner();
myChannel = (integer)llFrand(DEBUG_CHANNEL) * -1;
Animation = llGetInventoryName(INVENTORY_ANIMATION,0);
//llOwnerSay((string)llGetLinkNumber());
}
//
on_rez(integer change){
llResetScript();
}
//
no_sensor(){
llOwnerSay("/me >> Nobody detected within "+(string)ScanRadius+"m;");
MainMenu();
}
// Sensor used to grab nearby names
sensor(integer num_detected){
names = [];
fullname = [];
gPos = 0;
integer i;
for (i = 0; i < num_detected; i++){
names = names + llGetSubString(llDetectedName(i),0,23);
fullname = fullname + llDetectedName(i);
}
Sensor3D();
}
// link message to handle button texture change
link_message(integer sender, integer num, string str, key id){
if (str == "ANIM>>STOP2"){
StopAnims();
}
else if (str == "ANIMATION>>CTRL"){
OurListen();
MainMenu();
}
}
//
touch_start(integer num_detected){integer i;
aSwitch = 0;
for (i = 0; i < num_detected; i++){
integer touchedFace = llDetectedTouchFace(i);
if (touchedFace == -1){OurListen();
MainMenu();
llOwnerSay("Sorry, your viewer doesn't support touched faces;
(opening menu instead, select STOP from there to stop anims;)");
}
if (touchedFace == 3){
OurListen();
MainMenu();
}
if (touchedFace == 1){StopAnims();
llOwnerSay("/me Stopped & Reset `0'");
}
// Some effects for button;
vector oldColor = llGetColor(touchedFace);// Store away the original color
llSetColor(<0., 255., 0.>, touchedFace);// Flash color
llSleep(0.04);
llSetColor(oldColor, touchedFace);// Put the color back to how we found it.
}
}
//
timer(){//timer is for nothig but removing the listen/lag in this script
llSetTimerEvent(0.0);//we dont want to keep removing listen... so we stop timer
llListenRemove(Listen);//then do what we are here for.. remove listen/lag.
}
//
listen(integer chan, string who, key id, string what){
if(chan == myChannel && llGetOwnerKey(id) == llGetOwner()){
string exp = "express_"+what;
string em = exp + "_emote";
//Main menu list
if (llListFindList(MainButtons, [what]) != -1){//if the message if on our list of buttons
if(what == "STOP"){StopAnims();
llOwnerSay("/me >> Stopped & Reset `0'");
}
else if(what == "Anim Some1"){aSwitch = 1;
aLoad();
aMenu();
}
else if(what == "R-P-S"){rspMenu();
}
else if(what == "SL Anims"){slAnimMenu();
}
else if(what == "Emotes"){EmoteMenu();
}
else if(what == "Expressions"){ExpressionMenu();
}
else if(what == "!Follower"){FollowerMenu();
}
else if(what == "Anims"){dMenu=0;
aSwitch = 0;
aLoad();
aMenu();
}return;
}
//Rock Scissors Paper menu list
else if (llListFindList(rspButtons, [what]) != -1){//if the message if on our list of buttons
if(what == "-Main-"){MainMenu();
}
else if(what == "Paper"){llStartAnimation("rps_paper");rspMenu();
}
else if(what == "Rock"){llStartAnimation("rps_rock");rspMenu();
}
else if(what == "Scissors"){llStartAnimation("rps_scissors");rspMenu();
}
else if(what == "Countdown"){llStartAnimation("rps_countdown");rspMenu();
}return;
}
//SL animations menu list
else if (llListFindList(slAnimButtons, [what]) != -1){
if(what == "-Main-"){MainMenu();
}
else if(what == "`0' >>"){slAnimMenu2();
}
else{llStartAnimation(what);
slAnimMenu();
}return;
}
else if (llListFindList(slAnimButtons2, [what]) != -1){
if(what == "< < `0'"){slAnimMenu();
}
else{llStartAnimation(what);
slAnimMenu2();
}return;
}
// Emote menu list
else if (llListFindList(EmoteButtons, [what]) != -1){
if(what == "-Main-"){MainMenu();
}
else if(what == "*_* >>"){EmoteMenu2();
}
else{llStartAnimation(em);
EmoteMenu();
}return;
}
else if (llListFindList(EmoteButtons2, [what]) != -1){
if(what == "< < *_*"){EmoteMenu();
}
else{llStartAnimation(em);
EmoteMenu2();
}return;
}
// Expression menu list
else if (llListFindList(ExpressionButtons, [what]) != -1){
if(what == "-Main-"){MainMenu();
}
else if(what == "^_^ >>"){ExpressionMenu2();
}
else{llStartAnimation(exp);
ExpressionMenu();
}return;
}
else if (llListFindList(ExpressionButtons2, [what]) != -1){
if(what == "< < ^_^"){ExpressionMenu();
}
else{llStartAnimation(exp);
ExpressionMenu();
}return;
}
// Follower menu list
else if (llListFindList(FollowerButtons, [what]) != -1){
if(what == "-Main-"){MainMenu();
}
else if(what =="Center"){StopAnims();
FollowerMenu();
}
else{
if(aSwitch == 0){llStartAnimation(what);
FollowerMenu();
}
else{aMenu();
}
}return;
}
// Anim menu list (prim inventory
else if (llListFindList(AnimButtons, [what]) != -1){
if(what == "•"){return;
}
else if(what == "<<•"){dMenu--;
aMenu();
}
else if(what == "1st Page"){dMenu=0;
aMenu();
}
else if(what == "•>>"){dMenu++;
aMenu();
}
else if (llListFindList(tList, [Name_2_full(what)]) != -1){
Animation = Name_2_full(what);
if(aSwitch == 0){//if we are set to animate ourselves..
llStartAnimation(Animation);
aMenu();return;
}
else{//else we must be asked to animate someone else
llSensor("","",AGENT,ScanRadius,TWO_PI);
}
}
}
else{
reqid = llHTTPRequest(URL+"?terse=1&name="+llEscapeURL(what),[],"");
}
}
}
//
http_response(key id, integer status, list meta, string body){
if (id != reqid)
return;
if((key)body == NULL_KEY)
llOwnerSay("/me >> No key found.. Perhaps a new avatar.");
else
Animate = body;
llRequestPermissions(Animate,PERMISSION_TRIGGER_ANIMATION);
}
//
run_time_permissions(integer perm){
if(aSwitch == 1){//if we are set to animate someone
if(perm){//if we got their permission
StopTheirAnims();
llStartAnimation(Animation);
llOwnerSay("/me >> "+llKey2Name(Animate)+" Accepted your request~");
MainMenu();
}
else{//if we dont have their permission
llOwnerSay("/me >> "+llKey2Name(Animate)+" Declined your request~");
MainMenu();
}
}
else{//we have perms for ourselves.. do nothing
}
}
//
}