aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/Test sim/objects/onefang's test bed/~pos
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 20:33:54 +1000
committerDavid Walter Seikel2012-01-04 20:33:54 +1000
commitdb13ada463c2908eba68b166a9ccc4963db019f5 (patch)
treeed693d9d9532bea0d890f08199a0bcd5b1e73430 /LuaSL/Test sim/objects/onefang's test bed/~pos
parentREADME files should include at least a basic description of what it's all abo... (diff)
downloadSledjHamr-db13ada463c2908eba68b166a9ccc4963db019f5.zip
SledjHamr-db13ada463c2908eba68b166a9ccc4963db019f5.tar.gz
SledjHamr-db13ada463c2908eba68b166a9ccc4963db019f5.tar.bz2
SledjHamr-db13ada463c2908eba68b166a9ccc4963db019f5.tar.xz
Add a test sim with an MLP bed in it.
No animations yet, wont need them until later, maybe wont need them until this is ready for in world testing.
Diffstat (limited to 'LuaSL/Test sim/objects/onefang's test bed/~pos')
-rw-r--r--LuaSL/Test sim/objects/onefang's test bed/~pos108
1 files changed, 108 insertions, 0 deletions
diff --git a/LuaSL/Test sim/objects/onefang's test bed/~pos b/LuaSL/Test sim/objects/onefang's test bed/~pos
new file mode 100644
index 0000000..3b93b64
--- /dev/null
+++ b/LuaSL/Test sim/objects/onefang's test bed/~pos
@@ -0,0 +1,108 @@
1// MLPV2 Version 2.3j, by Learjeff Innis, based on
2//MLP MULTI-LOVE-POSE V1.2 - Copyright (c) 2006, by Miffy Fluffy (BSD License)
3// OpenSim port by Jez Ember
4// Meta 7 fixes by onefang Rejected and one by Tatjana Kidd.
5
6integer MAX_BALLS = 6;
7
8integer ch;
9integer swap;
10integer BallCount;
11
12string pr1;
13string pr2;
14
15integer Zoffset;
16
17vector RefPos;
18rotation RefRot;
19
20getRefPos() { //reference position
21 RefPos = llGetPos();
22 RefRot = llGetRot();
23 Zoffset = (integer)llGetObjectDesc();
24 RefPos.z += (float) Zoffset / 100.;
25}
26
27list Pdata;
28
29getPosNew(string pdata) {
30 Pdata = llParseString2List(pdata, [" "],[]);
31}
32
33setPos() {
34 pr1 = (string)((vector)llList2String(Pdata, 0) * RefRot + RefPos);
35 pr2 = (string)((vector)llList2String(Pdata, 2) * RefRot + RefPos);
36 pr1 += (string)(llEuler2Rot((vector)llList2String(Pdata, 1) * DEG_TO_RAD) * RefRot);
37 pr2 += (string)(llEuler2Rot((vector)llList2String(Pdata, 3) * DEG_TO_RAD) * RefRot);
38 if (BallCount > 1) {
39 llSay(ch+swap,pr1); //msg to ball1/2
40 llSay(ch+!swap,pr2);
41 } else {
42 llSay(ch,pr1); //msg to ball1/2
43 }
44
45 integer ix;
46 for (ix = 2; ix < BallCount; ++ix) {
47 llSay(ch + ix, (string)((vector)llList2String(Pdata, 2*ix) * RefRot + RefPos)
48 + (string)(llEuler2Rot((vector)llList2String(Pdata, 2*ix + 1) * DEG_TO_RAD) * RefRot));
49 }
50}
51
52getChan() {
53 ch = (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim
54}
55
56default {
57 state_entry() {
58 getRefPos();
59 getChan();
60 }
61
62 on_rez(integer arg) {
63 getRefPos();
64 getChan();
65 }
66
67 link_message(integer from, integer num, string cmd, key pkey) {
68 if (cmd == "PRIMTOUCH"){
69 return;
70 }
71
72 if (num == 1 && cmd == "STOP") {
73 swap = 0;
74 return;
75 }
76
77 if (num) return;
78
79 if (cmd == "POSE") {
80 list parms = llCSV2List((string)pkey);
81 BallCount = llList2Integer(parms,1);
82 return;
83 } else if (cmd == "POSEPOS") {
84 // p = (integer)((string)pkey
85 getPosNew((string)pkey);
86 setPos();
87 } else if (cmd == "SWAP") {
88 swap = (integer)((string)pkey) & 1;
89 llSay(ch+swap,pr1); //msg to ball1/2
90 llSay(ch+!swap,pr2);
91 } else if (cmd == "REPOS") {
92 getRefPos();
93 } else if (llGetSubString(cmd, 0, 0) == "Z") {
94 // Changed by Tatjana to make it work :)
95 integer change;
96 if (llGetSubString(cmd,1,1) == "+") change = (integer)llGetSubString(cmd,2,10);
97 else change = (integer)llGetSubString(cmd,1,10);
98 // End Tatjana changing (Penny helped, of course!)
99 Zoffset += change;
100 RefPos.z += (float)change/100.;
101 setPos();
102 llOwnerSay("Height Adjustment: change by " + (string) change + "cm, new offset: " + (string)Zoffset + "cm");
103 llSetObjectDesc((string)Zoffset);
104 } else if (cmd == "GETREFPOS") {
105 llMessageLinked(LINK_THIS,8,(string)RefPos,(string)RefRot); //send reference position to pose
106 }
107 }
108}