Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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 ();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement