Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list mouthAnims = ["Frown", "Grin", "Normal", "Pant", "Shock", "Snarl", "Test"];
- list eyeAnims = ["Angry", "Confused", "Happy", "Normal", "Sad", "Tired"];
- list earAnims = ["Droop", "IdleHappy", "Normal", "Pinned", "Sad", "Silly"];
- list tailAnims = ["bouncewag", "CurlWag", "Lowswish"];
- list AOConfig = [
- "CrouchWalking", "Crouch_Walk",
- "Falling Down", "Descend",
- "Flying", "FlyForwardFastADD",
- "FlyingSlow", "FlyForwardFast",
- "Hovering", "Flap_Loop",
- "Hovering Down", "Descend",
- "Hovering Up", "Flap",
- "Jumping", "Descend",
- "Landing", "Land",
- "PreJumping", "PreJump",
- "Running", "HopRun",
- "Sitting", "Sit",
- "Sitting on Ground", "Sit",
- //"Standing Up", "",
- "Striding", "Hopping_Walk",
- //"Soft Landing", "",
- //"Taking Off", "",
- "Turning Left", "StandTurnLeft",
- "Turning Right", "StandTurnRight",
- "Walking", "Hopping_Walk"
- ];
- setupAO(){
- llResetAnimationOverride("ALL");
- llSleep(0.1);
- integer i = 0;
- integer l = llGetListLength(AOConfig);
- for(;i<l;i+=2){
- llSetAnimationOverride(llList2String(AOConfig, i), llList2String(AOConfig, i+1));
- }
- }
- string lastStandAnim = "Stnd_2";
- float nextAnimTime;
- integer isTyping;
- string earAnim = "Ears_Normal";
- string eyeAnim = "Eyes_Normal";
- string mouthAnim = "Mout_Normal";
- string tailAnim = "Tail_CurlWag";
- float lastCrouch;
- integer crouch;
- key owner;
- setup(){
- owner = llGetOwner();
- llStartAnimation(lastStandAnim);
- llStartAnimation(earAnim);
- llStartAnimation(eyeAnim);
- llStartAnimation(mouthAnim);
- llStartAnimation(tailAnim);
- llTakeControls(0xFFFFFFFF, TRUE, TRUE);
- setupAO();
- llSetTimerEvent(0.1);
- }
- default{
- attach(key id){
- if(id){
- llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION|PERMISSION_OVERRIDE_ANIMATIONS|PERMISSION_TAKE_CONTROLS);
- }else{
- //Shutdown AO when detached
- llResetAnimationOverride("ALL");
- }
- }
- state_entry(){
- if(llGetAttached()){
- llListen(1, "", "", "");
- llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION|PERMISSION_OVERRIDE_ANIMATIONS|PERMISSION_TAKE_CONTROLS);
- }
- }
- listen(integer i, string n, key k, string m){
- if(llGetOwnerKey(k) == owner){
- list params = llParseString2List(m, [" "], []);
- m = llList2String(params, 0);
- if(m == "mouth"){
- string prop = llList2String(params, 1);
- if(~llListFindList(mouthAnims, (list)prop)){
- llStopAnimation(mouthAnim);
- llStartAnimation(mouthAnim = "Mout_"+prop);
- return;
- }else if(prop != ""){
- llOwnerSay("Unknown animation for mouth: "+prop);
- }
- llOwnerSay("Valid mouth animations: "+llList2CSV(mouthAnims));
- }else
- if(m == "ear"){
- string prop = llList2String(params, 1);
- if(~llListFindList(earAnims, (list)prop)){
- llStopAnimation(earAnim);
- llStartAnimation(earAnim = "Ears_"+prop);
- return;
- }else if(prop != ""){
- llOwnerSay("Unknown animation for ears: "+prop);
- }
- llOwnerSay("Valid ear animations: "+llList2CSV(earAnims));
- }else
- if(m == "eye"){
- string prop = llList2String(params, 1);
- if(~llListFindList(eyeAnims, (list)prop)){
- llStopAnimation(eyeAnim);
- llStartAnimation(eyeAnim = "Eyes_"+prop);
- return;
- }else if(prop != ""){
- llOwnerSay("Unknown animation for eyes: "+prop);
- }
- llOwnerSay("Valid eye animations: "+llList2CSV(eyeAnims));
- }else
- if(m == "tail"){
- string prop = llList2String(params, 1);
- if(~llListFindList(tailAnims, (list)prop)){
- llStopAnimation(tailAnim);
- llStartAnimation(tailAnim = "Tail_"+prop);
- return;
- }else if(prop != ""){
- llOwnerSay("Unknown animation for tail: "+prop);
- }
- llOwnerSay("Valid tail animations: "+llList2CSV(tailAnims));
- }
- }
- }
- control(key id, integer level, integer edge){
- integer start = level & edge;
- integer end = ~level & edge;
- integer held = level & ~edge;
- integer untouched = ~(level | edge);
- if(level&CONTROL_DOWN){
- if(llGetAgentInfo(owner)&AGENT_CROUCHING){
- if(crouch == 0){
- float now = llGetTime();
- if(lastCrouch+0.25>now){
- llStartAnimation("Crouch_Hide (Extra not important)");
- crouch = 2;
- }else{
- llStartAnimation("Crouch");
- crouch = 1;
- }
- lastCrouch = llGetTime();
- }
- }
- }else if(crouch){
- if(crouch==1)llStopAnimation("Crouch");
- else if(crouch==2)llStopAnimation("Crouch_Hide (Extra not important)");
- crouch = 0;
- }
- }
- timer(){
- float now = llGetTime();
- if(nextAnimTime>now){
- integer aid = llFloor(llFrand(3))+2;
- string newAnim = "Stnd_"+(string)aid;
- llStopAnimation(lastStandAnim);
- llStartAnimation(newAnim);
- lastStandAnim = newAnim;
- nextAnimTime = now+5+llFrand(5);
- }
- if(llGetAgentInfo(owner)&AGENT_TYPING){
- if(!isTyping){
- isTyping = TRUE;
- llStartAnimation("Talking");
- }
- }else if(isTyping){
- llStopAnimation("Talking");
- isTyping = FALSE;
- }
- }
- run_time_permissions(integer p){
- if(p){
- setup();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement