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
Prim Linked_Prim_Animator  

Linked_Prim_Animator

Notes - GNU General Public License

Category: Prim
By : Falados Kapuskas
Created: 2012-09-18 Edited: 2012-09-18
Worlds: Second Life

the Zip file

Download all files for Linked_Prim_Animator
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Linked_Prim_Animator_1.lsl
Get file # 2. Linked_Prim_Animator_2.lsl
Get file # 3. Linked_Prim_Animator_3.lsl
Get file # 4. Linked_Prim_Animator_4.lsl
Get file # 5. Linked_Prim_Animator_5.lsl
Get file # 6. Linked_Prim_Animator_6.lsl
Get file # 7. Linked_Prim_Animator_7.lsl
1 =Linked Prim Animator Lite=
2 By: Falados Kapuskas
3 Date: 12/27/2007
4 Version: 1.07
5
6 First, thank you for choosing Linked Prim Animator Lite (LPAL) for your linked prim animation needs. I'll try my very hardest to make this
7 processes as painless as possible. There are several features you should know about before you begin so here is the run-down.
8
9 ==Features / Limitations ===
10
11 ===Features===
12 1. LPAL is modular - Each LPAL Frame Capture script captures one clearly labeled element of the linked prims.
13 2. LPAL is a dialog-based setup.
14 3. LPAL has protection against lost dialogs
15 4. Only the one LPAL Frame Controller needs to be copied into the linked prims you would like to track
16 5. The LPAL link-message protocol is documented. You may use this to make scripts compatable with LPAL. [LPAL Protocol]
17 6. Since LPAL is Open Source, you can freely modify it to suite your needs. Just make sure you release your chages to the public under the GPL.
18
19 ===Limitations===
20 1. After you have quit the Wizard, it will default to deleting itself. This is to reduce lag. You may use the [Example Script]
21 which is a small portion of the wizard (used exclusively for playback). You simply drag this script into the root and touch the object to begin.
22 2. Resizing the object or otherwise altering it after the animation has been publish will most likely break the animation.
23 3. Second Life has some interpolation (tweening), but it only goes so far. The animations will always look slightly choppy.
24 4. LPA Will only record the quantitys for which you have modules. You may freely make more modules as long as they are also released GPL (Derived Works)
25 5. Although LPAL can handle practically any number of prims and snapshots, the less you use, the smoother the animation will be.
26 6. Prims can only be moved no more than 10 meters from the root prim (This is a SL Limitation)
27
28 ==Setup==
29
30 ===Quick Start ===
31 1. Put the following scripts in your root prim.
32 LPAL Editor
33 LPAL Player
34 LPAL Wizard
35 every LPA Frame Capture script you want (At least 1)
36 2. Put the following in all child prims
37 LPAL Frame Controller (<<TYPE>>)
38 3. Chat the following:
39 /55 lpa_wizard
40 4. Follow the Capture Dialog
41 5. Move child prims around and press Capture to save the
42 6. Press [Done] on the capture dialog when you are finished editing
43 7. Use the player wizard to play back your animation
44 8. When done, press Quit
45 9. To play the animation back later, use a script to send link messages using the LPA Protocol
46
47 ??
48
49 See the information about the Capture and Playback stages for more detailed information.
50
51 ===Verbose Setup===
52
53 First, you must start off with some sculpture you wish to animate. In each child prim, place one LPA Frame Controller script.
54 In the Root Prim, place all the setup scripts and as many modules as you'd like to track.
55 These scripts are mandatory:
56 LPAL Player
57 LPAL Wizard
58 LPAL Editor
59 You may include one or more (or all) of these scripts:
60 LPAL Frame Capture (<<TYPE>>)
61
62 If you wish to record other quantities, use the [LPAL Template]
63 and fill in the blanks with your code.
64
65 Once you have set up your model with these scripts, you are ready for editing.
66 Type this to begin: /55 lpa_wizard
67
68 You should now be getting some messages alerting you to the status of the setup. There should be
69 a percentage that increases over time. Each prim that you have dropped an LPA Frame Controller script into will be
70 loaded with all the LPAL Frame Capture modules you put in the Root Prim.
71
72 ==Capture Stage==
73
74 After the setup is completed, you should be presented with a dialog. As with almost any dialog, if lose it, just type /55 lpa_lost to get it back. You should notice there are several options.
75 ------------------------------------------------------------------------------------------------------------------------
76 Buttons What they do
77 ------------------------------------------------------------------------------------------------------------------------
78 << Go back 1 frame
79 >> Go forward 1 frame
80 Capture Frame Record the state of the prims and go to the next frame
81 Origin Copy the prim attributes at frame 0 to the current frame
82 Done Finish the animation (Clean up, and go to playback)
83
84
85 ==Playback Stage==
86 This wizard has a playback stage where you can see your creation come to life.
87
88 ------------------------------------------------------------------------------------------------------------------------
89 Buttons What they do
90 ------------------------------------------------------------------------------------------------------------------------
91 Play Play the animation between the range (Defaults to all frames)
92 Pause Stop the animation
93 Backward Play Direction is set in reverse
94 Forward Play direction is set forward
95 Speed Up Decrease the frame time interval by .1 seconds (To a minimum of .2 seconds)
96 Speed Down Increase the frame time interval by .1 seconds
97 Quit Finish playing back (Kill the wizard)
98
99 ==Lost Dialogs==
100
101 This has been mentioned before, but if, for whatever reason, you lose a dialog either by accidentally ignoreing it or through some other fluke, you can always get it back by typing /55 lpa_lost
102
103 ==Copyleft==
104 LPAL is free software: you can redistribute it and/or modify
105 it under the terms of the GNU General Public License as published by
106 the Free Software Foundation, either version 3 of the License, or
107 (at your option) any later version.
108
109 LPAL is distributed in the hope that it will be useful,
110 but WITHOUT ANY WARRANTY; without even the implied warranty of
111 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
112 GNU General Public License for more details. [Copying]

Linked_Prim_Animator

LPA Protocol

Category: Prim
By : Falados Kapuskas
Created: 2012-09-18 Edited: 2012-09-18
Worlds: Second Life

1 // ID STRING NUM Description
2 // loader SCRIPT_NAME LINK_NUM Tells SCRIPT_NAME (which is a recording modules) to load itself into LINK_NUM
3 // root
4 // ACK Respond to children (They send SYN)
5 // end Tell child scripts to discard unused scripts
6 // playback MAX_FRAMES Tell the LPA Player script to enter the playback state
7 // cap FRAME Tells the children to capture their current state and save it in FRAME
8 // ff FRAME Tells the children to go forward to the FRAME
9 // rwd FRAME Tells the children to go backwards to the FRAME
10 // reset FRAME Tell sthe children to reset their state to FRAME
11 // setup Start the setup in child module
12 // link
13 // <CSV of all scripts> 1 Tell the LPA Editor what scripts this object has
14 // SYN 0 Try to syncronize with the LPA Editor script
15 // MODULENUM Announces the number of record modules currently in the linked prim (send_num used as ID)
16 // wizard
17 // lpa_back Tell LPA Player to play animations backward (Reverse)
18 // lpa_brang off Tell LPA Player to play looped animations normally (Loops wrap around)
19 // lpa_brang on Tell LPA Player to play animations in Boomerange mode (Back and Forth)
20 // lpa_capture FRAME Tell LPA Editor to capture the current state in FRAME
21 // lpa_done Tell LPA Editor to end the capture stage and clean up
22 // lpa_ff Tell LPA Editor to set all prims forward one frame
23 // lpa_fwd Tell LPA Player to play animations forward (Normal)
24
25 // lpa_loop off Tell LPA Player to stop animations after they finish (No Loop)
26 // lpa_loop on Tell LPA Player to loop animations
27 // lpa_rwd Tell LPA Editor to set all prims back one frame
28 // lpa_sdn Tell LPA Player to remove .1 seconds from the wait time between frames (Faster)
29 // lpa_start Tell LPA Player to start the animation with the current parameters
30 // lpa_stop Tell LPA Player to stop the current animation
31 // lpa_sup Tell LPA Player to add .1 seconds to the wait time between frames (Slower)
32 // setup Tell LPA Editor to go into setup mode
33 // player
34 // brang BOOMERANG Announcement of the BOOMERANG status (TRUE or FALSE)
35 // direction DIRECTION Announcement of the playback direction (1 = Forward, -1 = Backward)
36 // frame FRAME Tell all children to set their state to FRAME
37 // loop LOOP Announcement of the LOOP status (TRUE or FALSE)
38 // play SPEED Announcement of the playback SPEED (in tenths of a second)

