string floattext = ""; string standanimation = "stand"; string sitanimation = ""; stop_all_animations () { list animationlist = llGetAnimationList(avatar); integer i; for (i = 0; i < llGetListLength(animationlist); i++) { llStopAnimation(llList2Key(animationlist,i)); } } start_animation(string animation,float alpha){ llSetAlpha(alpha,ALL_SIDES); llSetText(floattext,<1,1,1>,alpha); llStartAnimation(animation); } integer dance = TRUE; key avatar; default { state_entry() { floattext = llGetObjectDesc(); sitanimation = llGetInventoryName(INVENTORY_ANIMATION,0); llSetText(floattext,<1,1,1>,1.0); llSetSitText("Pose!"); llSitTarget(<0,0,0.1>,ZERO_ROTATION); } changed(integer change) { if (change & CHANGED_LINK) { if (llAvatarOnSitTarget() != NULL_KEY) { avatar = llAvatarOnSitTarget(); integer perm = llGetPermissions(); if (perm & PERMISSION_TRIGGER_ANIMATION && avatar == llGetPermissionsKey()) { stop_all_animations(); start_animation(sitanimation,0.0); } else { dance = TRUE; llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); } } else if(llGetPermissionsKey() != NULL_KEY){ if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { stop_all_animations(); start_animation(standanimation,1.0); } else { dance = FALSE; llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); } } } } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { stop_all_animations(); if (dance) { start_animation(sitanimation,0.0); } else { start_animation(standanimation,1.0); } } } }