After you Subscribe email your username
and receipt to
goonsquad.me@gmail.com
Membership Options
Pay With Bitcoin
  • 11 Vote(s) - 3.18 Average
  • 5
  • 4
  • 3
  • 2
  • 1
Thread Modes

Dance Hud
nigrajim Offline
Goonsquad Member
******
Goonsquad

Posts: 209
Threads: 203
Joined: May 2016
Reputation: 313
MAIN SCRIPT

 
PHP Code:
vector attachedSize=<0.5,0.5,0.5>;

vector hudSize=<0.2,0.2,0.2>;
list 
dancing=["","","","","","","","","","","","","","","","","","","",""];
integer dancerNum;
list 
animations;
key owner;
integer useNC;
string notecard;
integer notecardLines;
integer line;
key query_notecardLines;
key query_notecardData;
integer hud;
integer animPerm;
integer start;
string anim;
integer animNum;
integer anims;
integer menu1Chan=-100001;
integer menu2Chan=-100002;
integer menu3Chan=-100003;
integer menu4Chan=-100004;
integer cycle;
integer random;
integer invite;
integer i;
list 
names;
list 
animNames;
list 
keys;
integer add;
integer menuPage;

MainMenu()
{
   
integer d;
   for(
i=0;i<llGetListLength(dancing);i++)
   {
       if(
llList2String(dancing,i)==""){d++;}
   }
   
string aname;
   
integer ii=llListFindList(animations,[anim]);
   if(
llList2String(animations,ii+1)==anim){aname=anim;}
   else{
aname=llList2String(animations,ii-1);}
   
string message="Main Menu";
   if(
notecard!=""){message+="\nNotecard loaded: " notecard;}
   
message+="\nCurrent animation: " aname;
   if(
cycle){message+="\nAnimation cycling is on.";}
   else{
message+="\nAnimation cycling is off.";}
   
message+="\nAvailable slots: " + (string) "/" + (string) llGetListLength(dancing);
   
message+="\nFree Memory: " + (string) llGetFreeMemory();
   list 
buttons=["<<","Stop",">>","Start","Dances..."];
   if(
notecard==""){buttons+=["Load NC..."];}
   else{
buttons+=["UnLoad NC"];}
   
buttons+=["Reset All","Cycle","Random","Invite...","Stop...","Stop All"];
   
llDialog(llGetOwner(),message,buttons,menu1Chan);
}
DanceMenu()
{
   list 
buttons=["<<","Main Menu",">>"];
   
string aanimNames=[];
   for(
i=menuPage*18;i<(menuPage*18)+18;i+=2)
   {
       
a=llList2String(animations,i);
       if(
a!="")
       {
           
buttons+=[llGetSubString(a,0,23)];
           
animNames+=[llGetSubString(a,0,23),llList2String(animations,i+1)];
       }
   }
   
string aname;
   
integer ii=llListFindList(animations,[anim]);
   if(
llList2String(animations,ii+1)==anim){aname=anim;}
   else{
aname=llList2String(animations,ii-1);}
   
llDialog(llGetOwner(),"\nChoose Animation\n\t\nCurrent animation: " aname,buttons,menu2Chan);
}
ClearPlaceHolders()
{
   for(
i=0;i<llGetListLength(dancing);i++)
   {
       if(
llList2String(dancing,i)=="0")
       {
           
dancing=llListReplaceList(dancing,[""],i,i);
       }
   }
}
ChangeAnim()
{
   
anim=llList2String(animations,(animNum*2)+1);
}
default
{
   
state_entry()
   {
       
owner=llGetOwner();
       
llMessageLinked(LINK_THIS,0,"Reset,All","");
       
anims=llGetInventoryNumber(INVENTORY_ANIMATION);
       if(
anims){state run;}
       else{
llOwnerSay("No Animations!");}
   }
   
on_rez(integer num){llResetScript();}
}

