Jump to content

Dance script changes needed


Miltades
 Share

You are about to reply to a thread that has been inactive for 3566 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello!

 

I was wondering if anyone could help me with a script?

It's a dance script with the option's 'next' 'stop all' or 'random' that pop up in a blue menu.

What i want is to remove the menu all together and to have the animations play 'randomly' as soon as the object the script is in, attaches/rezzes, rather than having to have the menu pop up and select the option. 

 

My partner and I tried doing this using a secondary script, however we found, whilst the secondary script worked, it didn't have the same smooth transition between animations. Wheras the script below, for whatever reason has the animations run smoothing, and sometime even overlap a little or at least appear to do so. 

I would like to keep this 'smooth transition' between each animation as they're played randomly. 

Please ntoe I am NOT farmiliar with SLS and am looking for someone to simply re-write this script for me. As I am struggling to understand this language at all.

 

The script is below : 

 

integer listener;
list dances;
integer counter;
integer WHICH;
integer TOTAL;
integer STATE;
integer PERMS;
integer INTERVAL = 25;
     
  
  
  
  dialog()
    {      
    llListenRemove(listener);      
    integer channel = llCeil(llFrand(1000)+100 * -1);      
    listener =  llListen(channel,"","","");     
    llDialog(llGetOwner(),"What would you like your lower lids to do?",["To Next","Stop All","Random"], channel);
}
 
default
{
    state_entry()
    {
        
         integer i;
         integer j = llGetInventoryNumber(INVENTORY_ANIMATION);
         for  (i = 0; i < j; i++)
         {
            dances += llGetInventoryName(INVENTORY_ANIMATION,i);  
            TOTAL++;
         }
        STATE = 2;    

        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);          dialog();    
      }
      
      
        on_rez(integer param)
        {
            llResetScript();
        }
        
      changed(integer what)        
      {
         if (what & CHANGED_INVENTORY)
             llResetScript();
      }

    timer()
    {
        
       if (listener)
           counter++;
       if (counter)
       llListenRemove (listener);  

       
       PERMS = llGetPermissions();
       if  (PERMS &  PERMISSION_TRIGGER_ANIMATION)
       {
           if (STATE == 1)  
           {
               llStopAnimation(llList2String(dances, WHICH));  
               WHICH++;
                if (WHICH >= TOTAL)
                {
                    WHICH = 0;
                }
                llStartAnimation(llList2String(dances, WHICH));       
        }
        else if (STATE == 2)  
        {
            
            llStopAnimation(llList2String(dances, WHICH));                  
            WHICH = llCeil(llFrand(TOTAL))-1;                  
            llStartAnimation(llList2String(dances, WHICH));             
    
              }             
               llSetTimerEvent(INTERVAL);      
         }          
        else          
        {              
                
              llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);         
       }      
 
 }                 
         listen(integer channel, string name, key id, string message)      
         {         
         llListenRemove(listener);    
         PERMS = llGetPermissions();         
         
         if (message == "Stop Dance")         
         {             
              STATE = FALSE;            
              if (PERMS & PERMISSION_TRIGGER_ANIMATION)             
              {                
              llStopAnimation(llList2String(dances, WHICH));             
              }            
              llSetTimerEvent(0);        
               }      
                else if (message == "Next Dance")        
                 {           
                 if (!(PERMS & PERMISSION_TRIGGER_ANIMATION))             
                 {             
                 llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);            }             
          STATE = 1;    
          }         
          else if ( message == "Random")         
          {            
           if (!(PERMS & PERMISSION_TRIGGER_ANIMATION))             
          {                 
          llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);             }            
           STATE = 2; 
        }     
    
    }     
     
     touch_start(integer who)     
     {     
      if (llDetectedKey(0) == llGetOwner())        
{             

    dialog();        
   }    
 
 }         
 
      run_time_permissions(integer perm)     
      {       
       PERMS = perm;        
        llSetTimerEvent(1.0);    
         }  
         
    } 

 

Link to comment
Share on other sites

This should do it.

list dances;integer WHICH;integer TOTAL;integer PERMS;integer INTERVAL = 25;     default {    state_entry() {         integer i;        integer j = llGetInventoryNumber(INVENTORY_ANIMATION);        for  (i = 0; i < j; i++) {            dances += llGetInventoryName(INVENTORY_ANIMATION,i);              TOTAL++;        }    }        changed(integer what) {        if (what & CHANGED_INVENTORY) llResetScript();    }        attach(key id) {        if (id) llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);    }    timer() {       PERMS = llGetPermissions();       if  (PERMS &  PERMISSION_TRIGGER_ANIMATION) {            llStopAnimation(llList2String(dances, WHICH));                              WHICH = llCeil(llFrand(TOTAL))-1;                              llStartAnimation(llList2String(dances, WHICH));                         llSetTimerEvent(INTERVAL);              }                  else llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);             }                          run_time_permissions(integer perm) {               PERMS = perm;                llSetTimerEvent(1.0);        }  } 

 



Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3566 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...