Edie_Shoreland icon

Animated Object Dance List

Edie_Shoreland | PRO | 01/02/19 10:55:50 PM UTC | 0 ⭐ | 9211 👁️ | Never ⏰ | []
Linden Scripting |

0 B

|

None

|

0 👍

/

0 👎

//Put your animations in the object to be animated
//first. Then create a new script and paste this code
//(make sure the script is in the object's inventory)
 
//Give it a couple minutes to warm up and then say
//"dance" in chat to animate the object.  Simply
//say "stop" to make the object stop. 
 
list ani_names;
 
float randomFloat;
string aniname;
integer aninumber;
integer synched;
integer toggle;
integer listenHandle;
 
integer countz ()
{
    return llGetInventoryNumber(INVENTORY_ANIMATION);
}
 
list moves (integer count)
{
    list    InventoryList;
    string  ItemName;
    while (count--)
    {
        ItemName = llGetInventoryName(INVENTORY_ANIMATION, count); 
        InventoryList += ItemName;
    }
    return InventoryList;
}
 
default
{
    state_entry()
    {
        synched = countz();
        ani_names = moves(synched);
        llSetTimerEvent(90);
        listenHandle = llListen(0, "", "", "");
    }
    
    timer()
    {
        randomFloat = llFrand(synched);
        aninumber = (integer)randomFloat;
        string oldaniname = aniname;
        aniname = llList2String(ani_names, aninumber);
        llStopObjectAnimation(oldaniname);
        llStartObjectAnimation(aniname);
    }
    
    listen(integer channel, string name, key id, string message)     
    {
        if (llToLower(message) == "stop")
        {
            llSetTimerEvent(0);
            llStopObjectAnimation(aniname);
        }
        else if (llToLower(message) == "dance")
        {
            llSetTimerEvent(90);
            llStartObjectAnimation(aniname);
        }
    }
    
    changed(integer change)
    {
        if (change & CHANGED_INVENTORY)
        {
            llSetTimerEvent(0);
            llStopObjectAnimation(aniname);
            llResetScript ();
        }
    } 
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