state load
{
   
state_entry()
   {
       
llOwnerSay("Loading notecard: \"" notecard "\" ...");
       
query_notecardLines=llGetNumberOfNotecardLines(notecard);
   }
   
on_rez(integer num){llResetScript();}
   
dataserver(key queryidstring data)
   {
       if(
queryid==query_notecardLines)
       {
           
notecardLines=(integer) data;
           if(
notecardLines)
           {
               
line=0animations=[];
               
query_notecardData=llGetNotecardLine(notecard,line);
           }
       }
       if(
queryid==query_notecardData)
       {
           if(
data!=EOF)
           {
               list 
note=llParseString2List(data,["[","]"],[]);
               if(
note!=[])
               {
                   
string aname=llStringTrim(llList2String(note,1),STRING_TRIM);
                   if(
llGetInventoryType(aname)==INVENTORY_ANIMATION)
                   {
animations+=[llStringTrim(llList2String(note,0),STRING_TRIM),llStringTrim(llList2String(note,1),STRING_TRIM)];}
               }
               
line++;
               if(
line<=notecardLines)
               {
                   
query_notecardData=llGetNotecardLine(notecard,line);
               }
               else{
state run;}
           }
           else{
state run;}
       }
   }
}

state run
{
   
state_entry()
   {
       if(
notecard=="")
       {
           
anims=llGetInventoryNumber(INVENTORY_ANIMATION);
           
animations=[]; string a;
           for(
i=0;i<anims;i++)
           {
               if(
llGetFreeMemory()>=2000)
               {
                   
a=llGetInventoryName(INVENTORY_ANIMATION,i);
                   
animations+=[a,a];
               }
               else
               {
                   
i=anims;
                   
llOwnerSay("Low Memory ... could not load all animations!");
               }
           }
           
anim=llList2String(animations,1);
           
llOwnerSay((string) anims " animations loaded. Ready ...");
       }
       else
       {
           
anims=llGetListLength(animations)/2;
           
anim=llList2String(animations,1);
           
llOwnerSay((string) anims " animations loaded. Ready ...");
       }
       
llListen(99,"","","");
       
llListen(-100001,"",llGetOwner(),"");
       
llListen(-100002,"",llGetOwner(),"");
       
llListen(-100003,"",llGetOwner(),"");
       
llListen(-100004,"",llGetOwner(),"");
       
integer attached=llGetAttached();
       if(
attached>&& attached<31)
       {
           
llSetAlpha(0.0,ALL_SIDES); hud=FALSE;
           
llSetLinkPrimitiveParams(LINK_THIS,[PRIM_TYPE,PRIM_TYPE_SPHERE,0,<0,1,0>,0.0,<0,0,0>,<0,1,0>,
               
PRIM_SIZE,attachedSize,PRIM_POSITION,<0,0,0>]);
           
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION PERMISSION_TAKE_CONTROLS);
       }
       else if(
attached>=31)
       {
           
llSetAlpha(1.0,ALL_SIDES); hud=TRUE;
           
llSetLinkPrimitiveParams(LINK_THIS,[PRIM_TYPE,PRIM_TYPE_BOX,0,<0,1,0>,0.0,<0,0,0>,<1,1,0>,<0,0,0>,PRIM_SIZE,hudSize]);
           
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION PERMISSION_TAKE_CONTROLS);
       }
       else if(!
attached)
       {
           
llSetAlpha(1.0,ALL_SIDES); hud=FALSE;
           
llSetLinkPrimitiveParams(LINK_THIS,[PRIM_TYPE,PRIM_TYPE_SPHERE,0,<0,1,0>,0.0,<0,0,0>,<0,1,0>,PRIM_SIZE,<0.5,0.5,0.5>]);
       }
       
llSetTimerEvent(20.0);
   }
   