Linked_Prim_Animator

Example replay Script

Category: Prim
By : Falados Kapuskas
Created: 2012-09-18 Edited: 2012-09-18
Worlds: Second Life

1 // This file is part of Linked Prim Animator Lite (LPAL).
2 //
3 // LPAL is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // LPAL is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with LPAL. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // Linked Prim Animator Lite - Replay Script
17 // Author: Falados Kapuskas
18 // Version: 0.2
19 // Date: 12/03/2007
20 // Description:
21 // Example replay script
22
23 //Channel for chatting
24 integer BOOMERANG_STATUS = FALSE;
25 integer LOOP_STATUS = TRUE;
26 integer OPERATION_CHANNEL = 55;
27 //Owner Key
28 key owner;
29
30 //This is a very basic script that shows how to use the LPA Protocol in
31 //Custom scripts for custom playback
32 default
33 {
36 {
37 owner = llGetOwner();
38 }
40 {
41 if(llDetectedKey(0) == owner) {
42 state testing;
43 }
44 }
45 }
46
47 state testing_loop { state_entry() { state testing; } }
48 state testing {
49 state_entry() {
50 list btn = ["Quit","Play","Pause","Backwards","Forwards","Speed Up","Speed Down"];
51 if(BOOMERANG_STATUS) btn += ["[X] Boomerang"];
52 else btn += ["[ ] Boomerang"];
53 if(LOOP_STATUS) btn += ["[X] Loop"];
54 else btn += ["[ ] Loop"];
55 llDialog(owner,"Play your animation...",btn,-56);
56 llListen( -56, "", owner, "");
57 llListen( OPERATION_CHANNEL, "", owner, "lpa_lost");
58 }
59 listen( integer channel, string name, key id, string msg ) {
60 if( msg == "lpa_lost") {state testing_loop;};
61 if( msg == "Play" ) {
62 llMessageLinked(LINK_THIS, 0, "lpa_start", "wizard");
63 }
64 if( msg == "Pause" ) {
65 llMessageLinked(LINK_THIS, 0, "lpa_stop", "wizard");
66 }
67 if( msg == "Backwards" ) {
68 llMessageLinked(LINK_THIS, 0, "lpa_back", "wizard");
69 }
70 if( msg == "Forwards" ) {
71 llMessageLinked(LINK_THIS, 0, "lpa_fwd", "wizard");
72 }
73 if( msg == "Speed Up" ) {
74 llMessageLinked(LINK_THIS, 0, "lpa_sdn", "wizard");
75 }
76 if( msg == "Speed Down" ) {
77 llMessageLinked(LINK_THIS, 0, "lpa_sup", "wizard");
78 }
79 if( msg == "[X] Boomerang" || msg == "[ ] Boomerang" ) {
80 string b = "lpa_brang";
81 BOOMERANG_STATUS = !BOOMERANG_STATUS;
82 if(BOOMERANG_STATUS) b += " on";
83 else b += " off";
84 llMessageLinked(LINK_THIS, 0, b, "wizard");
85 }
86 if( msg == "[X] Loop" || msg == "[ ] Loop" ) {
87 string b = "lpa_loop";
88 LOOP_STATUS = !LOOP_STATUS;
89 if(LOOP_STATUS) b += " on";
90 else b += " off";
91 llMessageLinked(LINK_THIS, 0, b, "wizard");
92 }
93 if( msg == "Quit" ) {
94 state default;
95 }
96 state testing_loop;
97 }
98 }

Linked_Prim_Animator

LPA Editor

Category: Prim
By : Falados Kapuskas
Created: 2012-09-18 Edited: 2012-09-18
Worlds: Second Life

