aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/media/Test sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~poser 1.lsl
diff options
context:
space:
mode:
Diffstat (limited to 'media/Test sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~poser 1.lsl')
-rw-r--r--media/Test sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~poser 1.lsl200
1 files changed, 200 insertions, 0 deletions
diff --git a/media/Test sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~poser 1.lsl b/media/Test sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~poser 1.lsl
new file mode 100644
index 0000000..fc976c4
--- /dev/null
+++ b/media/Test sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~poser 1.lsl
@@ -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
6integer ch;
7string animation = "stand";
8key avatar;
9
10integer ExprEnabled = TRUE;
11string Expression;
12float ExprTimer;
13
14integer BallNum;
15
16list 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
41stopAnim() {
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
54startAnim(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.
79string 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
105getChan() {
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
111default {
112 state_entry() {
113 state s_on;
114 }
115}
116
117state 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}