on_rez(integer num)
   {
       if(
owner!=llGetOwner()){llResetScript();}
       
cycle=FALSErandom=FALSEstart=FALSE;
       
dancing=["","","","","","","","","","","","","","","","","","","",""];
       
llMessageLinked(LINK_THIS,0,"Reset,All","");
       
integer attached=llGetAttached();
       if(
attached>&& attached<31)
       {
           
llSetAlpha(0.0,ALL_SIDES); hud=FALSE;
           
llSetLinkPrimitiveParams(LINK_THIS,[PRIM_TYPE,PRIM_TYPE_SPHERE,0,<0,1,0>,0.0,<0,0,0>,<0,1,0>,
               
PRIM_SIZE,attachedSize,PRIM_POSITION,<0,0,0>]);
           
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION PERMISSION_TAKE_CONTROLS);
       }
       else if(
attached>=31)
       {
           
llSetAlpha(1.0,ALL_SIDES); hud=TRUE;
           
llSetLinkPrimitiveParams(LINK_THIS,[PRIM_TYPE,PRIM_TYPE_BOX,0,<0,1,0>,0.0,<0,0,0>,<1,1,0>,<0,0,0>,PRIM_SIZE,hudSize]);
           
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION PERMISSION_TAKE_CONTROLS);
       }
       else if(!
attached)
       {
           
llSetAlpha(1.0,ALL_SIDES); hud=FALSE;
           
llSetLinkPrimitiveParams(LINK_THIS,[PRIM_TYPE,PRIM_TYPE_SPHERE,0,<0,1,0>,0.0,<0,0,0>,<0,1,0>,PRIM_SIZE,<0.5,0.5,0.5>]);
       }
   }
   
run_time_permissions(integer perm)
   {
       if(
perm PERMISSION_TAKE_CONTROLS){llTakeControls(CONTROL_FWD,TRUE,TRUE);}
       if(
perm PERMISSION_TRIGGER_ANIMATION)
       {
           
animPerm=TRUE;
           if(!
hud){MainMenu();}
       }
       else{
animPerm=FALSE;}
       
   }
   
touch_start(integer num)
   {
       if(
llDetectedKey(0)==llGetOwner()){MainMenu();}
       else
       {
           
integer ii=llListFindList(dancing,[llDetectedKey(0)]);
           if(
ii==-1)
           {
               for(
i=0;i<llGetListLength(dancing);i++)
               {
                   if(
llList2String(dancing,i)=="")
                   {
                       
dancerNum=i;
                       
dancing=llListReplaceList(dancing,["0"],i,i);
                       
i=99;
                   }
               }
               
llSetTimerEvent(60.0);
               
llMessageLinked(LINK_THIS,dancerNum,"Start,Animation",llDetectedKey(0));
           }
           else
           {
               
llMessageLinked(LINK_THIS,ii,"Stop,Animation",llDetectedKey(0));
           }
       }
   }
   
link_message(integer senderinteger numstring strkey id)
   {
       if(
str=="Animation,Started")
       {
           
dancing=llListReplaceList(dancing,[id],num,num);
           
string name=llKey2Name(id);
           if(
name!=""){llOwnerSay(name " has started dancing.");}
           if(
start && anim!="")
           {
               
llStopAnimation(anim); llStartAnimation(anim);
               
llMessageLinked(LINK_THIS,0,"Change,Animation",(string) anim);
           }
       }
       if(
str=="Animation,Stopped")
       {
           
string name=llKey2Name(llList2Key(dancing,num));
           if(
name!=""){llOwnerSay(name " has stopped dancing.");}
           
dancing=llListReplaceList(dancing,[""],num,num);
       }
   }
   
