diff options
Diffstat (limited to '')
-rw-r--r-- | LuaSL/Test sim/objects/onefang's test bed/~pos | 108 | ||||
-rw-r--r-- | LuaSL/Test sim/objects/onefang's test bed/~pose | 222 | ||||
-rw-r--r-- | LuaSL/Test sim/objects/onefang's test bed/~poser | 200 | ||||
-rw-r--r-- | LuaSL/Test sim/objects/onefang's test bed/~poser 1 | 200 | ||||
-rw-r--r-- | LuaSL/Test sim/objects/onefang's test bed/~poser 2 | 200 | ||||
-rw-r--r-- | LuaSL/Test sim/objects/onefang's test bed/~poser 3 | 200 | ||||
-rw-r--r-- | LuaSL/Test sim/objects/onefang's test bed/~poser 4 | 200 | ||||
-rw-r--r-- | LuaSL/Test sim/objects/onefang's test bed/~poser 5 | 200 |
8 files changed, 1530 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 | |||
6 | integer MAX_BALLS = 6; | ||
7 | |||
8 | integer ch; | ||
9 | integer swap; | ||
10 | integer BallCount; | ||
11 | |||
12 | string pr1; | ||
13 | string pr2; | ||
14 | |||
15 | integer Zoffset; | ||
16 | |||
17 | vector RefPos; | ||
18 | rotation RefRot; | ||
19 | |||
20 | getRefPos() { //reference position | ||
21 | RefPos = llGetPos(); | ||
22 | RefRot = llGetRot(); | ||
23 | Zoffset = (integer)llGetObjectDesc(); | ||
24 | RefPos.z += (float) Zoffset / 100.; | ||
25 | } | ||
26 | |||
27 | list Pdata; | ||
28 | |||
29 | getPosNew(string pdata) { | ||
30 | Pdata = llParseString2List(pdata, [" "],[]); | ||
31 | } | ||
32 | |||
33 | setPos() { | ||
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 | |||
52 | getChan() { | ||
53 | ch = (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim | ||
54 | } | ||
55 | |||
56 | default { | ||
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 | } | ||
diff --git a/LuaSL/Test sim/objects/onefang's test bed/~pose b/LuaSL/Test sim/objects/onefang's test bed/~pose new file mode 100644 index 0000000..26ab5ff --- /dev/null +++ b/LuaSL/Test sim/objects/onefang's test bed/~pose | |||
@@ -0,0 +1,222 @@ | |||
1 | // MLPV2 Version 2.3, 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 | ||
5 | |||
6 | integer MAX_AVS = 6; | ||
7 | |||
8 | integer a; | ||
9 | integer ch; | ||
10 | integer i; | ||
11 | integer swap; | ||
12 | string an1; | ||
13 | string an2; | ||
14 | string an3; | ||
15 | string an4; | ||
16 | string an5; | ||
17 | string an6; | ||
18 | string pose; | ||
19 | |||
20 | list PRs; // pos/rot pairs for Save | ||
21 | |||
22 | list anims; // strided list of anims, indexed by pose*6 | ||
23 | vector pos; | ||
24 | rotation rot; | ||
25 | integer BallCount; // number of balls | ||
26 | integer UpdateCount; // number of balls we've heard from, for save | ||
27 | |||
28 | string prStr(string str) { | ||
29 | i = llSubStringIndex(str,">"); | ||
30 | vector p = ((vector)llGetSubString(str,0,i) - pos) / rot; | ||
31 | vector r = llRot2Euler((rotation)llGetSubString(str,i+1,-1) / rot)*RAD_TO_DEG; | ||
32 | return "<"+round(p.x, 3)+","+round(p.y, 3)+","+round(p.z, 3)+"> <"+round(r.x, 1)+","+round(r.y, 1)+","+round(r.z, 1)+">"; | ||
33 | } | ||
34 | |||
35 | string round(float number, integer places) { | ||
36 | float shifted; | ||
37 | integer rounded; | ||
38 | string s; | ||
39 | shifted = number * llPow(10.0,(float)places); | ||
40 | rounded = llRound(shifted); | ||
41 | s = (string)((float)rounded / llPow(10.0,(float)places)); | ||
42 | rounded = llSubStringIndex(s, "."); | ||
43 | if (-1 != rounded) | ||
44 | s = llGetSubString(s,0,llSubStringIndex(s, ".")+places); | ||
45 | else | ||
46 | { | ||
47 | s += ".00000000"; | ||
48 | s = llGetSubString(s,0,llSubStringIndex(s, ".")+places); | ||
49 | } | ||
50 | return s; | ||
51 | } | ||
52 | |||
53 | check_anim(string aname) { | ||
54 | if (aname == "") { | ||
55 | return; | ||
56 | } | ||
57 | if ( aname != "PINK" | ||
58 | && aname != "BLUE" | ||
59 | && aname != "stand" | ||
60 | && aname != "sit_ground") { | ||
61 | |||
62 | // ignore expression suffix of "*" or "::nnn" | ||
63 | if (llGetSubString(aname, -1, -1) == "*") { | ||
64 | aname = llGetSubString(aname, 0, -2); | ||
65 | } else { | ||
66 | integer ix = llSubStringIndex(aname, "::"); | ||
67 | if (ix != -1) { | ||
68 | aname = llGetSubString(aname, 0, ix-1); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | if (llGetInventoryType(aname) != INVENTORY_ANIMATION) { | ||
73 | llSay(0,"animation '" | ||
74 | + aname | ||
75 | + "' not in inventory (ok for build-in animations, otherwise check)"); | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | |||
80 | getChan() { | ||
81 | ch = (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim | ||
82 | } | ||
83 | |||
84 | default { | ||
85 | |||
86 | link_message(integer from, integer num, string data, key id) { | ||
87 | if (num != 9+a) return; | ||
88 | |||
89 | if (data == "LOADED") state on; | ||
90 | |||
91 | list ldata = llParseString2List(data,[" | "," | "," | "," | "," |","| ","|"],[]); | ||
92 | |||
93 | an1 = llList2String(ldata,1); | ||
94 | an2 = llList2String(ldata,2); | ||
95 | an3 = llList2String(ldata,3); | ||
96 | an4 = llList2String(ldata,4); | ||
97 | an5 = llList2String(ldata,5); | ||
98 | an6 = llList2String(ldata,6); | ||
99 | |||
100 | if (a>1) { | ||
101 | check_anim(an1); | ||
102 | check_anim(an2); | ||
103 | check_anim(an3); | ||
104 | check_anim(an4); | ||
105 | check_anim(an5); | ||
106 | check_anim(an6); | ||
107 | } else if (a) { //pose1: set default | ||
108 | if (an1 == "") an1 = "sit_ground"; | ||
109 | if (an2 == "") an2 = "sit_ground"; | ||
110 | if (an3 == "") an3 = "sit_ground"; | ||
111 | if (an4 == "") an4 = "sit_ground"; | ||
112 | if (an5 == "") an5 = "sit_ground"; | ||
113 | if (an6 == "") an6 = "sit_ground"; | ||
114 | } else { //pose0: set stand | ||
115 | if (an1 == "") an1 = "stand"; | ||
116 | if (an2 == "") an2 = "stand"; | ||
117 | if (an3 == "") an3 = "stand"; | ||
118 | if (an4 == "") an4 = "stand"; | ||
119 | if (an5 == "") an5 = "stand"; | ||
120 | if (an6 == "") an6 = "stand"; | ||
121 | } | ||
122 | anims += [ an1, an2, an3, an4, an5, an6 ]; | ||
123 | ++a; | ||
124 | } | ||
125 | state_exit() { | ||
126 | llOwnerSay((string)a+" poses loaded ("+llGetScriptName()+": "+(string)llGetFreeMemory()+" bytes free)"); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | |||
131 | state on { | ||
132 | state_entry() { | ||
133 | getChan(); | ||
134 | } | ||
135 | |||
136 | on_rez(integer arg) { | ||
137 | getChan(); | ||
138 | } | ||
139 | |||
140 | link_message(integer from, integer num, string cmd, key akey) { | ||
141 | if (cmd == "PRIMTOUCH"){ | ||
142 | return; | ||
143 | } | ||
144 | if (num) return; | ||
145 | if (cmd == "POSE") { | ||
146 | list parms = llCSV2List((string)akey); | ||
147 | BallCount = llList2Integer(parms,1); | ||
148 | a = llList2Integer(parms,0) * 6; | ||
149 | an1 = llList2String(anims, a); | ||
150 | an2 = llList2String(anims, a+1); | ||
151 | an3 = llList2String(anims, a+2); | ||
152 | an4 = llList2String(anims, a+3); | ||
153 | an5 = llList2String(anims, a+4); | ||
154 | an6 = llList2String(anims, a+5); | ||
155 | } else if (cmd == "SWAP") { | ||
156 | swap = !swap; | ||
157 | } else if (cmd == "SAVE") { | ||
158 | pose = (string)akey; | ||
159 | state save; | ||
160 | } else return; | ||
161 | llMessageLinked(LINK_THIS,ch+swap, an1,(key)""); //msg to poser 1/2 | ||
162 | llMessageLinked(LINK_THIS,ch+!swap,an2,(key)""); | ||
163 | llMessageLinked(LINK_THIS,ch+2, an3,(key)""); //msg to poser 3 | ||
164 | llMessageLinked(LINK_THIS,ch+3, an4,(key)""); //msg to poser 4 | ||
165 | llMessageLinked(LINK_THIS,ch+4, an5,(key)""); //msg to poser 4 | ||
166 | llMessageLinked(LINK_THIS,ch+5, an6,(key)""); //msg to poser 4 | ||
167 | } | ||
168 | } | ||
169 | |||
170 | state save { | ||
171 | state_entry() { | ||
172 | llMessageLinked(LINK_THIS,0,"GETREFPOS",""); //msg to pos: ask ref position | ||
173 | integer ix; | ||
174 | PRs = [ "", "", "", "", "", "" ]; | ||
175 | |||
176 | for (ix = 0; ix < MAX_AVS; ++ix) { | ||
177 | llListen(ch+16+ix, "", NULL_KEY, ""); | ||
178 | llSay(ch+ix,"SAVE"); //msg to balls | ||
179 | } | ||
180 | llSetTimerEvent(3); | ||
181 | UpdateCount = 0; | ||
182 | } | ||
183 | |||
184 | |||
185 | listen(integer channel, string name, key id, string pr) { | ||
186 | channel -= (ch + 16); | ||
187 | |||
188 | if (channel == 0) { | ||
189 | channel = channel + swap; | ||
190 | } else if (channel == 1) { | ||
191 | channel = channel - swap; | ||
192 | } | ||
193 | |||
194 | PRs = llListReplaceList(PRs, (list)pr, channel, channel); | ||
195 | |||
196 | if (++UpdateCount == BallCount) { | ||
197 | pr = ""; | ||
198 | integer ix; | ||
199 | for (ix = 0; ix < BallCount; ++ix) { | ||
200 | pr += prStr(llList2String(PRs, ix)) + " "; | ||
201 | } | ||
202 | |||
203 | llOwnerSay("{"+pose+"} "+pr); | ||
204 | llMessageLinked(LINK_THIS,1,pose,pr); //write to memory | ||
205 | state on; | ||
206 | } | ||
207 | } | ||
208 | link_message(integer from, integer num, string posstr, key rotkey) { | ||
209 | if (posstr == "PRIMTOUCH"){ | ||
210 | return; | ||
211 | } | ||
212 | if (num != 8) return; | ||
213 | pos = (vector)posstr; //revtrieve reference position from pos | ||
214 | rot = (rotation)((string)rotkey); | ||
215 | } | ||
216 | timer() { | ||
217 | state on; | ||
218 | } | ||
219 | state_exit() { | ||
220 | llSetTimerEvent(0); | ||
221 | } | ||
222 | } | ||
diff --git a/LuaSL/Test sim/objects/onefang's test bed/~poser b/LuaSL/Test sim/objects/onefang's test bed/~poser new file mode 100644 index 0000000..fc976c4 --- /dev/null +++ b/LuaSL/Test sim/objects/onefang's test bed/~poser | |||
@@ -0,0 +1,200 @@ | |||
1 | // MPLV2 2.3 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 | ||
5 | |||
6 | integer ch; | ||
7 | string animation = "stand"; | ||
8 | key avatar; | ||
9 | |||
10 | integer ExprEnabled = TRUE; | ||
11 | string Expression; | ||
12 | float ExprTimer; | ||
13 | |||
14 | integer BallNum; | ||
15 | |||
16 | list Expressions = [ | ||
17 | "" | ||
18 | , "express_open_mouth" // 1 | ||
19 | , "express_surprise_emote" // 2 | ||
20 | , "express_tongue_out" // 3 | ||
21 | , "express_smile" // 4 | ||
22 | , "express_toothsmile" // 5 | ||
23 | , "express_wink_emote" // 6 | ||
24 | , "express_cry_emote" // 7 | ||
25 | , "express_kiss" // 8 | ||
26 | , "express_laugh_emote" // 9 | ||
27 | , "express_disdain" // 10 | ||
28 | , "express_repulsed_emote" // 11 | ||
29 | , "express_anger_emote" // 12 | ||
30 | , "express_bored_emote" // 13 | ||
31 | , "express_sad_emote" // 14 | ||
32 | , "express_embarrassed_emote" // 15 | ||
33 | , "express_frown" // 16 | ||
34 | , "express_shrug_emote" // 17 | ||
35 | , "express_afraid_emote" // 18 | ||
36 | , "express_worry_emote" // 19 | ||
37 | , "SLEEP" // 20 | ||
38 | ]; | ||
39 | |||
40 | |||
41 | stopAnim() { | ||
42 | key id = llGetPermissionsKey(); | ||
43 | list anims = llGetAnimationList(id); | ||
44 | integer ix; | ||
45 | for (ix = 0; ix < llGetListLength(anims); ++ix) { | ||
46 | string anim = llList2String(anims, ix); | ||
47 | if (anim != "") { | ||
48 | llStopAnimation(anim); | ||
49 | } | ||
50 | } | ||
51 | llSetTimerEvent(0.0); | ||
52 | } | ||
53 | |||
54 | startAnim(string anim) { | ||
55 | if (Expression != "") { | ||
56 | if (Expression == "SLEEP") { | ||
57 | llStartAnimation("express_disdain"); | ||
58 | llStartAnimation("express_smile"); | ||
59 | } else { | ||
60 | llStartAnimation(Expression); | ||
61 | } | ||
62 | if (ExprEnabled) { | ||
63 | llSetTimerEvent(ExprTimer); | ||
64 | } | ||
65 | } else { | ||
66 | stopAnim(); | ||
67 | } | ||
68 | if (anim != "") { | ||
69 | llStartAnimation(anim); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | // Animation names with a "*" suffix get open mouth | ||
74 | // Those with a suffix of "::" followed by a number | ||
75 | // get the expression associated with that number. | ||
76 | // This can optionally be followed by another "::" delim, | ||
77 | // with a timer value following. | ||
78 | // Return the anim name without the suffix. | ||
79 | string getExpression(string anim) { | ||
80 | if (llGetSubString(anim,-1,-1) == "*") { | ||
81 | Expression = llList2String(Expressions, 1); | ||
82 | ExprTimer = 0.5; | ||
83 | return llGetSubString(anim, 0, -2); | ||
84 | } | ||
85 | integer ix = llSubStringIndex(anim, "::"); | ||
86 | if (ix == -1) { | ||
87 | Expression = ""; | ||
88 | ExprTimer = 0.5; | ||
89 | return anim; | ||
90 | } | ||
91 | |||
92 | list parms = llParseString2List(anim, ["::"], []); | ||
93 | anim = llList2String(parms, 0); | ||
94 | integer exprIx = (integer) llList2String(parms, 1); | ||
95 | Expression = llList2String(Expressions, exprIx); | ||
96 | ExprTimer = (float) llList2String(parms,2); | ||
97 | |||
98 | if (ExprTimer <= 0.0) { | ||
99 | ExprTimer = 0.5; | ||
100 | } | ||
101 | |||
102 | return anim; | ||
103 | } | ||
104 | |||
105 | getChan() { | ||
106 | BallNum = (integer) llGetSubString(llGetScriptName(),-1,-1); //offset from script name suffix | ||
107 | ch = BallNum | ||
108 | + (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim | ||
109 | } | ||
110 | |||
111 | default { | ||
112 | state_entry() { | ||
113 | state s_on; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | state s_on { | ||
118 | state_entry() { | ||
119 | getChan(); | ||
120 | llListen(ch+8,"",NULL_KEY,""); | ||
121 | } | ||
122 | |||
123 | on_rez(integer arg) { | ||
124 | state default; | ||
125 | } | ||
126 | |||
127 | link_message(integer from, integer num, string an, key id) { //an animation is set | ||
128 | if (an == "PRIMTOUCH") { | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | if (num != ch) return; | ||
133 | an = getExpression(an); // get & save expression, and return unadorned anim | ||
134 | |||
135 | if (avatar == llGetPermissionsKey() | ||
136 | && avatar != NULL_KEY | ||
137 | && animation != "") { | ||
138 | llStopAnimation(animation); | ||
139 | llMessageLinked(LINK_SET, -11002, (string)BallNum + "|" + an, avatar); | ||
140 | startAnim(an); | ||
141 | } | ||
142 | animation = an; | ||
143 | } | ||
144 | |||
145 | timer() { // timer to keep mouth open | ||
146 | if (Expression == "SLEEP") { | ||
147 | llStartAnimation("express_disdain"); | ||
148 | llStartAnimation("express_smile"); | ||
149 | } else if (Expression != "") { | ||
150 | llStartAnimation(Expression); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | listen(integer channel, string name, key id, string str) { | ||
155 | if (str == "ALIVE" || str == "DIE") { | ||
156 | llMessageLinked(LINK_THIS,2,str,""); //send msg from ball to menu | ||
157 | if (str == "DIE") { | ||
158 | avatar = NULL_KEY; | ||
159 | llSetTimerEvent(0.0); | ||
160 | } | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | avatar = (key) str; //avatar (sit) or NULL_KEY (stand up) | ||
165 | if (avatar == NULL_KEY) { | ||
166 | if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { | ||
167 | stopAnim(); | ||
168 | llMessageLinked(LINK_SET, -11001, (string)BallNum, llGetPermissionsKey()); | ||
169 | } | ||
170 | // llReleaseControls(); | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | if (avatar != llGetPermissionsKey() | ||
175 | || ! (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) { | ||
176 | ExprEnabled = TRUE; | ||
177 | llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); | ||
178 | } else { | ||
179 | stopAnim(); | ||
180 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
181 | startAnim(animation); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | run_time_permissions(integer perm) { | ||
186 | if (avatar != llGetPermissionsKey()) { | ||
187 | llWhisper(DEBUG_CHANNEL, "avatar != perm key"); | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | if (perm & PERMISSION_TRIGGER_ANIMATION) { | ||
192 | stopAnim(); | ||
193 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
194 | startAnim(animation); | ||
195 | } else { | ||
196 | llMessageLinked(LINK_SET, -11001, (string)BallNum, avatar); | ||
197 | llSetTimerEvent(0.0); | ||
198 | } | ||
199 | } | ||
200 | } | ||
diff --git a/LuaSL/Test sim/objects/onefang's test bed/~poser 1 b/LuaSL/Test sim/objects/onefang's test bed/~poser 1 new file mode 100644 index 0000000..fc976c4 --- /dev/null +++ b/LuaSL/Test sim/objects/onefang's test bed/~poser 1 | |||
@@ -0,0 +1,200 @@ | |||
1 | // MPLV2 2.3 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 | ||
5 | |||
6 | integer ch; | ||
7 | string animation = "stand"; | ||
8 | key avatar; | ||
9 | |||
10 | integer ExprEnabled = TRUE; | ||
11 | string Expression; | ||
12 | float ExprTimer; | ||
13 | |||
14 | integer BallNum; | ||
15 | |||
16 | list Expressions = [ | ||
17 | "" | ||
18 | , "express_open_mouth" // 1 | ||
19 | , "express_surprise_emote" // 2 | ||
20 | , "express_tongue_out" // 3 | ||
21 | , "express_smile" // 4 | ||
22 | , "express_toothsmile" // 5 | ||
23 | , "express_wink_emote" // 6 | ||
24 | , "express_cry_emote" // 7 | ||
25 | , "express_kiss" // 8 | ||
26 | , "express_laugh_emote" // 9 | ||
27 | , "express_disdain" // 10 | ||
28 | , "express_repulsed_emote" // 11 | ||
29 | , "express_anger_emote" // 12 | ||
30 | , "express_bored_emote" // 13 | ||
31 | , "express_sad_emote" // 14 | ||
32 | , "express_embarrassed_emote" // 15 | ||
33 | , "express_frown" // 16 | ||
34 | , "express_shrug_emote" // 17 | ||
35 | , "express_afraid_emote" // 18 | ||
36 | , "express_worry_emote" // 19 | ||
37 | , "SLEEP" // 20 | ||
38 | ]; | ||
39 | |||
40 | |||
41 | stopAnim() { | ||
42 | key id = llGetPermissionsKey(); | ||
43 | list anims = llGetAnimationList(id); | ||
44 | integer ix; | ||
45 | for (ix = 0; ix < llGetListLength(anims); ++ix) { | ||
46 | string anim = llList2String(anims, ix); | ||
47 | if (anim != "") { | ||
48 | llStopAnimation(anim); | ||
49 | } | ||
50 | } | ||
51 | llSetTimerEvent(0.0); | ||
52 | } | ||
53 | |||
54 | startAnim(string anim) { | ||
55 | if (Expression != "") { | ||
56 | if (Expression == "SLEEP") { | ||
57 | llStartAnimation("express_disdain"); | ||
58 | llStartAnimation("express_smile"); | ||
59 | } else { | ||
60 | llStartAnimation(Expression); | ||
61 | } | ||
62 | if (ExprEnabled) { | ||
63 | llSetTimerEvent(ExprTimer); | ||
64 | } | ||
65 | } else { | ||
66 | stopAnim(); | ||
67 | } | ||
68 | if (anim != "") { | ||
69 | llStartAnimation(anim); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | // Animation names with a "*" suffix get open mouth | ||
74 | // Those with a suffix of "::" followed by a number | ||
75 | // get the expression associated with that number. | ||
76 | // This can optionally be followed by another "::" delim, | ||
77 | // with a timer value following. | ||
78 | // Return the anim name without the suffix. | ||
79 | string getExpression(string anim) { | ||
80 | if (llGetSubString(anim,-1,-1) == "*") { | ||
81 | Expression = llList2String(Expressions, 1); | ||
82 | ExprTimer = 0.5; | ||
83 | return llGetSubString(anim, 0, -2); | ||
84 | } | ||
85 | integer ix = llSubStringIndex(anim, "::"); | ||
86 | if (ix == -1) { | ||
87 | Expression = ""; | ||
88 | ExprTimer = 0.5; | ||
89 | return anim; | ||
90 | } | ||
91 | |||
92 | list parms = llParseString2List(anim, ["::"], []); | ||
93 | anim = llList2String(parms, 0); | ||
94 | integer exprIx = (integer) llList2String(parms, 1); | ||
95 | Expression = llList2String(Expressions, exprIx); | ||
96 | ExprTimer = (float) llList2String(parms,2); | ||
97 | |||
98 | if (ExprTimer <= 0.0) { | ||
99 | ExprTimer = 0.5; | ||
100 | } | ||
101 | |||
102 | return anim; | ||
103 | } | ||
104 | |||
105 | getChan() { | ||
106 | BallNum = (integer) llGetSubString(llGetScriptName(),-1,-1); //offset from script name suffix | ||
107 | ch = BallNum | ||
108 | + (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim | ||
109 | } | ||
110 | |||
111 | default { | ||
112 | state_entry() { | ||
113 | state s_on; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | state s_on { | ||
118 | state_entry() { | ||
119 | getChan(); | ||
120 | llListen(ch+8,"",NULL_KEY,""); | ||
121 | } | ||
122 | |||
123 | on_rez(integer arg) { | ||
124 | state default; | ||
125 | } | ||
126 | |||
127 | link_message(integer from, integer num, string an, key id) { //an animation is set | ||
128 | if (an == "PRIMTOUCH") { | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | if (num != ch) return; | ||
133 | an = getExpression(an); // get & save expression, and return unadorned anim | ||
134 | |||
135 | if (avatar == llGetPermissionsKey() | ||
136 | && avatar != NULL_KEY | ||
137 | && animation != "") { | ||
138 | llStopAnimation(animation); | ||
139 | llMessageLinked(LINK_SET, -11002, (string)BallNum + "|" + an, avatar); | ||
140 | startAnim(an); | ||
141 | } | ||
142 | animation = an; | ||
143 | } | ||
144 | |||
145 | timer() { // timer to keep mouth open | ||
146 | if (Expression == "SLEEP") { | ||
147 | llStartAnimation("express_disdain"); | ||
148 | llStartAnimation("express_smile"); | ||
149 | } else if (Expression != "") { | ||
150 | llStartAnimation(Expression); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | listen(integer channel, string name, key id, string str) { | ||
155 | if (str == "ALIVE" || str == "DIE") { | ||
156 | llMessageLinked(LINK_THIS,2,str,""); //send msg from ball to menu | ||
157 | if (str == "DIE") { | ||
158 | avatar = NULL_KEY; | ||
159 | llSetTimerEvent(0.0); | ||
160 | } | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | avatar = (key) str; //avatar (sit) or NULL_KEY (stand up) | ||
165 | if (avatar == NULL_KEY) { | ||
166 | if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { | ||
167 | stopAnim(); | ||
168 | llMessageLinked(LINK_SET, -11001, (string)BallNum, llGetPermissionsKey()); | ||
169 | } | ||
170 | // llReleaseControls(); | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | if (avatar != llGetPermissionsKey() | ||
175 | || ! (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) { | ||
176 | ExprEnabled = TRUE; | ||
177 | llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); | ||
178 | } else { | ||
179 | stopAnim(); | ||
180 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
181 | startAnim(animation); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | run_time_permissions(integer perm) { | ||
186 | if (avatar != llGetPermissionsKey()) { | ||
187 | llWhisper(DEBUG_CHANNEL, "avatar != perm key"); | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | if (perm & PERMISSION_TRIGGER_ANIMATION) { | ||
192 | stopAnim(); | ||
193 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
194 | startAnim(animation); | ||
195 | } else { | ||
196 | llMessageLinked(LINK_SET, -11001, (string)BallNum, avatar); | ||
197 | llSetTimerEvent(0.0); | ||
198 | } | ||
199 | } | ||
200 | } | ||
diff --git a/LuaSL/Test sim/objects/onefang's test bed/~poser 2 b/LuaSL/Test sim/objects/onefang's test bed/~poser 2 new file mode 100644 index 0000000..fc976c4 --- /dev/null +++ b/LuaSL/Test sim/objects/onefang's test bed/~poser 2 | |||
@@ -0,0 +1,200 @@ | |||
1 | // MPLV2 2.3 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 | ||
5 | |||
6 | integer ch; | ||
7 | string animation = "stand"; | ||
8 | key avatar; | ||
9 | |||
10 | integer ExprEnabled = TRUE; | ||
11 | string Expression; | ||
12 | float ExprTimer; | ||
13 | |||
14 | integer BallNum; | ||
15 | |||
16 | list Expressions = [ | ||
17 | "" | ||
18 | , "express_open_mouth" // 1 | ||
19 | , "express_surprise_emote" // 2 | ||
20 | , "express_tongue_out" // 3 | ||
21 | , "express_smile" // 4 | ||
22 | , "express_toothsmile" // 5 | ||
23 | , "express_wink_emote" // 6 | ||
24 | , "express_cry_emote" // 7 | ||
25 | , "express_kiss" // 8 | ||
26 | , "express_laugh_emote" // 9 | ||
27 | , "express_disdain" // 10 | ||
28 | , "express_repulsed_emote" // 11 | ||
29 | , "express_anger_emote" // 12 | ||
30 | , "express_bored_emote" // 13 | ||
31 | , "express_sad_emote" // 14 | ||
32 | , "express_embarrassed_emote" // 15 | ||
33 | , "express_frown" // 16 | ||
34 | , "express_shrug_emote" // 17 | ||
35 | , "express_afraid_emote" // 18 | ||
36 | , "express_worry_emote" // 19 | ||
37 | , "SLEEP" // 20 | ||
38 | ]; | ||
39 | |||
40 | |||
41 | stopAnim() { | ||
42 | key id = llGetPermissionsKey(); | ||
43 | list anims = llGetAnimationList(id); | ||
44 | integer ix; | ||
45 | for (ix = 0; ix < llGetListLength(anims); ++ix) { | ||
46 | string anim = llList2String(anims, ix); | ||
47 | if (anim != "") { | ||
48 | llStopAnimation(anim); | ||
49 | } | ||
50 | } | ||
51 | llSetTimerEvent(0.0); | ||
52 | } | ||
53 | |||
54 | startAnim(string anim) { | ||
55 | if (Expression != "") { | ||
56 | if (Expression == "SLEEP") { | ||
57 | llStartAnimation("express_disdain"); | ||
58 | llStartAnimation("express_smile"); | ||
59 | } else { | ||
60 | llStartAnimation(Expression); | ||
61 | } | ||
62 | if (ExprEnabled) { | ||
63 | llSetTimerEvent(ExprTimer); | ||
64 | } | ||
65 | } else { | ||
66 | stopAnim(); | ||
67 | } | ||
68 | if (anim != "") { | ||
69 | llStartAnimation(anim); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | // Animation names with a "*" suffix get open mouth | ||
74 | // Those with a suffix of "::" followed by a number | ||
75 | // get the expression associated with that number. | ||
76 | // This can optionally be followed by another "::" delim, | ||
77 | // with a timer value following. | ||
78 | // Return the anim name without the suffix. | ||
79 | string getExpression(string anim) { | ||
80 | if (llGetSubString(anim,-1,-1) == "*") { | ||
81 | Expression = llList2String(Expressions, 1); | ||
82 | ExprTimer = 0.5; | ||
83 | return llGetSubString(anim, 0, -2); | ||
84 | } | ||
85 | integer ix = llSubStringIndex(anim, "::"); | ||
86 | if (ix == -1) { | ||
87 | Expression = ""; | ||
88 | ExprTimer = 0.5; | ||
89 | return anim; | ||
90 | } | ||
91 | |||
92 | list parms = llParseString2List(anim, ["::"], []); | ||
93 | anim = llList2String(parms, 0); | ||
94 | integer exprIx = (integer) llList2String(parms, 1); | ||
95 | Expression = llList2String(Expressions, exprIx); | ||
96 | ExprTimer = (float) llList2String(parms,2); | ||
97 | |||
98 | if (ExprTimer <= 0.0) { | ||
99 | ExprTimer = 0.5; | ||
100 | } | ||
101 | |||
102 | return anim; | ||
103 | } | ||
104 | |||
105 | getChan() { | ||
106 | BallNum = (integer) llGetSubString(llGetScriptName(),-1,-1); //offset from script name suffix | ||
107 | ch = BallNum | ||
108 | + (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim | ||
109 | } | ||
110 | |||
111 | default { | ||
112 | state_entry() { | ||
113 | state s_on; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | state s_on { | ||
118 | state_entry() { | ||
119 | getChan(); | ||
120 | llListen(ch+8,"",NULL_KEY,""); | ||
121 | } | ||
122 | |||
123 | on_rez(integer arg) { | ||
124 | state default; | ||
125 | } | ||
126 | |||
127 | link_message(integer from, integer num, string an, key id) { //an animation is set | ||
128 | if (an == "PRIMTOUCH") { | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | if (num != ch) return; | ||
133 | an = getExpression(an); // get & save expression, and return unadorned anim | ||
134 | |||
135 | if (avatar == llGetPermissionsKey() | ||
136 | && avatar != NULL_KEY | ||
137 | && animation != "") { | ||
138 | llStopAnimation(animation); | ||
139 | llMessageLinked(LINK_SET, -11002, (string)BallNum + "|" + an, avatar); | ||
140 | startAnim(an); | ||
141 | } | ||
142 | animation = an; | ||
143 | } | ||
144 | |||
145 | timer() { // timer to keep mouth open | ||
146 | if (Expression == "SLEEP") { | ||
147 | llStartAnimation("express_disdain"); | ||
148 | llStartAnimation("express_smile"); | ||
149 | } else if (Expression != "") { | ||
150 | llStartAnimation(Expression); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | listen(integer channel, string name, key id, string str) { | ||
155 | if (str == "ALIVE" || str == "DIE") { | ||
156 | llMessageLinked(LINK_THIS,2,str,""); //send msg from ball to menu | ||
157 | if (str == "DIE") { | ||
158 | avatar = NULL_KEY; | ||
159 | llSetTimerEvent(0.0); | ||
160 | } | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | avatar = (key) str; //avatar (sit) or NULL_KEY (stand up) | ||
165 | if (avatar == NULL_KEY) { | ||
166 | if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { | ||
167 | stopAnim(); | ||
168 | llMessageLinked(LINK_SET, -11001, (string)BallNum, llGetPermissionsKey()); | ||
169 | } | ||
170 | // llReleaseControls(); | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | if (avatar != llGetPermissionsKey() | ||
175 | || ! (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) { | ||
176 | ExprEnabled = TRUE; | ||
177 | llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); | ||
178 | } else { | ||
179 | stopAnim(); | ||
180 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
181 | startAnim(animation); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | run_time_permissions(integer perm) { | ||
186 | if (avatar != llGetPermissionsKey()) { | ||
187 | llWhisper(DEBUG_CHANNEL, "avatar != perm key"); | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | if (perm & PERMISSION_TRIGGER_ANIMATION) { | ||
192 | stopAnim(); | ||
193 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
194 | startAnim(animation); | ||
195 | } else { | ||
196 | llMessageLinked(LINK_SET, -11001, (string)BallNum, avatar); | ||
197 | llSetTimerEvent(0.0); | ||
198 | } | ||
199 | } | ||
200 | } | ||
diff --git a/LuaSL/Test sim/objects/onefang's test bed/~poser 3 b/LuaSL/Test sim/objects/onefang's test bed/~poser 3 new file mode 100644 index 0000000..fc976c4 --- /dev/null +++ b/LuaSL/Test sim/objects/onefang's test bed/~poser 3 | |||
@@ -0,0 +1,200 @@ | |||
1 | // MPLV2 2.3 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 | ||
5 | |||
6 | integer ch; | ||
7 | string animation = "stand"; | ||
8 | key avatar; | ||
9 | |||
10 | integer ExprEnabled = TRUE; | ||
11 | string Expression; | ||
12 | float ExprTimer; | ||
13 | |||
14 | integer BallNum; | ||
15 | |||
16 | list Expressions = [ | ||
17 | "" | ||
18 | , "express_open_mouth" // 1 | ||
19 | , "express_surprise_emote" // 2 | ||
20 | , "express_tongue_out" // 3 | ||
21 | , "express_smile" // 4 | ||
22 | , "express_toothsmile" // 5 | ||
23 | , "express_wink_emote" // 6 | ||
24 | , "express_cry_emote" // 7 | ||
25 | , "express_kiss" // 8 | ||
26 | , "express_laugh_emote" // 9 | ||
27 | , "express_disdain" // 10 | ||
28 | , "express_repulsed_emote" // 11 | ||
29 | , "express_anger_emote" // 12 | ||
30 | , "express_bored_emote" // 13 | ||
31 | , "express_sad_emote" // 14 | ||
32 | , "express_embarrassed_emote" // 15 | ||
33 | , "express_frown" // 16 | ||
34 | , "express_shrug_emote" // 17 | ||
35 | , "express_afraid_emote" // 18 | ||
36 | , "express_worry_emote" // 19 | ||
37 | , "SLEEP" // 20 | ||
38 | ]; | ||
39 | |||
40 | |||
41 | stopAnim() { | ||
42 | key id = llGetPermissionsKey(); | ||
43 | list anims = llGetAnimationList(id); | ||
44 | integer ix; | ||
45 | for (ix = 0; ix < llGetListLength(anims); ++ix) { | ||
46 | string anim = llList2String(anims, ix); | ||
47 | if (anim != "") { | ||
48 | llStopAnimation(anim); | ||
49 | } | ||
50 | } | ||
51 | llSetTimerEvent(0.0); | ||
52 | } | ||
53 | |||
54 | startAnim(string anim) { | ||
55 | if (Expression != "") { | ||
56 | if (Expression == "SLEEP") { | ||
57 | llStartAnimation("express_disdain"); | ||
58 | llStartAnimation("express_smile"); | ||
59 | } else { | ||
60 | llStartAnimation(Expression); | ||
61 | } | ||
62 | if (ExprEnabled) { | ||
63 | llSetTimerEvent(ExprTimer); | ||
64 | } | ||
65 | } else { | ||
66 | stopAnim(); | ||
67 | } | ||
68 | if (anim != "") { | ||
69 | llStartAnimation(anim); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | // Animation names with a "*" suffix get open mouth | ||
74 | // Those with a suffix of "::" followed by a number | ||
75 | // get the expression associated with that number. | ||
76 | // This can optionally be followed by another "::" delim, | ||
77 | // with a timer value following. | ||
78 | // Return the anim name without the suffix. | ||
79 | string getExpression(string anim) { | ||
80 | if (llGetSubString(anim,-1,-1) == "*") { | ||
81 | Expression = llList2String(Expressions, 1); | ||
82 | ExprTimer = 0.5; | ||
83 | return llGetSubString(anim, 0, -2); | ||
84 | } | ||
85 | integer ix = llSubStringIndex(anim, "::"); | ||
86 | if (ix == -1) { | ||
87 | Expression = ""; | ||
88 | ExprTimer = 0.5; | ||
89 | return anim; | ||
90 | } | ||
91 | |||
92 | list parms = llParseString2List(anim, ["::"], []); | ||
93 | anim = llList2String(parms, 0); | ||
94 | integer exprIx = (integer) llList2String(parms, 1); | ||
95 | Expression = llList2String(Expressions, exprIx); | ||
96 | ExprTimer = (float) llList2String(parms,2); | ||
97 | |||
98 | if (ExprTimer <= 0.0) { | ||
99 | ExprTimer = 0.5; | ||
100 | } | ||
101 | |||
102 | return anim; | ||
103 | } | ||
104 | |||
105 | getChan() { | ||
106 | BallNum = (integer) llGetSubString(llGetScriptName(),-1,-1); //offset from script name suffix | ||
107 | ch = BallNum | ||
108 | + (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim | ||
109 | } | ||
110 | |||
111 | default { | ||
112 | state_entry() { | ||
113 | state s_on; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | state s_on { | ||
118 | state_entry() { | ||
119 | getChan(); | ||
120 | llListen(ch+8,"",NULL_KEY,""); | ||
121 | } | ||
122 | |||
123 | on_rez(integer arg) { | ||
124 | state default; | ||
125 | } | ||
126 | |||
127 | link_message(integer from, integer num, string an, key id) { //an animation is set | ||
128 | if (an == "PRIMTOUCH") { | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | if (num != ch) return; | ||
133 | an = getExpression(an); // get & save expression, and return unadorned anim | ||
134 | |||
135 | if (avatar == llGetPermissionsKey() | ||
136 | && avatar != NULL_KEY | ||
137 | && animation != "") { | ||
138 | llStopAnimation(animation); | ||
139 | llMessageLinked(LINK_SET, -11002, (string)BallNum + "|" + an, avatar); | ||
140 | startAnim(an); | ||
141 | } | ||
142 | animation = an; | ||
143 | } | ||
144 | |||
145 | timer() { // timer to keep mouth open | ||
146 | if (Expression == "SLEEP") { | ||
147 | llStartAnimation("express_disdain"); | ||
148 | llStartAnimation("express_smile"); | ||
149 | } else if (Expression != "") { | ||
150 | llStartAnimation(Expression); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | listen(integer channel, string name, key id, string str) { | ||
155 | if (str == "ALIVE" || str == "DIE") { | ||
156 | llMessageLinked(LINK_THIS,2,str,""); //send msg from ball to menu | ||
157 | if (str == "DIE") { | ||
158 | avatar = NULL_KEY; | ||
159 | llSetTimerEvent(0.0); | ||
160 | } | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | avatar = (key) str; //avatar (sit) or NULL_KEY (stand up) | ||
165 | if (avatar == NULL_KEY) { | ||
166 | if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { | ||
167 | stopAnim(); | ||
168 | llMessageLinked(LINK_SET, -11001, (string)BallNum, llGetPermissionsKey()); | ||
169 | } | ||
170 | // llReleaseControls(); | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | if (avatar != llGetPermissionsKey() | ||
175 | || ! (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) { | ||
176 | ExprEnabled = TRUE; | ||
177 | llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); | ||
178 | } else { | ||
179 | stopAnim(); | ||
180 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
181 | startAnim(animation); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | run_time_permissions(integer perm) { | ||
186 | if (avatar != llGetPermissionsKey()) { | ||
187 | llWhisper(DEBUG_CHANNEL, "avatar != perm key"); | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | if (perm & PERMISSION_TRIGGER_ANIMATION) { | ||
192 | stopAnim(); | ||
193 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
194 | startAnim(animation); | ||
195 | } else { | ||
196 | llMessageLinked(LINK_SET, -11001, (string)BallNum, avatar); | ||
197 | llSetTimerEvent(0.0); | ||
198 | } | ||
199 | } | ||
200 | } | ||
diff --git a/LuaSL/Test sim/objects/onefang's test bed/~poser 4 b/LuaSL/Test sim/objects/onefang's test bed/~poser 4 new file mode 100644 index 0000000..fc976c4 --- /dev/null +++ b/LuaSL/Test sim/objects/onefang's test bed/~poser 4 | |||
@@ -0,0 +1,200 @@ | |||
1 | // MPLV2 2.3 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 | ||
5 | |||
6 | integer ch; | ||
7 | string animation = "stand"; | ||
8 | key avatar; | ||
9 | |||
10 | integer ExprEnabled = TRUE; | ||
11 | string Expression; | ||
12 | float ExprTimer; | ||
13 | |||
14 | integer BallNum; | ||
15 | |||
16 | list Expressions = [ | ||
17 | "" | ||
18 | , "express_open_mouth" // 1 | ||
19 | , "express_surprise_emote" // 2 | ||
20 | , "express_tongue_out" // 3 | ||
21 | , "express_smile" // 4 | ||
22 | , "express_toothsmile" // 5 | ||
23 | , "express_wink_emote" // 6 | ||
24 | , "express_cry_emote" // 7 | ||
25 | , "express_kiss" // 8 | ||
26 | , "express_laugh_emote" // 9 | ||
27 | , "express_disdain" // 10 | ||
28 | , "express_repulsed_emote" // 11 | ||
29 | , "express_anger_emote" // 12 | ||
30 | , "express_bored_emote" // 13 | ||
31 | , "express_sad_emote" // 14 | ||
32 | , "express_embarrassed_emote" // 15 | ||
33 | , "express_frown" // 16 | ||
34 | , "express_shrug_emote" // 17 | ||
35 | , "express_afraid_emote" // 18 | ||
36 | , "express_worry_emote" // 19 | ||
37 | , "SLEEP" // 20 | ||
38 | ]; | ||
39 | |||
40 | |||
41 | stopAnim() { | ||
42 | key id = llGetPermissionsKey(); | ||
43 | list anims = llGetAnimationList(id); | ||
44 | integer ix; | ||
45 | for (ix = 0; ix < llGetListLength(anims); ++ix) { | ||
46 | string anim = llList2String(anims, ix); | ||
47 | if (anim != "") { | ||
48 | llStopAnimation(anim); | ||
49 | } | ||
50 | } | ||
51 | llSetTimerEvent(0.0); | ||
52 | } | ||
53 | |||
54 | startAnim(string anim) { | ||
55 | if (Expression != "") { | ||
56 | if (Expression == "SLEEP") { | ||
57 | llStartAnimation("express_disdain"); | ||
58 | llStartAnimation("express_smile"); | ||
59 | } else { | ||
60 | llStartAnimation(Expression); | ||
61 | } | ||
62 | if (ExprEnabled) { | ||
63 | llSetTimerEvent(ExprTimer); | ||
64 | } | ||
65 | } else { | ||
66 | stopAnim(); | ||
67 | } | ||
68 | if (anim != "") { | ||
69 | llStartAnimation(anim); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | // Animation names with a "*" suffix get open mouth | ||
74 | // Those with a suffix of "::" followed by a number | ||
75 | // get the expression associated with that number. | ||
76 | // This can optionally be followed by another "::" delim, | ||
77 | // with a timer value following. | ||
78 | // Return the anim name without the suffix. | ||
79 | string getExpression(string anim) { | ||
80 | if (llGetSubString(anim,-1,-1) == "*") { | ||
81 | Expression = llList2String(Expressions, 1); | ||
82 | ExprTimer = 0.5; | ||
83 | return llGetSubString(anim, 0, -2); | ||
84 | } | ||
85 | integer ix = llSubStringIndex(anim, "::"); | ||
86 | if (ix == -1) { | ||
87 | Expression = ""; | ||
88 | ExprTimer = 0.5; | ||
89 | return anim; | ||
90 | } | ||
91 | |||
92 | list parms = llParseString2List(anim, ["::"], []); | ||
93 | anim = llList2String(parms, 0); | ||
94 | integer exprIx = (integer) llList2String(parms, 1); | ||
95 | Expression = llList2String(Expressions, exprIx); | ||
96 | ExprTimer = (float) llList2String(parms,2); | ||
97 | |||
98 | if (ExprTimer <= 0.0) { | ||
99 | ExprTimer = 0.5; | ||
100 | } | ||
101 | |||
102 | return anim; | ||
103 | } | ||
104 | |||
105 | getChan() { | ||
106 | BallNum = (integer) llGetSubString(llGetScriptName(),-1,-1); //offset from script name suffix | ||
107 | ch = BallNum | ||
108 | + (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim | ||
109 | } | ||
110 | |||
111 | default { | ||
112 | state_entry() { | ||
113 | state s_on; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | state s_on { | ||
118 | state_entry() { | ||
119 | getChan(); | ||
120 | llListen(ch+8,"",NULL_KEY,""); | ||
121 | } | ||
122 | |||
123 | on_rez(integer arg) { | ||
124 | state default; | ||
125 | } | ||
126 | |||
127 | link_message(integer from, integer num, string an, key id) { //an animation is set | ||
128 | if (an == "PRIMTOUCH") { | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | if (num != ch) return; | ||
133 | an = getExpression(an); // get & save expression, and return unadorned anim | ||
134 | |||
135 | if (avatar == llGetPermissionsKey() | ||
136 | && avatar != NULL_KEY | ||
137 | && animation != "") { | ||
138 | llStopAnimation(animation); | ||
139 | llMessageLinked(LINK_SET, -11002, (string)BallNum + "|" + an, avatar); | ||
140 | startAnim(an); | ||
141 | } | ||
142 | animation = an; | ||
143 | } | ||
144 | |||
145 | timer() { // timer to keep mouth open | ||
146 | if (Expression == "SLEEP") { | ||
147 | llStartAnimation("express_disdain"); | ||
148 | llStartAnimation("express_smile"); | ||
149 | } else if (Expression != "") { | ||
150 | llStartAnimation(Expression); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | listen(integer channel, string name, key id, string str) { | ||
155 | if (str == "ALIVE" || str == "DIE") { | ||
156 | llMessageLinked(LINK_THIS,2,str,""); //send msg from ball to menu | ||
157 | if (str == "DIE") { | ||
158 | avatar = NULL_KEY; | ||
159 | llSetTimerEvent(0.0); | ||
160 | } | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | avatar = (key) str; //avatar (sit) or NULL_KEY (stand up) | ||
165 | if (avatar == NULL_KEY) { | ||
166 | if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { | ||
167 | stopAnim(); | ||
168 | llMessageLinked(LINK_SET, -11001, (string)BallNum, llGetPermissionsKey()); | ||
169 | } | ||
170 | // llReleaseControls(); | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | if (avatar != llGetPermissionsKey() | ||
175 | || ! (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) { | ||
176 | ExprEnabled = TRUE; | ||
177 | llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); | ||
178 | } else { | ||
179 | stopAnim(); | ||
180 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
181 | startAnim(animation); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | run_time_permissions(integer perm) { | ||
186 | if (avatar != llGetPermissionsKey()) { | ||
187 | llWhisper(DEBUG_CHANNEL, "avatar != perm key"); | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | if (perm & PERMISSION_TRIGGER_ANIMATION) { | ||
192 | stopAnim(); | ||
193 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
194 | startAnim(animation); | ||
195 | } else { | ||
196 | llMessageLinked(LINK_SET, -11001, (string)BallNum, avatar); | ||
197 | llSetTimerEvent(0.0); | ||
198 | } | ||
199 | } | ||
200 | } | ||
diff --git a/LuaSL/Test sim/objects/onefang's test bed/~poser 5 b/LuaSL/Test sim/objects/onefang's test bed/~poser 5 new file mode 100644 index 0000000..fc976c4 --- /dev/null +++ b/LuaSL/Test sim/objects/onefang's test bed/~poser 5 | |||
@@ -0,0 +1,200 @@ | |||
1 | // MPLV2 2.3 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 | ||
5 | |||
6 | integer ch; | ||
7 | string animation = "stand"; | ||
8 | key avatar; | ||
9 | |||
10 | integer ExprEnabled = TRUE; | ||
11 | string Expression; | ||
12 | float ExprTimer; | ||
13 | |||
14 | integer BallNum; | ||
15 | |||
16 | list Expressions = [ | ||
17 | "" | ||
18 | , "express_open_mouth" // 1 | ||
19 | , "express_surprise_emote" // 2 | ||
20 | , "express_tongue_out" // 3 | ||
21 | , "express_smile" // 4 | ||
22 | , "express_toothsmile" // 5 | ||
23 | , "express_wink_emote" // 6 | ||
24 | , "express_cry_emote" // 7 | ||
25 | , "express_kiss" // 8 | ||
26 | , "express_laugh_emote" // 9 | ||
27 | , "express_disdain" // 10 | ||
28 | , "express_repulsed_emote" // 11 | ||
29 | , "express_anger_emote" // 12 | ||
30 | , "express_bored_emote" // 13 | ||
31 | , "express_sad_emote" // 14 | ||
32 | , "express_embarrassed_emote" // 15 | ||
33 | , "express_frown" // 16 | ||
34 | , "express_shrug_emote" // 17 | ||
35 | , "express_afraid_emote" // 18 | ||
36 | , "express_worry_emote" // 19 | ||
37 | , "SLEEP" // 20 | ||
38 | ]; | ||
39 | |||
40 | |||
41 | stopAnim() { | ||
42 | key id = llGetPermissionsKey(); | ||
43 | list anims = llGetAnimationList(id); | ||
44 | integer ix; | ||
45 | for (ix = 0; ix < llGetListLength(anims); ++ix) { | ||
46 | string anim = llList2String(anims, ix); | ||
47 | if (anim != "") { | ||
48 | llStopAnimation(anim); | ||
49 | } | ||
50 | } | ||
51 | llSetTimerEvent(0.0); | ||
52 | } | ||
53 | |||
54 | startAnim(string anim) { | ||
55 | if (Expression != "") { | ||
56 | if (Expression == "SLEEP") { | ||
57 | llStartAnimation("express_disdain"); | ||
58 | llStartAnimation("express_smile"); | ||
59 | } else { | ||
60 | llStartAnimation(Expression); | ||
61 | } | ||
62 | if (ExprEnabled) { | ||
63 | llSetTimerEvent(ExprTimer); | ||
64 | } | ||
65 | } else { | ||
66 | stopAnim(); | ||
67 | } | ||
68 | if (anim != "") { | ||
69 | llStartAnimation(anim); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | // Animation names with a "*" suffix get open mouth | ||
74 | // Those with a suffix of "::" followed by a number | ||
75 | // get the expression associated with that number. | ||
76 | // This can optionally be followed by another "::" delim, | ||
77 | // with a timer value following. | ||
78 | // Return the anim name without the suffix. | ||
79 | string getExpression(string anim) { | ||
80 | if (llGetSubString(anim,-1,-1) == "*") { | ||
81 | Expression = llList2String(Expressions, 1); | ||
82 | ExprTimer = 0.5; | ||
83 | return llGetSubString(anim, 0, -2); | ||
84 | } | ||
85 | integer ix = llSubStringIndex(anim, "::"); | ||
86 | if (ix == -1) { | ||
87 | Expression = ""; | ||
88 | ExprTimer = 0.5; | ||
89 | return anim; | ||
90 | } | ||
91 | |||
92 | list parms = llParseString2List(anim, ["::"], []); | ||
93 | anim = llList2String(parms, 0); | ||
94 | integer exprIx = (integer) llList2String(parms, 1); | ||
95 | Expression = llList2String(Expressions, exprIx); | ||
96 | ExprTimer = (float) llList2String(parms,2); | ||
97 | |||
98 | if (ExprTimer <= 0.0) { | ||
99 | ExprTimer = 0.5; | ||
100 | } | ||
101 | |||
102 | return anim; | ||
103 | } | ||
104 | |||
105 | getChan() { | ||
106 | BallNum = (integer) llGetSubString(llGetScriptName(),-1,-1); //offset from script name suffix | ||
107 | ch = BallNum | ||
108 | + (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim | ||
109 | } | ||
110 | |||
111 | default { | ||
112 | state_entry() { | ||
113 | state s_on; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | state s_on { | ||
118 | state_entry() { | ||
119 | getChan(); | ||
120 | llListen(ch+8,"",NULL_KEY,""); | ||
121 | } | ||
122 | |||
123 | on_rez(integer arg) { | ||
124 | state default; | ||
125 | } | ||
126 | |||
127 | link_message(integer from, integer num, string an, key id) { //an animation is set | ||
128 | if (an == "PRIMTOUCH") { | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | if (num != ch) return; | ||
133 | an = getExpression(an); // get & save expression, and return unadorned anim | ||
134 | |||
135 | if (avatar == llGetPermissionsKey() | ||
136 | && avatar != NULL_KEY | ||
137 | && animation != "") { | ||
138 | llStopAnimation(animation); | ||
139 | llMessageLinked(LINK_SET, -11002, (string)BallNum + "|" + an, avatar); | ||
140 | startAnim(an); | ||
141 | } | ||
142 | animation = an; | ||
143 | } | ||
144 | |||
145 | timer() { // timer to keep mouth open | ||
146 | if (Expression == "SLEEP") { | ||
147 | llStartAnimation("express_disdain"); | ||
148 | llStartAnimation("express_smile"); | ||
149 | } else if (Expression != "") { | ||
150 | llStartAnimation(Expression); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | listen(integer channel, string name, key id, string str) { | ||
155 | if (str == "ALIVE" || str == "DIE") { | ||
156 | llMessageLinked(LINK_THIS,2,str,""); //send msg from ball to menu | ||
157 | if (str == "DIE") { | ||
158 | avatar = NULL_KEY; | ||
159 | llSetTimerEvent(0.0); | ||
160 | } | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | avatar = (key) str; //avatar (sit) or NULL_KEY (stand up) | ||
165 | if (avatar == NULL_KEY) { | ||
166 | if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { | ||
167 | stopAnim(); | ||
168 | llMessageLinked(LINK_SET, -11001, (string)BallNum, llGetPermissionsKey()); | ||
169 | } | ||
170 | // llReleaseControls(); | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | if (avatar != llGetPermissionsKey() | ||
175 | || ! (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) { | ||
176 | ExprEnabled = TRUE; | ||
177 | llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); | ||
178 | } else { | ||
179 | stopAnim(); | ||
180 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
181 | startAnim(animation); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | run_time_permissions(integer perm) { | ||
186 | if (avatar != llGetPermissionsKey()) { | ||
187 | llWhisper(DEBUG_CHANNEL, "avatar != perm key"); | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | if (perm & PERMISSION_TRIGGER_ANIMATION) { | ||
192 | stopAnim(); | ||
193 | llMessageLinked(LINK_SET, -11000, (string)BallNum + "|" + animation, avatar); | ||
194 | startAnim(animation); | ||
195 | } else { | ||
196 | llMessageLinked(LINK_SET, -11001, (string)BallNum, avatar); | ||
197 | llSetTimerEvent(0.0); | ||
198 | } | ||
199 | } | ||
200 | } | ||