1 // This file is part of Linked Prim Animator Lite (LPAL).
2 //
3 // LPAL is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // LPAL is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with LPAL. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // Linked Prim Animator Lite - Editor Ltd
17 // Author: Falados Kapuskas
18 // Version: 0.6
19 // Date: 12/27/2007
20 // Description:
21 // Controls all operations of the Linked-Prim animator during the setup and snapshot phase.
22
23 //----- CONSTANT VALUES -----//
24 string MODULE_PREFIX = "LPAL Frame Capture"; //All loadable modules are prefixed with this
25 integer SCRIPT_PIN = 3014; //To load scripts on other prims, this should be set the same
26 integer OPERATION_CHANNEL = 55; //Channel for which all chat commands are announced
27
28 //GLOBAL VARIABLES
29 integer link_len = 0;
30 integer link_i = 0;
31 integer link_scripts = 0;
32 key owner; //Key of the owner is stored in this script
33 integer frame; //Current animation frame stored here
34 integer max_frames; //The last frame in the recorded animation sequence
35 list animators = []; //These are the link numbers which responded to the initial setup query
36 list ex = []; //When loading scripts, exclude these modules (Usually a parameter to a function)
37 list mods = []; //List of all modules to be loaded into linked prims (Populated via function)
38
39 //----- Functions -----//
40
41 //Function: ERROR
42 //Description: Say an error on the debug channel
43 ERROR(string mystate , string msg) {
44 llSay(DEBUG_CHANNEL, llGetScriptName() + ": state " + mystate + " - " + msg);
45 }
46
47
48 //Function: find_modules
49 //Description: Finds the scripts in (this object's) inventory
50 // that match the MODULES_PREFIX prefix in their name
51 find_modules() {
52 integer i;
54 string name;
55 for( i = 0; i < invs; ++i){
58 {
59 if( llSubStringIndex(name,MODULE_PREFIX) == 0 ) {
60 mods += name;
61 }
62 }
63 }
64
65 }
66
67 //Function: give_scripts
68 //Description: Gives scripts to the linked primitive (num),
69 // excluding those scripts listed in exclude
70 give_scripts(integer num,list exclude) {
71 integer i;
72 integer len = llGetListLength( mods );
73 integer len2 = llGetListLength(exclude);
74 string name;
75 link_scripts = 0;
76 for( i = 0; i < len; ++i) {
77 name = llList2String( mods , i );
78 if( len2 == 0 || llListFindList( exclude , [name] ) == -1 ) {
79 llMessageLinked( LINK_THIS , num , name , "loader" );
80 ++link_scripts;
81 }
82 }
83 }
84
85 //Function: uncheck_scripts
86 //Description: Makes sure the modules in this object are not running
87 uncheck_scripts() {
88 //Make sure the Root's collector scripts are OFF
89 integer i;
90 integer len = llGetListLength( mods );
91 string name;
92 for( i = 0; i < len; ++i ) {
93 name = llList2String( mods, i);
95 llSetScriptState( name , FALSE );
96 }
97 }
98 }
99
100 //Function: remove_scripts
101 //Description: Removes all uneeded scripts after this object is done with the setup
102 remove_scripts() {
103 //Make sure the Root's collector scripts are OFF
104 integer i;
105 integer len = llGetListLength( mods );
106 string name;
107 for( i = 0; i < len; ++i ) {
108 name = llList2String( mods, i);
111 }
112 }
113 }
114
115 //Function: process_command
116 //Description: Will process a command and return TRUE or FALSE
117 // Upon success and failure. Return value of 2 indicates
118 // lpa_done message (Move on to next state)
119 integer process_command(string message,integer num) {
120 //Tell children to record their status
121 if( message == "lpa_capture" )
122 {
123 llMessageLinked( LINK_SET , frame , "cap", "root");
124 ++frame;
125 return TRUE;
126 }
127 if( message == "lpa_rwd" )
128 {
129 --frame;
130 if( frame < 0) frame = 0;
131 llMessageLinked( LINK_SET , frame , "rwd", "root");
132 return TRUE;
133 }
134 if( message == "lpa_ff" )
135 {
136 ++frame;
137 llMessageLinked( LINK_SET , frame , "ff", "root");
138 return TRUE;
139 }
140 if( message == "lpa_reset" )
141 {
142 llMessageLinked( LINK_SET , frame , "reset", "root");
143 return TRUE;
144 }
145 if( message == "lpa_done" )
146 {
147 max_frames = frame;
148 llMessageLinked( LINK_SET , frame , "pb", "root");
149 return 2;
150 }
151 return FALSE;
152 }
153
154
155 default
156 {
158 {
159 owner = llGetOwner();
160 }
161
162 on_rez(integer param) {llResetScript();}
163
164 //For Wizard
165 link_message( integer send_number, integer num, string str, key id)
166 {
167 if( id == "wizard" && str == "setup" ) {
168 state setup;
169 }
170 }
171 }
172
173 state setup
174 {
176 {
177 find_modules();
178 //Timeout for responses
179 llSetTimerEvent( 4.0 );
180 llMessageLinked( LINK_SET , 0 , "setup", "root");
181 llOwnerSay("Setup Initiating...");
182 }
183
184 link_message( integer send_number, integer num, string str, key id)
185 {
186 if( str == "SYN")
187 {
188 llMessageLinked( send_number , 0 , "ACK", "root");
189 llSetTimerEvent( 4.0 );
190 if( llListFindList( animators , [send_number]) == -1)
191 animators += send_number;
192 }
193 }
194 timer()
195 {
196 llOwnerSay("Distributing Recording Scripts...");
197 llSetTimerEvent(0.0);
198 link_i = 0;
199 link_len = llGetListLength(animators);
200 state seed_links;
201 }
202 }
203
204 state seed_links_loop {
206 {
207 ++link_i;
208 integer percent = (integer)((float)(link_i)/(float)link_len * 100.0);
209 llOwnerSay((string)percent + "% Done");
210 state seed_links;
211 }
212 }
213 state seed_links {
215 {
216 if( link_i >= link_len ) {
217 llOwnerSay("Setup Complete.");
218 llMessageLinked( LINK_SET , 0 , "end", "root");
219 state record;
220 }
221 give_scripts(llList2Integer(animators,link_i),[]);
222 }
223 link_message( integer send_num , integer num, string str, key id) {
224 if( num == link_scripts && send_num == llList2Integer(animators,link_i) ) { state seed_links_loop; }
225 }
226 }
227
228 //
229 state record {
230 state_entry() {
231 frame = 0;
232 uncheck_scripts();
233 }
234 //For Wizard
235 link_message( integer send_number, integer num, string str, key id) {
236 integer r;
237 if( id == "wizard" ) {
238 r = process_command(str,num);
239 if(r == 2) {
240 llMessageLinked( LINK_THIS , max_frames , "playback" , "root");
241 state playback;
242 }
243 if(!r) ERROR("record","Unknown command " + str + " from wizard");
244 }
245 }
246 }
247
248 //Once the setup processes goes into playback mode, this script is no longer needed
249 state playback {
250 state_entry() {
251 remove_scripts();
252 llSleep( 5.0 );
254 }
255 }

Linked_Prim_Animator

LPA Player

Category: Prim
By : Falados Kapuskas
Created: 2012-09-18 Edited: 2012-09-18
Worlds: Second Life

1 // This file is part of Linked Prim Animator Lite (LPAL).
2 //
3 // LPAL is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // LPAL is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with LPAL. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // Linked Prim Animator Lite - Player
17 // Author: Falados Kapuskas
18 // Version: 0.5
19 // Date: 12/09/2007
20 // Description:
21 // Controls playback of pre-recorded animation
22
23 //CONSTANT VALUES
24 integer OPERATION_CHANNEL = 55; //Channel for which all chat commands are announced
25 float PLAYBACK_SPEED = 0.5; //Delay time between frames
26
27 //GLOBAL VARIABLES
28 integer frame; //Current frame
29 integer max_frames; //Last frame
30 integer direction; //Animation play direction
31 integer brang = FALSE; //Boomerange loop (Back and forth)
32 integer loop = TRUE; //Loop animation
33 float CURRENT_PLAYBACK; //Current playback speed
34 integer listen_handle; //Handle to listen id
35 key owner; //Owner of the object
36
37
38
39 //Function: process_command
40 //Description: Will process a command and return the frame that
41 // the playback speed
42 float process_command(string msg) {
43 if( msg == "lpa_back" ) {
44 if( direction != -1) {
45 direction = -1;
46 llMessageLinked( LINK_THIS , direction , "direction" , "player");
47 return CURRENT_PLAYBACK;
48 }
49 }
50 if( msg == "lpa_sup" ) {
51 PLAYBACK_SPEED += 0.1;
52 llMessageLinked( LINK_THIS , (integer)(PLAYBACK_SPEED*10) , "play" , "player");
53 return PLAYBACK_SPEED;
54 }
55 if( msg == "lpa_sdn" ) {
56 PLAYBACK_SPEED -= 0.1;
57 if( PLAYBACK_SPEED <= 0.2 ) {
58 PLAYBACK_SPEED = 0.2;
59 }
60 llMessageLinked( LINK_THIS , (integer)(PLAYBACK_SPEED*10) , "play" , "player");
61 return PLAYBACK_SPEED;
62 }
63 if( msg == "lpa_fwd" ) {
64 if( direction != 1) {
65 direction = 1;
66 llMessageLinked( LINK_THIS , direction , "direction" , "player");
67 return CURRENT_PLAYBACK;
68 }
69 }
70 if( msg == "lpa_stop" ) {
71 llMessageLinked( LINK_THIS , 0 , "play" , "player");
72 return 0.0;
73 }
74 if( msg == "lpa_brang on" ) {
75 brang = TRUE;
76 llMessageLinked( LINK_THIS , brang , "brang" , "player");
77 return CURRENT_PLAYBACK;
78 }
79 if( msg == "lpa_brang off" ) {
80 brang = FALSE;
81 llMessageLinked( LINK_THIS , brang , "brang" , "player");
82 return CURRENT_PLAYBACK;
83 }
84 if( msg == "lpa_loop on" ) {
85 loop = TRUE;
86 llMessageLinked( LINK_THIS , loop , "loop" , "player");
87 return CURRENT_PLAYBACK;
88 }
89 if( msg == "lpa_loop off" ) {
90 loop = FALSE;
91 llMessageLinked( LINK_THIS , loop , "loop" , "player");
92 return CURRENT_PLAYBACK;
93 }
94 if( msg == "lpa_start" ) {
95 frame = 0;
96 llMessageLinked( LINK_THIS , (integer)(PLAYBACK_SPEED*10) , "play" , "player");
97 return PLAYBACK_SPEED;
98 }
99 return CURRENT_PLAYBACK;
100 }
101
102 default {
103 on_rez(integer param) { llResetScript(); }
104 state_entry() {
105 owner = llGetOwner();
106 }
107
108 link_message(integer send_num, integer num, string str, key id) {
109 if(id == "root")
110 {
111 if( str == "playback")
112 {
113 max_frames = num;
114 state playback;
115 }
116 }
117 }
118 }
119
120 state playback {
121 state_entry() {
122 direction = 1;
123 llSetTimerEvent(0.0);
124 }
125
126 on_rez( integer parm ) {
127 llSetTimerEvent(CURRENT_PLAYBACK);
128 }
129
130 //For Wizard
131 link_message( integer send_number, integer num, string str, key id) {
132 if( id == "wizard" ) {
133 CURRENT_PLAYBACK = process_command(str);
134 llSetTimerEvent(CURRENT_PLAYBACK);
135 }
136 }
137
138 timer() {
139 llSetTimerEvent( PLAYBACK_SPEED );
140 frame += direction;
141 if( frame > max_frames ) {
142 frame = max_frames;
143 if(!loop) {
144 if(!brang || direction == -1) llSetTimerEvent(0.0);
145 }
146 if(brang) direction *= -1;
147 else if(loop) frame = 0;
148 }
149 if( frame < 0 ) {
150 frame = 0;
151 if(!loop) {
152 if(!brang || direction == -1) llSetTimerEvent(0.0);
153 }
154 if(brang) direction *= -1;
155 else if(loop) frame = max_frames;
156 }
157 llMessageLinked( LINK_SET , frame , "frame", "player");
158 }
159 }

Linked_Prim_Animator

LPA Wizard

Category: Prim
By : Falados Kapuskas
Created: 2012-09-18 Edited: 2012-09-18
Worlds: Second Life

1 // This file is part of Linked Prim Animator Lite (LPAL).
2 //
3 // LPAL is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // LPAL is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with LPAL. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // Linked Prim Animator Lite - Wizard
17 // Author: Falados Kapuskas
18 // Version: 0.7
19 // Date: 12/20/2007
20 // Description:
21 // Dialog-based setup control script
22
23 //----- CONSTANT VALUES -----//
24 integer OPERATION_CHANNEL = 55;
25 integer BOOMERANG_STATUS = FALSE;
26 integer LOOP_STATUS = TRUE;
27 //GLOBAL VALUES
28 integer frame;
29 key owner;
30
31 default
32 {
33 on_rez(integer param) {
35 }
36 state_entry() {
37 frame = 0;
38 owner = llGetOwner();
39 llListen( OPERATION_CHANNEL, "" , owner , "lpa_wizard");
40 }
41 listen( integer channel, string name, key id, string msg ) {
42 if( msg == "lpa_wizard" ) {
43 state start;
44 }
45 }
46 }
47
48 state start {
49 state_entry() {
50 llOwnerSay("Sending LPA Setup code");
51 llMessageLinked(LINK_THIS, 0, "setup", "wizard");
52 }
53 link_message( integer send_num, integer num, string str, key id) {
54 if( str == "end" && id == "root") {
55 frame = 0;
56 state capture;
57 }
58 }
59 }
60
61 state capture_loop { state_entry() { state capture; } }
62 state capture {
63 state_entry() {
64 list btn = ["<<","Capture Frame",">>","Origin","Done"];
65 llDialog(owner,"Frame " + (string)frame + "\nSelect an option...",btn,-56);
66 llListen(-56, "", owner, "");
67 llListen(55,"",owner,"lpa_lost");
68 }
69 listen( integer channel, string name, key id, string msg ) {
70 if( msg == "lpa_lost" ) { state capture_loop; }
71 if( msg == "Capture Frame" ) {
72 ++frame;
73 llMessageLinked(LINK_THIS, 0, "lpa_capture", "wizard");
74 }
75 if( msg == "<<" ) {
76 --frame;
77 llMessageLinked(LINK_THIS, 0, "lpa_rwd", "wizard");
78 }
79 if( msg == ">>" ) {
80 ++frame;
81 llMessageLinked(LINK_THIS, 0, "lpa_ff", "wizard");
82 }
83 if( msg == "Done" ) {
84 llMessageLinked(LINK_THIS, 0, "lpa_done", "wizard");
85 state testing;
86 }
87 if( msg == "Origin" ) {
88 llMessageLinked(LINK_THIS, 0, "lpa_reset", "wizard");
89 }
90 state capture_loop;
91 }
92 link_message( integer send_num, integer num, string str, key id) {
93 if( id == "root" ) {
94 if(str == "cap" || str == "rwd" || str == "ff" || str == "reset" )
95 {
96 frame = num;
97 }
98 }
99 }
100 }
101
102 state testing_loop { state_entry() { state testing; } }
103 state testing {
104 state_entry() {
105 list btn = ["Quit","Play","Pause","Backwards","Forwards","Speed Up","Speed Down"];
106 if(BOOMERANG_STATUS) btn += ["[X] Boomerang"];
107 else btn += ["[ ] Boomerang"];
108 if(LOOP_STATUS) btn += ["[X] Loop"];
109 else btn += ["[ ] Loop"];
110 llDialog(owner,"Play your animation...",btn,-56);
111 llListen( -56, "", owner, "");
112 llListen( OPERATION_CHANNEL, "", owner, "lpa_lost");
113 }
114 listen( integer channel, string name, key id, string msg ) {
115 if( msg == "lpa_lost") {state testing_loop;};
116 if( msg == "Play" ) {
117 llMessageLinked(LINK_THIS, 0, "lpa_start", "wizard");
118 }
119 if( msg == "Pause" ) {
120 llMessageLinked(LINK_THIS, 0, "lpa_stop", "wizard");
121 }
122 if( msg == "Backwards" ) {
123 llMessageLinked(LINK_THIS, 0, "lpa_back", "wizard");
124 }
125 if( msg == "Forwards" ) {
126 llMessageLinked(LINK_THIS, 0, "lpa_fwd", "wizard");
127 }
128 if( msg == "Speed Up" ) {
129 llMessageLinked(LINK_THIS, 0, "lpa_sdn", "wizard");
130 }
131 if( msg == "Speed Down" ) {
132 llMessageLinked(LINK_THIS, 0, "lpa_sup", "wizard");
133 }
134 if( msg == "[X] Boomerang" || msg == "[ ] Boomerang" ) {
135 string b = "lpa_brang";
136 BOOMERANG_STATUS = !BOOMERANG_STATUS;
137 if(BOOMERANG_STATUS) b += " on";
138 else b += " off";
139 llMessageLinked(LINK_THIS, 0, b, "wizard");
140 }
141 if( msg == "[X] Loop" || msg == "[ ] Loop" ) {
142 string b = "lpa_loop";
143 LOOP_STATUS = !LOOP_STATUS;
144 if(LOOP_STATUS) b += " on";
145 else b += " off";
146 llMessageLinked(LINK_THIS, 0, b, "wizard");
147 }
148 if( msg == "Quit" ) {
149 state die;
150 }
151 state testing_loop;
152 }
153 link_message( integer send_num, integer num, string str, key id) {
154 if(id == "player") {
155 if(str == "frame") {
156 frame = num;
157 }
158 if(str == "brang") {
159 BOOMERANG_STATUS = num;
160 }
161 if(str == "loop") {
162 LOOP_STATUS = num;
163 }
164 }
165 }
166 }
167
168 state die {
169 state_entry() {
171 }
172 }

Linked_Prim_Animator

LPA Frame Controller

Category: Prim
By : Falados Kapuskas
Created: 2012-09-18 Edited: 2012-09-18
Worlds: Second Life

1 // This file is part of Linked Prim Animator Lite (LPAL).
2 //
3 // LPAL is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // LPAL is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with LPAL. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // Linked Prim Animator Lite - Frame Controller
17 // Author: Falados Kapuskas
18 // Version: 0.7
19 // Date: 12/27/2007
20 // Description:
21 // Sets up linked prims for accepting modules
22
23 //----- CONSTANTS -----//
24 integer SCRIPT_PIN = 3014; //This pin is set on the prim
25 string MODULE_PREFIX = "LPAL Frame Capture";
26
27 //----- GLOBAL VARIABLES -----//
28 string scripts; //During resume, the existing scripts are recorded here
29
30 default
31 {
32 on_rez(integer param) {llResetScript(); }
34 link_message( integer sender_num, integer num, string str, key id )
35 {
36 if( id == "root") {
37 if( str == "setup") {
38 //Respond to the setup request
40 llMessageLinked( LINK_ROOT , 0 , "SYN", "link");
41 llSetTimerEvent(5.0);
42 }
43 if( str == "ACK" ) {
44 //Response received! Accept scripts.
45 llSetTimerEvent(0.0);
46 state receive;
47 }
48 }
49 }
50 timer() { //Keep trying until a response is heard
51 llMessageLinked( LINK_ROOT , 0 , "SYN", "link");
52 llSetTimerEvent(5.0);
53 }
54 }
55
56 state receive {
57 changed(integer change) {
58 if( change & CHANGED_INVENTORY ) {
60 integer i;
61 integer num = 0;
62 for( i = 0; i < len; ++i) {
63 if( llSubStringIndex(llGetInventoryName(INVENTORY_SCRIPT,i),MODULE_PREFIX) != -1 ) ++num;
64 }
65 llMessageLinked(LINK_ROOT,num,"","link");
66 }
67 }
68 link_message( integer sender_num, integer num, string str, key id )
69 {
70 if( id == "root" && str == "end") {
73 }
74 }
75 }

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