listen(integer channelstring namekey idstring msg)
   {
       if(
channel==99)
       {
           
msg=llToLower(msg);
           if(
id==llGetOwner())
           {
               if(
msg=="menu"){MainMenu();}
           }
           else
           {
               if(
msg=="stop")
               {
                   
integer ii=llListFindList(dancing,[id]);
                   if(
ii!=-1)
                   {
                       
dancerNum=ii;
                       
llMessageLinked(LINK_THIS,dancerNum,"Stop,Animation",id);
                   }
               }
           }
       }
       if(
channel==menu1Chan)
       {
           if(
msg=="<<")
           {
               
animNum--;
               if(
animNum<0)
               {
                   
animNum=(llGetListLength(animations)/2)-1;
               }
               if(
anim!="" && animPerm){llStopAnimation(anim);}
               
ChangeAnim();
               if(
start && anim!="")
               {
                   if(
animPerm){llStartAnimation(anim);}
                   
llMessageLinked(LINK_THIS,0,"Change,Animation",anim);
               }
               
MainMenu();
           }
           if(
msg=="Stop")
           {
               
start=FALSE;
               if(
anim!="" && animPerm){llStopAnimation(anim);}
               
llMessageLinked(LINK_THIS,0,"Pause,Animation",anim);
               
MainMenu();
           }
           if(
msg==">>")
           {
               
animNum++;
               if(
animNum>=llGetListLength(animations)/2){animNum=0;}
               if(
anim!="" && animPerm){llStopAnimation(anim);}
               
ChangeAnim();
               if(
start && anim!="")
               {
                   if(
animPerm){llStartAnimation(anim);}
                   
llMessageLinked(LINK_THIS,0,"Change,Animation",anim);
               }
               
MainMenu();
           }
           if(
msg=="Start")
           {
               
start=TRUE;
               if(
anim!="" && animPerm){llStopAnimation(anim);}
               
ChangeAnim();
               if(
animPerm){llStartAnimation(anim);}
               
llMessageLinked(LINK_THIS,0,"Change,Animation",anim);
               
MainMenu();
           }
           if(
msg=="Dances...")
           {
               
menuPage=llFloor((float) animNum/9.0);
               
DanceMenu();
           }
           if(
msg=="Load NC...")
           {
               
names=[];
               
integer notes=llGetInventoryNumber(INVENTORY_NOTECARD);
               if(
notes>12){notes=12;}
               for(
i=0;i<notes;i++)
               {
                   
names+=[llGetInventoryName(INVENTORY_NOTECARD,i)];
               }
               
llDialog(llGetOwner(),"\nLoad Notecard...",names,menu4Chan);
           }
           if(
msg=="UnLoad NC")
           {
               
start=FALSE;
               if(
anim!="" && animPerm){llStopAnimation(anim);}
               
llMessageLinked(LINK_THIS,0,"Pause,Animation",anim);
               
notecard="";
               
anims=llGetInventoryNumber(INVENTORY_ANIMATION);
               
anim=llGetInventoryName(INVENTORY_ANIMATION,0);
               
animNum=0;
               
animations=[];
               for(
i=0;i<anims;i++)
               {
                   
string aname=llGetInventoryName(INVENTORY_ANIMATION,i);
                   
animations+=[aname,aname];
               }
               
llOwnerSay((string) anims " animations loaded. Ready ...");
               
MainMenu();
           }
           if(
msg=="Reset All")
           {
               if(
anim!="" && animPerm){llStopAnimation(anim);}
               
llMessageLinked(LINK_THIS,0,"Stop,All","");
               
llMessageLinked(LINK_THIS,0,"Reset,All","");
               
llResetScript();
           }
           if(
msg=="Cycle")
           {
               
cycle=!cycle;
               
MainMenu();
           }
           if(
msg=="Random")
           {
               
random=TRUE;
               if(
anim!="" && animPerm){llStopAnimation(anim);}
               
animNum=llFloor(llFrand(anims));
               
ChangeAnim();
               
start=TRUE;
               if(
animPerm){llStartAnimation(anim);}
               
llMessageLinked(LINK_THIS,0,"Change,Animation",anim);
               
MainMenu();
           }
           if(
msg=="Invite..."){llSensor("","",AGENT,20.0,PI);}
           if(
msg=="Stop...")
           {
               list 
buttonsnames=[];
               for(
i=0;i<llGetListLength(dancing);i++)
               {
                   if(
llList2String(dancing,i)!="" && llList2String(dancing,i)!="0")
                   {
                       
buttons+=[llGetSubString(llKey2Name(llList2Key(dancing,i)),0,23)];
                   }
                   
names+=[llGetSubString(llKey2Name(llList2Key(dancing,i)),0,23)];
               }
               
add=FALSE;
               
llDialog(llGetOwner(),"\nStop Animating ...",buttons,menu3Chan);
           }
           if(
msg=="Stop All")
           {
               
dancing=["","","","","","","","","","","","","","","","","","","",""];
               
start=FALSE;
               if(
anim!="" && animPerm){llStopAnimation(anim);}
               
llMessageLinked(LINK_THIS,0,"Stop,All","");
               
MainMenu();
           }
       }
       if(
channel==menu2Chan)
       {
           if(
msg=="<<")
           {
               
menuPage--;
               if(
menuPage<0)
               {
                   
menuPage=llGetListLength(animations)/18;
               }
               
DanceMenu();
           }
           if(
msg==">>")
           {
               
menuPage++;
               if(
menuPage>llGetListLength(animations)/18)
               {
                   
menuPage=0;
               }
               
DanceMenu();
           }
           if(
msg=="Main Menu"){MainMenu();}
           if(
msg!="<<" && msg!=">>" && msg!="Main Menu")
           {
               
integer ii=llListFindList(animNames,[msg]);
               if(
ii!=-1)
               {
                   if(
anim!="" && animPerm){llStopAnimation(anim);}
                   
anim=llList2String(animNames,ii+1);
                   
animNum=(llListFindList(animations,[anim])-1)/2;
                   
start=TRUE;
                   if(
anim!="" && animPerm){llStartAnimation(anim);}
                   
llMessageLinked(LINK_THIS,0,"Change,Animation",anim);
               }
               
random=FALSE;
               
DanceMenu();
           }
       }
       if(
channel==menu3Chan)
       {
           if(
add)
           {
               
integer ii=llListFindList(names,[msg]);
               if(
ii!=-1)
               {
                   for(
i=0;i<llGetListLength(dancing);i++)
                   {
                       if(
llList2String(dancing,i)=="")
                       {
                           
dancerNum=i;
                           
dancing=llListReplaceList(dancing,["0"],i,i);
                           
i=99;
                       }
                   }
                   
llSetTimerEvent(60.0);
                   
llMessageLinked(LINK_THIS,dancerNum,"Start,Animation",llList2Key(keys,ii));
               }
           }
           else
           {
               if(
msg!="OK")
               {
                   
dancerNum=llListFindList(names,[msg]);
                   if(
dancerNum!=-1){llMessageLinked(LINK_THIS,dancerNum,"Stop,Animation","");}
               }
           }
           
MainMenu();
       }
       if(
channel==menu4Chan)
       {
           
notecard=msg;
           
start=FALSE;
           if(
anim!="" && animPerm){llStopAnimation(anim);}
           
llMessageLinked(LINK_THIS,0,"Pause,Animation",anim);
           
state load;
       }
   }
   
