| DANCE MACHINE (menu driven) |
|
|
so that you just have to drop in the dances then it will make its own menu. when an avatar touches the dance machine he can choose witch dance he wants to do.
list result = []; integer CHANNEL = -15956; list MENU_MAIN = result; list gInventoryList; integer gStride = 9; integer gPos = 0; list buttons; key id; string ani; integer stop; list getInventoryList() { integer n = llGetInventoryNumber(INVENTORY_ANIMATION); integer i = 0; while(i < n) { result += llGetInventoryName(INVENTORY_ANIMATION, i); ++i; llSay(0,llGetInventoryName(INVENTORY_ANIMATION, i) ); } llSay(0,"done" ); return result; } dialog(key id) { integer nTop = gPos + gStride - 1; buttons = llList2List(result, gPos, nTop); string msg = llDumpList2String(buttons, "\n"); while(llGetListLength(buttons) % 3 != 0) { buttons = llListInsertList(buttons, [" "], gStride); } if (gPos >= gStride) { buttons += ["PREVIOUS"]; } if (nTop - 1 < llGetListLength(result)) { buttons += ["NEXT","stop"]; } llDialog(id, "SELECT DANCE: \n \n" , buttons, CHANNEL); } default { state_entry() { getInventoryList(); llListen(CHANNEL, "", NULL_KEY, ""); } touch_start(integer total_number) { id = llDetectedKey(0); dialog(id); } changed(integer change) { if(change & CHANGED_INVENTORY)llResetScript(); } listen(integer channel, string name, key id, string message) { if (message == "NEXT") { gPos = gPos + gStride; dialog(id); } else if (message == "PREVIOUS") { gPos = gPos - gStride; dialog(id); } if (message == "stop") { llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION); stop = TRUE; } else if ((message != "stop") && (message != "PREVIOUS") && (message != "NEXT")) { ani = message; llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION); llSleep(5); ; }} run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { if (stop == TRUE){ stop = FALSE; list anims = llGetAnimationList(llGetPermissionsKey()); integer len = llGetListLength(result); integer i; for (i = 0; i < len; ++i) llStopAnimation(llList2Key(result, i)); } else llStartAnimation(ani); } } }
|
Show (1) - Add comments:
Comments
It works very well and it is easy to use, but I was wondering if there was a way to make it that if someone right click and hit's sit that an it pop up and work. beause I was hoping on using it on a dance pole.
Posted by Sable Alexandre (SL name), on 12/02/2007 at 04:59

This dance machine script i have adapted
