aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/Test sim/objects/onefang's test bed/~run
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/~run
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 '')
-rw-r--r--LuaSL/Test sim/objects/onefang's test bed/~run192
1 files changed, 192 insertions, 0 deletions
diff --git a/LuaSL/Test sim/objects/onefang's test bed/~run b/LuaSL/Test sim/objects/onefang's test bed/~run
new file mode 100644
index 0000000..c2c9943
--- /dev/null
+++ b/LuaSL/Test sim/objects/onefang's test bed/~run
@@ -0,0 +1,192 @@
1//MLPV2 Version 2.3 - Learjeff Innis, from
2//MLP MULTI-LOVE-POSE V1.2 - Copyright (c) 2006, by Miffy Fluffy (BSD License)
3//To donate, go to my profile (Search - People - Miffy Fluffy) and use the "Pay..." button, thanks!
4//You can also find the link to the latest version here.
5// OpenSim port by Jez Ember
6// Meta 7 fixes by onefang Rejected
7
8integer MAX_AVS = 6;
9integer ResetOnOwnerChange = FALSE;
10
11// DESCRIPTION OF THE SCRIPTS
12//
13// ~run:
14// Default: sets other scripts to not running.
15// When the object is touched it will start all scrips.
16//
17// ~memory:
18// Here the positions are stored permanently. Information is still kept when the script is
19// not running or when everything is placed in inventory. The information will be lost only
20// when the ~memory script is reset.
21// A backup can be made on the .POSITIONS notecard, when the memory is empty, it will start
22// reading the .POSITIONS notecard automatically.
23//
24// ~menu:
25// 1.loading: reads the .MENUITEMS notecard and builds the menu.
26// When it reads a "POSE": - the animations are stored in ~pose
27// - their matching positions are looked up in ~memory and stored
28// in ~pos.
29// 2.ready:
30// When the object is touched: - shows the main menu
31// - listens for menu selections.
32//
33// When a submenu is selected: - shows the submenu
34// - when balls are defined for this submenu it will rez
35// balls (if not already there) and set their colors.
36//
37// When a pose is selected: - ~pose will send the animations to ~pose1 and ~pose2,
38// they will set the animations to the avatars
39// - ~pos wil send the matching positions to each ball.
40//
41// When a position is saved: - ~pose will ask the balls for their position
42// - the positions are saved in ~memory ("permanent")
43// - the positions are updated in ~pos
44//
45// When "STOP" is selected: - will hide the balls
46// - will stop the pose
47// When "STOP" is selected again (or if no pose is started yet):
48// - will remove the balls (derez/die)
49//
50// ~pos:
51// - loads the positions from ~memory and stores them (until shutdown/restart)
52// - sends positions for the selected pose to the balls
53//
54// ~pose:
55// - loads the animations from the .MENUITEMS notecard and stores them (until shutdown/restart)
56// - sends animations for the selected pose to ~pose1 and ~pose2
57// - when saving a position: will ask balls for their position and sends it to ~pos and ~memory
58// (~pos would be a more logical place to handle this, but ~pose has more free memory).
59//
60// ~poser, ~poser 1, ~poser 2, ~poser 3 (one for each ball):
61// - will ask permission to animate the avatar on ball
62// - will set the animations to avatar
63//
64// ~ball
65// - when balls are defined for a submenu (in .MENUITEMS), ~menu will rez copies of ~ball
66// - each will receive a unique communication channel from ~menu
67// - the color for each ball is set by ~menu
68// - the position of each ball is set by ~pos
69// - when an avatar selects to sit on a ball, the avatar info is sent to the appropriate; they
70// will ask permission and set the animation directly to the avatar (not via the ball)
71// - balls will commit suicide when they don't hear a "LIVE" message each minute (from ~menu).
72//
73// have fun!
74
75//Note: if you make a revised version, please mention something like this:
76//"MLP - alternative version by ... .... - Revision 1 (based on MLP V1.2 by Miffy Fluffy)
77
78key Owner;
79
80list Scripts = [
81 "~menucfg"
82 , "~pos"
83 , "~pose"
84 , "~poser"
85 , "~poser 1"
86 , "~poser 2"
87 , "~poser 3"
88 , "~poser 4"
89 , "~poser 5"
90 ];
91
92list OptionalScripts = [
93 "~props"
94 , "~sequencer"
95 ];
96
97setRunning(integer st) {
98 integer ix;
99 list scripts = Scripts;
100 string script;
101
102 for (ix = 0; ix < 100; ++ix) {
103 integer jx;
104
105 // try to stop any remaining scripts in the list
106 for (jx = llGetListLength(scripts) - 1; jx >= 0; --jx) {
107 script = llList2String(scripts, jx);
108 if (llGetInventoryType(script) == INVENTORY_SCRIPT) {
109 llSetScriptState(script, st);
110 scripts = llDeleteSubList(scripts, jx, jx);
111 --jx;
112 }
113 }
114
115 // got them all yet?
116 if (llGetListLength(scripts) == 0) {
117 // Yes -- handle key ones
118 llSetScriptState("~memory", st);
119 llSetScriptState("~menu", st);
120 if (st) {
121 llResetOtherScript("~memory");
122 llResetOtherScript("~menu");
123 }
124
125 // start/stop optional scripts if present
126 for (jx = llGetListLength(OptionalScripts) - 1; jx >= 0; --jx) {
127 script = llList2String(OptionalScripts, jx);
128 if (llGetInventoryType(script) == INVENTORY_SCRIPT) {
129 llSetScriptState(script, st);
130 }
131 }
132 return;
133 }
134
135 llSleep(0.1);
136 }
137
138 llOwnerSay("missing scripts: " + llList2CSV(scripts));
139}
140
141setBalls(string cmd) {
142 integer ch = channel();
143 integer ix;
144
145 for (ix = 0; ix < MAX_AVS; ++ix) {
146 llSay(ch + ix, cmd); //msg to balls
147 }
148}
149
150integer channel() {
151 return (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1));
152}
153
154default {
155
156 state_entry() {
157 setBalls("DIE");
158 Owner = llGetOwner();
159 setRunning(FALSE);
160 llOwnerSay("OFF (touch to switch on)");
161 }
162
163 touch_start(integer i) {
164 if (llDetectedKey(0) == llGetOwner()) state run;
165 }
166
167 // Waits for another script to send a link message.
168 link_message(integer sender_num, integer num, string str, key id) {
169 if (str == "PRIMTOUCH" && id == llGetOwner()) {
170 state run;
171 }
172 }
173
174 changed(integer change) {
175 if (change & CHANGED_OWNER && Owner != llGetOwner()) {
176 llResetScript();
177 }
178 }
179}
180
181state run {
182 state_entry() {
183 setRunning(TRUE);
184 }
185 changed(integer change) {
186 if (ResetOnOwnerChange
187 && (change & CHANGED_OWNER)
188 && Owner != llGetOwner()) {
189 llResetScript();
190 }
191 }
192}