sensor(integer num)
   {
       
names=[]; keys=[];
       for(
i=0;i<num;i++)
       {
           if(
llListFindList(dancing,[llDetectedKey(i)])==-1)
           {
               
names+=[llGetSubString(llDetectedName(i),0,23)];
               
keys+=[llDetectedKey(i)];
           }
           if(
llGetListLength(keys)>=12){i=num;}
       }
       
add=TRUE;
       
llDialog(llGetOwner(),"\nChoose Dancer to invite...",names,menu3Chan);
   }
   
no_sensor()
   {
       
llDialog(llGetOwner(),"No one within range.",["OK"],menu3Chan);
   }
   
timer()
   {
       if(
start)
       {
           if(
cycle)
           {
               if(
anim!="" && animPerm){llStopAnimation(anim);}
               if(
random){animNum=llFloor(llFrand((float) llGetListLength(animations)/2.0));}
               else{
animNum++; if(animNum>=llGetListLength(animations)/2){animNum=0;}}
               
ChangeAnim();
           }
           if(
animPerm){llStopAnimation(anim); llStartAnimation(anim);}
           
llMessageLinked(LINK_THIS,0,"Change,Animation",anim);
       }
       
ClearPlaceHolders();
   }

=============================_Anim============================
name this script _Anim and just drag mutliple copies into the main prim the number of scripts added is the number of people you can join with you!!!
PHP Code:
integer animNum=0;


