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 Puppeteer  

Puppeteer

[K] Puppeteer Animator

Category: Prim
By : Kira Komarov
Created: 2012-03-24 Edited: 2012-03-24
Worlds: Second Life

the Zip file

Download all files for Puppeteer
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Puppeteer_1.lsl
Get file # 2. Puppeteer_2.lsl
1 // How it Works// The puppeteer works in the following way:// 1.) You drop the [K] Puppeteer Recorder in a prim you wish to create an animation for.// 2.) You move / rotate the prim to the next position and at each step, you touch the prim and select "â—† Mark â—†".// 3.) Once you have marked several positions, you touch the puppeteer recorder and select "â—† Dump â—†". This will dump all the recoded data on the local chat and it would look something like this:// Object: ------------- BEGIN CUT -------------
2 // Object: #<57.401940, 113.362300, 1001.491000>#<56.057780, 113.362300, 1001.491000>#<56.057780, 113.362300, 1002.707000>#<56.649890, 113.362300, 1002.707000>#<56.649890, 113.362300, 1003.624000>#<55.782050, 113.362300, 1003.624000>#
3 // Object: [K]
4 // Object: #<0.000000, 0.000000, 0.000000, 1.000000>#<0.000000, 0.000000, 0.000000, 1.000000>#<0.000000, 0.000000, 0.000000, 1.000000>#<0.000000, 0.000000, 0.000000, 1.000000>#<0.000000, 0.000000, 0.000000, 1.000000>#<0.000000, 0.000000, 0.000000, 1.000000>#
5 // Object: -------------- END CUT --------------
6 // 4.) Now you need to clean it up a little bit to delete the object name (in this case "Object: ") from the data as well as the cut lines. After the cleaning, based on the previous example, the data should look like this:
7 // #<57.401940, 113.362300, 1001.491000>#<56.057780, 113.362300, 1001.491000>#<56.057780, 113.362300, 1002.707000>#<56.649890, 113.362300, 1002.707000>#<56.649890, 113.362300, 1003.624000>#<55.782050, 113.362300, 1003.624000>#
8 // [K]
9 // #<0.000000, 0.000000, 0.000000, 1.000000>#<0.000000, 0.000000, 0.000000, 1.000000>#<0.000000, 0.000000, 0.000000, 1.000000>#<0.000000, 0.000000, 0.000000, 1.000000>#<0.000000, 0.000000, 0.000000, 1.000000>#<0.000000, 0.000000, 0.000000, 1.000000>#
10 // 5.) Now, you take that cleaned data, and save it in a notecard called Puppet.
11 // 6.) You delete the puppeteer recorder script from the prim and add the notecard Puppet with the data you just cleaned.
12 // 7.) Finally you add the [K] Puppeteer Animator script in the prim along with the notecard and the prim will start executing each step.
13
14 // Here is the [K] Puppeteer Recorder script:
15
16 //////////////////////////////////////////////////////////
17 // PUPPETEER RECORDER //
18 //////////////////////////////////////////////////////////
19 // Gremlin: Puppeteer Recorder, see Puppeteer Animator
20 //////////////////////////////////////////////////////////
21 // [K] Kira Komarov - 2011, License: GPLv3 //
22 // Please see: http://www.gnu.org/licenses/gpl.html //
23 // for legal details, rights of fair usage and //
24 // the disclaimer and warranty conditions. //
25 //////////////////////////////////////////////////////////
26
27 list pos = [];
28 list rot = [];
29
30 integer comChannel;
31 integer comHandle;
32
33 default
34 {
35 touch_start(integer total_number)
36 {
37 comChannel = ((integer)("0x"+llGetSubString((string)llGetOwner(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF;
38 comHandle = llListen(comChannel, "", llGetOwner(), "");
39 llDialog(llGetOwner(), "\nWelcome to the Puppeteer:\n\n1.) â—† Mark â—† is for recording each step. Move/Rotate the prim and press â—† Mark â—† to record that position.\n2.) Use â—† Wipe â—† if you want to delete all existing recoded data.\n3.) Use â—† Dump â—† after you have recoded several steps.\n4.) â—† Undo â—† lets you delete the previous step. This works multiple times.\n5.) â—† Preview â—† will allow you to watch the animation before dumping the data.\n",
40 [ "â—† Mark â—†", "â—† Wipe â—†", "â—† Dump â—†", "â—† Undo â—†", "â—† Preview â—†" ], comChannel);
41 }
42
43 listen(integer channel, string name, key id, string message) {
44 if(message == "â—† Mark â—†") {
45 pos += (list)llGetLocalPos();
46 rot += (list)llGetLocalRot();
47 llOwnerSay("--MARK--");
48 jump close;
49 }
50 if(message == "â—† Dump â—†") {
51 if(llGetListLength(pos) == 0) {
52 llOwnerSay("Sorry, you need to first record steps before dumping the data.");
53 jump close;
54 }
55 llOwnerSay("------------- BEGIN CUT -------------");
56 integer itra;
57 string pLine;
58 integer mLine;
59 for(itra=0, mLine=0; itra<llGetListLength(pos); itra++) {
60 if(llStringLength(pLine) + llStringLength(llList2String(pos, itra)) < 254) {
61 pLine += (llList2String(pos, itra) + "#");
62 jump continue_p;
63 }
64 llOwnerSay("#" + pLine);
65 pLine = "";
66 mLine = 1;
67 @continue_p;
68 }
69 if(!mLine) llOwnerSay("#" + pLine);
70 llOwnerSay("[K]");
71 string rLine;
72 for(itra=0, mLine=0; itra<llGetListLength(rot); itra++) {
73 if(llStringLength(rLine) + llStringLength(llList2String(rot, itra)) < 254) {
74 rLine += (llList2String(rot, itra)+ "#");
75 jump continue_r;
76 }
77 llOwnerSay("#" + rLine);
78 rLine = "";
79 mLine = 1;
80 @continue_r;
81 }
82 if(!mLine) llOwnerSay("#" + rLine);
83 llOwnerSay("-------------- END CUT --------------");
84 jump close;
85 }
86 if(message == "â—† Wipe â—†") {
87 pos = [];
88 rot = [];
89 llOwnerSay("All recorded steps have been wiped.");
90 jump close;
91 }
92 if(message == "â—† Undo â—†") {
93 if(llGetListLength(pos) == 0) {
94 llOwnerSay("No more steps left to undo.");
95 jump close;
96 }
97 vector rPos = llList2Vector(pos, llGetListLength(pos)-1);
98 pos = llDeleteSubList(pos, llGetListLength(pos)-1, llGetListLength(pos)-1);
99 rotation rRot = llList2Rot(rot, llGetListLength(rot)-1);
100 rot = llDeleteSubList(rot, llGetListLength(rot)-1, llGetListLength(rot)-1);
101 llSetPos(rPos);
102 llSetLocalRot(rRot);
103 jump close;
104 }
105 if(message == "â—† Preview â—†") {
106 llOwnerSay("Animation will run once and then stop.");
107 state puppet;
108 }
109 @close;
110 llListenRemove(comHandle);
111 }
112 }
113
114 state puppet {
115 state_entry() {
116 integer itra;
117 for(itra=0; itra<llGetListLength(pos); itra++) {
118 llSetPos(llList2Vector(pos, itra));
119 llSetLocalRot(llList2Rot(rot, itra));
120 }
121 llOwnerSay("Animation done, resuming normal operation.");
122 state default;
123 }
124 }

Puppeteer

[K] Puppeteer Animator

Category: Prim
By : Kira Komarov
Created: 2012-03-24 Edited: 2012-03-24
Worlds: Second Life

1 //////////////////////////////////////////////////////////
2 // PUPPETEER ANIMATOR //
3 //////////////////////////////////////////////////////////
4 // Gremlin: Puppeteer Animator, see Puppeteer Recorder
5 //////////////////////////////////////////////////////////
6 // [K] Kira Komarov - 2011, License: GPLv3 //
7 // Please see: http://www.gnu.org/licenses/gpl.html //
8 // for legal details, rights of fair usage and //
9 // the disclaimer and warranty conditions. //
10 //////////////////////////////////////////////////////////
11
12 string pupData;
13 key pQuery;
14
15 integer nDone = 0;
16 integer itra = 0;
17
18 init() {
19 for(itra=0; itra<llGetInventoryNumber(INVENTORY_NOTECARD); ++itra) {
20 if(llGetInventoryName(INVENTORY_NOTECARD, itra) == "Puppet")
21 jump found_puppet;
22 }
23 llOwnerSay("No puppet found, please load the notecard.");
24 return;
25 @found_puppet;
26 itra = 0;
27 pQuery = llGetNotecardLine("Puppet", itra);
29 }
30
31 default
32 {
33 state_entry() {
34 init();
35 }
36 on_rez(integer num) {
37 init();
38 }
39 changed(integer change) {
40 init();
41 }
42
43 dataserver(key query_id,string data) {
44 if(query_id != pQuery) return;
45 if(data == EOF) {
46 nDone = 1;
47 return;
48 }
49 pupData += data;
50 pQuery = llGetNotecardLine("Puppet", ++itra);
51 }
52 timer() {
53 if(!nDone) return;
55 state puppet;
56 }
57 }
58
59 state puppet {
60 state_entry() {
61 list tPup = llParseString2List(pupData, ["[K]"], [""]);
62 pupData = "";
63 list pos = llParseString2List(llList2String(tPup, 0), ["#"], [""]);
64 list rot = llParseString2List(llList2String(tPup, 1), ["#"], [""]);
65 @cycle;
66 for(itra=0; itra<llGetListLength(pos); ++itra) {
67 list tPos = llParseString2List(llList2String(pos, itra), [",", "<", ">"], [""]);
68 vector sPos = <llList2Float(tPos, 0), llList2Float(tPos, 1), llList2Float(tPos, 2)>;
69 list tRot = llParseString2List(llList2String(rot, itra), [",", "<", ">"], [""]);
70 rotation sRot = <llList2Float(tRot, 0), llList2Float(tRot, 1), llList2Float(tRot, 2), llList2Float(tRot, 3)>;
71 llSetPos(sPos);
72 llSetLocalRot(sRot);
73 }
74 jump cycle;
75 }
76 changed(integer change) {
78 }
79 }

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