aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/media/Test%20sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~ball/~ball.lsl
diff options
context:
space:
mode:
Diffstat (limited to 'media/Test%20sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~ball/~ball.lsl')
-rw-r--r--media/Test%20sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~ball/~ball.lsl161
1 files changed, 161 insertions, 0 deletions
diff --git a/media/Test%20sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~ball/~ball.lsl b/media/Test%20sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~ball/~ball.lsl
new file mode 100644
index 0000000..ff5cca3
--- /dev/null
+++ b/media/Test%20sim/objects/onefang%27s%20test%20bed.5cb927d5-1304-4f1a-9947-308251ef2df0/~ball/~ball.lsl
@@ -0,0 +1,161 @@
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// To make ball phantom, put "*" as the first character in the ball's description
7// (The ball in MLP object's inventory should be non-phantom.)
8// The rest of the description, if any, is used for the sit pie menu and floating text.
9// To make this take effect, use STOP to unrez the balls, and then select any pose.
10
11integer Chan;
12integer Group;
13integer visible = TRUE;
14integer Adjusting;
15key Avatar;
16string Name;
17integer Handle;
18
19// 15 color support, thanks to Liz Silverstein
20// Color is passed as a string by object chat (from menu via poser*)
21
22list colors = [ <0.0,0.0,0.0>, // 0 = HIDE
23 <0.835,0.345,0.482>, // 1 = PINK
24 <0.353,0.518,0.827>, // 2 = BLUE
25 <0.635,0.145,0.282>, // 3 = PINK2 - Dark pink
26 <0.153,0.318,0.627>, // 4 = BLUE2 - Dark blue
27 <0.128,0.500,0.128>, // 5 = GREEN
28 <1.000,0.000,1.000>, // 6 = MAGENTA
29 <1.000,0.000,0.000>, // 7 = RED
30 <1.000,0.500,0.000>, // 8 = ORANGE
31 <1.000,1.000,1.000>, // 9 = WHITE
32 <0.0,0.0,0.0>, // 10 = BLACK
33 <1.0,1.0,0.0>, // 11 = YELLOW
34 <0.0,0.8,0.8>, // 12 = CYAN
35 <0.5,0.0,0.0>, // 13 = RED2
36 <0.0,0.5,0.5>, // 14 = TEAL
37 <0.0,0.25,0.25>]; // 15 = GREEN2
38
39
40render() {
41 if (!visible || (Avatar != NULL_KEY && !Adjusting)) {
42 // hidden
43 llSetScale(<0.01,0.01,0.01>);
44 llSetAlpha(0.0, ALL_SIDES);
45 llSetText("",<1.0,1.0,1.0>,1.0);
46 } else if (Avatar != NULL_KEY && Adjusting) {
47 // sitting and adjusting
48 llSetAlpha(0.2,ALL_SIDES);
49 llSetText("Adjust",<1.0,1.0,1.0>,1.0);
50 llSetScale(<0.1,0.1,5.0>);
51 } else {
52 // shown
53 llSetAlpha(1.0, ALL_SIDES);
54 llSetScale(<0.2,0.2,0.2>);
55 if (Adjusting) {
56 llSetText("Adjust",<1.0,1.0,1.0>,1.0);
57 } else {
58 llSetText(Name,<1.0,1.0,1.0>,1.0);
59 }
60 }
61}
62
63show() {
64 visible = TRUE;
65 render();
66}
67
68hide() {
69 visible = FALSE;
70 render();
71}
72
73default {
74 on_rez(integer channel) {
75 Name = llGetObjectDesc();
76 if (Name == "" || Name == "(No Description)") {
77 Name = "LOVE";
78 } else {
79 if (llSubStringIndex(Name, "*") == 0) {
80 llSetPrimitiveParams([PRIM_PHANTOM, TRUE]);
81 Name = llGetSubString(Name, 1, -1);
82 }
83 if (Name == "none") {
84 Name = "";
85 }
86 }
87 llSitTarget(<0.0,0.0,-0.1>,ZERO_ROTATION);
88 if (Name != "") {
89 llSetSitText(Name);
90 }
91 Avatar = NULL_KEY;
92 Chan = channel;
93 Group = 0;
94
95 if (Chan != 0) {
96 // register listen and start timer, unless ball was dragged from inv
97 llListenRemove(Handle);
98 Handle = llListen(Chan,"",NULL_KEY,"");
99 llSetTimerEvent(600.0);
100 }
101 }
102
103 changed(integer change) {
104 if (change != CHANGED_LINK) return;
105 Avatar = llAvatarOnSitTarget();
106 if (Group) {
107 if (Avatar != NULL_KEY && !llSameGroup(Avatar)) {
108 llUnSit(Avatar);
109 llWhisper(0,"no permission to use poseball");
110 return;
111 }
112 }
113 llSay(Chan+8,(string)Avatar); //requests perm, sets animation
114 render();
115 // if (visible & Avatar == NULL_KEY) show(); else hide();
116 }
117
118 listen(integer channel, string name, key object, string str) {
119 integer ix;
120 ix = llSubStringIndex(str,">");
121 if (ix != -1) {
122 llSetRot((rotation)llGetSubString(str,ix+1,-1));
123 llSetPos((vector)llGetSubString(str,0,ix));
124 } else if (str == "0") { //HIDE
125 hide();
126 } else if (str == "SHOW") { //SHOW
127 show();
128 } else if (str == "ADJUST|1") {
129 Adjusting = TRUE;
130 render();
131 } else if (str == "ADJUST|0") {
132 Adjusting = FALSE;
133 render();
134 } else if (str == "SAVE") {
135 llSay(Chan+16,(string)llGetPos()+(string)llGetRot());
136 } else if (str == "GROUP") {
137 Group = 1;
138 } else if (str == "ALL") {
139 Group = 0;
140 } else if (str == "DIE") {
141 llSay(Chan+8, (string)NULL_KEY); //msg to poser (don't reanimate after STOP)
142 llDie();
143 } else if (str == "LIVE") {
144 llSetTimerEvent(600.0);
145 } else {
146 list ldata = llParseString2List(str, ["|"], []);
147 integer colorIx = (integer) llList2String(ldata,0);
148 string ballIx = llList2String(ldata,1);
149 Adjusting = (integer) llList2String(ldata,2);
150 if ((colorIx > 0) && (colorIx < 16)) { // this must be a color setting
151 llSetColor(llList2Vector(colors, colorIx),ALL_SIDES); //pull the color out of the list
152 render();
153 llSetObjectName("~ball" + ballIx);
154 }
155 }
156 }
157
158 timer() { //not heard "LIVE" from menu for a while: suicide
159 llDie();
160 }
161}