key dancer=NULL_KEY;
string anim;
default
{
   
state_entry()
   {
       
   }
   
link_message(integer senderinteger numstring strkey id)
   {
       if(
str=="Reset,All"){llResetScript();}
       if(
str=="Stop,All" && dancer!=NULL_KEY)
       {
           if(
anim!=""){llStopAnimation(anim);}
           
dancer=NULL_KEY;
       }
       if(
str=="Start,Animation" && num==animNum && dancer==NULL_KEY)
       {
           if(
llGetAgentSize(id)!=ZERO_VECTOR){llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION);}
       }
       if(
str=="Stop,Animation" && num==animNum && dancer!=NULL_KEY)
       {
           if(
anim!="")
           {
               
llStopAnimation(anim);
               
llMessageLinked(LINK_THIS,animNum,"Animation,Stopped",dancer);
               
llInstantMessage(dancer,"You have stopped dancing with " llKey2Name(llGetOwner()));
               
dancer=NULL_KEY;
           }
       }
       if(
str=="Change,Animation" && dancer!=NULL_KEY)
       {
           if(
llGetAgentSize(dancer)!=ZERO_VECTOR)
           {
               if(
anim!=""){llStopAnimation(anim);}
               
anim=(string) id;
               
llStartAnimation(anim);
           }
           else
           {
               
llMessageLinked(LINK_THIS,animNum,"Animation,Stopped",dancer);
               
dancer=NULL_KEY;
           }
       }
       if(
str=="Pause,Animation" && dancer!=NULL_KEY)
       {
           if(
anim!=""){llStopAnimation(anim);}
       }
   }
   
run_time_permissions(integer perm)
   {
       if(
perm PERMISSION_TRIGGER_ANIMATION)
       {
           if(
dancer==NULL_KEY)
           {
               
dancer=llGetPermissionsKey();
               
llMessageLinked(LINK_THIS,animNum,"Animation,Started",dancer);
               
llInstantMessage(dancer,"You have started dancing with " llKey2Name(llGetOwner()));
           }
       }
       else
       {
           
llMessageLinked(LINK_THIS,animNum,"Animation,Stopped",dancer);
           
dancer=NULL_KEY;
       }
   }

==============================Intructions====================================
Simple add the two scripts above like stated the _Amin script just add as many copies as ya like for how many people you might like to join you!!!


Possibly Related Threads...
Thread / Author Replies / Views Last Post
1 Replies 325 Views
Last Post by Summer
07-18-2016, 12:21 PM
2 Replies 353 Views
Last Post by Summer
06-22-2016, 09:58 AM
0 Replies 315 Views
Last Post by nigrajim
06-20-2016, 01:41 PM
0 Replies 253 Views
Last Post by nigrajim
06-20-2016, 01:37 PM
0 Replies 210 Views
Last Post by nigrajim
06-20-2016, 01:23 PM
0 Replies 223 Views
Last Post by nigrajim
06-20-2016, 01:12 PM
0 Replies 242 Views
Last Post by nigrajim
06-20-2016, 01:09 PM
0 Replies 192 Views
Last Post by nigrajim
06-20-2016, 12:57 PM
0 Replies 202 Views
Last Post by nigrajim
06-20-2016, 12:12 PM




Users browsing this thread: 1 Guest(s)

Color Skins

Change Color:

Background Patterns:

Background Images:

Background Header:

Setting Panel

Main Options: