Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
AO KDC_smallest_Animation_overrider  

KDC_smallest_Animation_overrider

KDC smallest Animation overrider by Kyrah Abattoir.lsl

Category: AO
By : Kyrah Abbatoir
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for KDC_smallest_Animation_overrider
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. KDC_smallest_Animation_overrider_by_1.lsl
1
2 //********************************************************
3 //This Script was pulled out for you by YadNi Monde from the SL FORUMS at http://forums.secondlife.com/forumdisplay.php?f=15, it is intended to stay FREE by it s author(s) and all the comments here in ORANGE must NOT be deleted. They include notes on how to use it and no help will be provided either by YadNi Monde or it s Author(s). IF YOU DO NOT AGREE WITH THIS JUST DONT USE!!!
4 //********************************************************
5
6
7
8
9
10
11
12 // KDC's shortest Aniamtion overrider in SL
13 //OKOK i wrote this little script in the hope of less clunky server eating animation overriders that are widely used in sl, this AO is as small as i have been able to do it, and as you can see it is also using very few instructions.
14 //by the way the pulse speed do not affect the time between the animation change
15
16
17
18
19 // KDC's shortest Aniamtion overrider in SL
20 // Copyright (C) 2005 Kyrah Abattoir
21 //
22 // This program is free software; you can redistribute it and/or modify
23 // it under the terms of the GNU General Public License as published by
24 // the Free Software Foundation; either version 2 of the License, or
25 // (at your option) any later version.
26 //
27 // This program is distributed in the hope that it will be useful,
28 // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 // GNU General Public License for more details.
31
32 //there we go...
33 float pulse = 0.01;//the time between each check, adjust it to your liking
34 //bigger == slower == low resources
35
36 //if a state isnt in the list its just ignored, you can add new overriding states here
37 list states = ["Standing","Walking","Hovering","Crouching","Hovering","Jumping","PreJumping","Running","Sitting","Sitting on Ground",
38 "Flying","FlyingSlow","Falling Down","Soft Landing","CrouchWalking"];
39
40 //list of ther anims yo will use instead if the value == pass on, we let the anim play. One anim per state
41 list anims = ["ballet stand","ballet walk 2","ballet foots","ballet foots","ballet foots","ballet foots","ballet foots","ballet foots","ballet foots","ballet foots","ballet foots","ballet foots","ballet foots","ballet foots"];
42 //ok this is filled with MY animations of course you will change it to yours if you want it to work, right?
43
44 string anim_overrided= "";
45 string curr_anim= "";
46 default
47 {
48 attach(key id)
49 {
50 if(id == NULL_KEY && curr_anim != "")//IF detached and an animation is running
51 llStopAnimation(curr_anim);//stop the anim
52 else
54 }
56 {
58 }
60 {
61 llSetTimerEvent(pulse);//we set the main pulse
62 }
63 timer()
64 {
66 if(anim_state == "Turning Left" || anim_state == "Turning Right")//this is a little HACK to remove the turn left and right
67 anim_state = "Standing";
68 integer anim_index = llListFindList(states,[anim_state]);
69 if((anim_index != -1) && (anim_overrided != anim_state))//IF we havent specified this anim must be ignored
70 {
71 anim_overrided = anim_state;
72 //llSetText("",<1,1,1>,1.0);//DEBUG displaying the state
73 if(llList2String(anims,anim_index) == "PASS_ON")
74 {
75 if(curr_anim != "")
76 llStopAnimation(curr_anim);
77 curr_anim = "";
78 }
79 else
80 {
81 string stop_anim = curr_anim;
82 curr_anim = llList2String(anims,anim_index);
83 if(stop_anim != "")
84 llStopAnimation(stop_anim);
85 if(curr_anim != stop_anim)//if its the same anim we already play no need to change it
86 llStartAnimation(curr_anim);
87 if(anim_state == "Walking")//another lil hack so the av turn itself 180 when walking backward
88 llStopAnimation("walk");//comment these 2 lines if you have a real backward animation
89 }
90 }
91 }
92 } // END //

Back to the Best Free Tools in Second Life and OpenSim.