Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Pose Balls MultiLove_Pose  

MultiLove_Pose

Multi-Love Pose.lsl

Category: Pose Balls
By : Miffy Fluffy
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for MultiLove_Pose
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. MultiLove_Pose_1.lsl
Get file # 2. MultiLove_Pose_2.lsl
1
2 //MLP MULTI-LOVE-POSE 1.0 - Copyright (c) 2006, by Miffy Fluffy (BSD License)
3 //To donate, go to my profile (Find - People - Miffy Fluffy) and use the "Pay..." button, thanks!
4 //You can also find the link to the latest version here.
5
6 // DESCRIPTION OF THE SCRIPTS
7 //
8 // ~run:
9 // Default: sets other scripts to not running.
10 // When the object is touched it will start all scrips.
11 //
12 // ~memory:
13 // Here the positions are stored permanently. Information is still kept when the script is
14 // not running or when everything is placed in inventory. The information will be lost only
15 // when the ~memory script is reset.
16 // A backup can be made on the .POSITIONS notecard, when the memory is empty, it will start
17 // reading the .POSITIONS notecard automatically.
18 //
19 // ~menu:
20 // 1.loading: reads the .MENUITEMS notecard and builds the menu.
21 // When it reads a "POSE": - the animations are stored in ~pose
22 // - their matching positions are looked up in ~memory and stored
23 // in ~pos.
24 // 2.ready:
25 // When the object is touched: - shows the main menu
26 // - listens for menu selections.
27 //
28 // When a submenu is selected: - shows the submenu
29 // - when balls are defined for this submenu it will rez
30 // balls (if not already there) and set their colors.
31 //
32 // When a pose is selected: - ~pose will send the animations to ~pose1 and ~pose2,
33 // they will set the animations to the avatars
34 // - ~pos wil send the matching positions to each ball.
35 //
36 // When a position is saved: - ~pose will ask the balls for their position
37 // - the positions are saved in ~memory ("permanent")
38 // - the positions are updated in ~pos
39 //
40 // When "STOP" is selected: - will hide the balls
41 // - will stop the pose
42 // When "STOP" is selected again (or if no pose is started yet):
43 // - will remove the balls (derez/die)
44 //
45 // ~pos:
46 // - loads the positions from ~memory and stores them (until shutdown/restart)
47 // - sends positions for the selected pose to the balls
48 //
49 // ~pose:
50 // - loads the animations from the .MENUITEMS notecard and stores them (until shutdown/restart)
51 // - sends animations for the selected pose to ~pose1 and ~pose2
52 // - when saving a position: will ask balls for their position and sends it to ~pos and ~memory
53 // (~pos would be a more logical place to handle this, but ~pose has more free memory).
54 //
55 // ~pose1 & pose2:
56 // - will ask permission to animate the avatar on ball 1&2
57 // - will set the animations to avatar 1&2
58 //
59 // ~ball
60 // - when balls are defined for a submenu (in .MENUITEMS), ~menu will rez two copies of ~ball
61 // - ball 1&2 will receive a unique communication channel from ~menu
62 // - the color for ball 1&2 is set by ~menu
63 // - the position of ball 1&2 is set by ~pos
64 // - when an avatar selects to sit on a ball, the avatar info is sent to ~pose1 or ~pose2, they
65 // will ask permission and set the animation directly to the avatar (not via the ball)
66 // - balls will commit suicide when they don't hear a "LIVE" message each minute (from ~menu).
67 //
68 // have fun!
69
70 //Note: if you make a revised version, please mention something like this:
71 //"MLP - alternative version by ... .... - Revision 1 (based on MLP 1.0 by Miffy Fluffy)
72
73 setRunning(integer st) {
74 llSetScriptState("~menu", st);
75 llSetScriptState("~pos", st);
76 llSetScriptState("~pose", st);
77 llSetScriptState("~pose1", st);
78 llSetScriptState("~pose2", st);
79 llResetOtherScript("~menu");
80 llSetScriptState("~memory", TRUE);
81 }
82 default {
83 state_entry() {
84 llOwnerSay("OFF (touch to switch on)");
85 setRunning(FALSE);
86 }
88 if(llDetectedKey(0) == llGetOwner()) state run;
89 }
90 }
91 state run {
92 state_entry() {
93 llOwnerSay("Starting...");
94 setRunning(TRUE);
95 }
96 }
97 // END //

MultiLove_Pose

This is one of seven scripts in the base object, along with the script in the rezzable poseball.

Category: Pose Balls
By : Miffy Fluffy
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 //MLP MULTI-LOVE-POSE V1.1 - Copyright (c) 2006, by Miffy Fluffy (BSD License)
2 integer PINK1 = 1; //0001 binary
3 integer BLUE1 = 2; //0010 binary
4 integer PINK2 = 4; //0100 binary
5 integer BLUE2 = 8; //1000 binary
6 integer a;
7 integer all;
8 integer b;
9 integer b0;
10 integer c;
11 integer ch;
12 integer chat;
13 integer hear;
14 integer i;
15 integer line;
16 integer menu;
17 integer redo;
18 integer rez;
19 integer swap;
20 integer visible;
21 float alpha;
22 string cmd;
23 string pose;
24 string pose0;
25 key owner;
26 key user;
27 list buttons;
28 list buttonindex;
29 list commands;
30 list mbuttons;
31 list menus;
32 list balls;
33 list users;
34
35 //menu partly based on Menu Engine by Zonax Delorean (BSD License)
36 //llDialog(user, menuname, buttons(from index to nextindex-1), channel)
37 doMenu() {
38 b0 = llList2Integer(buttonindex, menu); //position of first button for this (sub)menu
39 b = llList2Integer(buttonindex, menu+1); //position of first button for next (sub)menu
40 mbuttons = llList2List(buttons, b0, b - 1); //buttons for this (sub)menu
41 llListenRemove(hear);
42 hear = llListen(ch - b0, "", user, ""); //listen for pressed buttons
43 llDialog(user, llList2String(menus,menu), mbuttons, ch - b0);
44 c = llList2Integer(balls,menu); //ballcolors
45 if(c) { //if submenu includes ballcolor(s):
46 if(!rez) rezBalls(); //if no balls present: create balls
47 llSay(ch,(string)(c & 3)); //ball1color: mask with 3 = 0011 binary
48 llSay(ch+1,(string)(c >> 2)); //ball2color: shift 2 bits to the right
49 }
50 if(user != owner) llOwnerSay("("+llKey2Name(user)+" selects "+llList2String(menus,menu)+")");
51 }
52 say(string str) {
53 if(all) llWhisper(0,str);
54 else llOwnerSay(str);
55 }
56 setBalls(string cmd) {
57 llSay(ch,cmd); //msg to balls
58 llSay(ch+1,cmd);
59 }
60 rezBalls() {
61 setBalls("DIE");
64 llMessageLinked(LINK_THIS,0,"REPOS",NULL_KEY); //msg to pos
65 llMessageLinked(LINK_THIS,0,"POSE","0"); //msg to pos/pose
66 rez = 1;
67 pose = pose0;
69 if(chat) say("Balls ready");
70 }
71
72 default {
73 state_entry() {
74 llSetScriptState("~run", TRUE);
75 llResetOtherScript("~pos");
76 llResetOtherScript("~pose");
77 llResetOtherScript("~pose1");
78 llResetOtherScript("~pose2");
79 ch = (integer)("0x"+llGetSubString((string)llGetKey(),-4,-1)); //fixed channel for prim
80 setBalls("DIE");
81 owner = llGetOwner();
82 alpha = llGetAlpha(0); //store object transparancy (alpha)
83 if(alpha < 0.1) alpha = 0.5; else visible = 1; //if invisible store a visible alpha
84 llMessageLinked(LINK_THIS,1,"OK?",NULL_KEY); //msg to memory: ask if ready
85 }
86 link_message(integer from, integer num, string str, key id) {
87 if(num == 2) state load; //memory ready
88 }
89 }
90 state load {
91 state_entry() {
92 llGetNotecardLine(".MENUITEMS",0); //read first line of menuitems notecard
93 }
94 dataserver(key query_id, string data) {
95 if(data == EOF) state on;
96 i = llSubStringIndex(data,"//"); //remove comments
97 if(i != -1) {
98 if(i == 0) data = "";
99 else data = llGetSubString(data, 0, i - 1);
100 }
101 while(llGetSubString(data, -1, -1) == " ") data = llDeleteSubString(data, -1, -1); //remove spaces from end
102 if(data != "") {
103 i = llSubStringIndex(data," ");
104 cmd = data;
105 if(i != -1) { //split command from data
106 cmd = llGetSubString(data, 0, i - 1);
107 data = llGetSubString(data, i+1, -1);
108 }
109 list ldata = llParseString2List(data,[" | "," | "," | "," | "," |","| ","|"],[]);
110 data = llList2String(ldata, 0);
111 if(cmd == "MENU") {
112 llOwnerSay("loading data for '"+data+"'");
113 if(!menu) { //main menu
114 if(!a) llOwnerSay("warning: first item in .MENUITEMS must be: POSE stand");
115 if(a<=1) llOwnerSay("warning: second item in .MENUITEMS must be: POSE default");
116 } else {
117 if(llList2String(ldata, 1) == "OWNER") menu = 0; //0 = owner only, 1 = all users
118 pose = llList2String(ldata, 2);
119 if(pose == "PINK") rez = PINK1;
120 else if(pose == "BLUE") rez = BLUE1;
121 pose = llList2String(ldata, 3);
122 if(pose == "PINK") rez += PINK2;
123 else if(pose == "BLUE") rez += BLUE2;
124 }
125 menus += [ data ];
126 balls += [ rez ];
127 buttonindex += [ b ];
128 users += [ menu ];
129 rez = 0;
130 b0 = 0;
131 menu = 1;
132 } else if(b0 < 12) { //maximum 12 buttons per menu
133 if(cmd == "POSE") {
134 llMessageLinked(LINK_THIS,1,data,(string)a); //msg to memory
135 llMessageLinked(LINK_THIS,9+a,llList2String(ldata, 1),llList2String(ldata, 2)); //msg to pose
136 if(!a) pose0 = data;
137 cmd = (string)a;
138 ++a;
139 } else if(cmd == "REDO") {
140 if(llList2String(ldata, 1) == "ON") redo = 1;
141 } else if(cmd == "CHAT") {
142 if(llList2String(ldata, 1) == "ON") chat = 1;
143 } else if(cmd == "USERS") {
144 if(llList2String(ldata, 1) == "ON") all = 1;
145 }
146 commands += [ cmd ];
147 buttons += [ data ];
148 ++b;
149 ++b0;
150 }
151 }
152 ++line;
153 llGetNotecardLine(".MENUITEMS",line); //read next line of menuitems notecard
154 }
155 state_exit() {
156 buttonindex += [ b ]; //enter last buttonindex
157 llOwnerSay("READY");
158 llOwnerSay((string)b+" menuitems loaded ("+llGetScriptName()+": "+(string)llGetFreeMemory()+" bytes free)");
159 llMessageLinked(LINK_THIS,1,"LOADED",(string)a); //msg to memory
160 llMessageLinked(LINK_THIS,9+a,"LOADED",NULL_KEY); //msg to pose
161 }
162 }
163 state on {
164 state_entry() {
166 }
168 user = llDetectedKey(0);
169 if(user == owner || all) {
170 menu = 0; doMenu(); //mainmenu
171 }
172 }
173 listen(integer channel, string name, key user, string button) {
174 if(button == "DIE") { menu = 0; rez = 0; return; } //suicide msg from ball
175 b = b0 + llListFindList(mbuttons,[ button ]); //find position of cmd
176 string cmd = llList2String(commands,b); //get command
177 //llSay(0,button+" "+cmd); //debug
178 if(cmd == "TOMENU") {
179 menu = llListFindList(menus,[ button ]); //find submenu
180 if(menu == -1) return;
181 if(user == owner || llList2Integer(users, menu)) {
182 doMenu(); return;
183 }
184 llWhisper(0,button+" menu deactivated (access by owner only)");
185 menu = 0;
186 } else if(cmd == "BACK") {
187 menu = 0; doMenu(); //mainmenu
188 return;
189 } else if((integer)cmd > 0) { //POSE
190 llMessageLinked(LINK_THIS,0,"POSE",cmd); //msg to pos/pose
191 if(chat) say(button);
192 pose = button;
193 } else if(cmd == "SWAP") {
194 llMessageLinked(LINK_THIS,0,"SWAP",NULL_KEY); //msg to pos/pose
195 swap = !swap;
196 } else if(cmd == "STOP") {
197 llMessageLinked(LINK_THIS,0,"POSE","0"); //STAND msg to pos/pose
198 if(chat) say(button);
199 if(pose == pose0) { //Balls OFF
200 setBalls("DIE");
201 if(chat && rez) say("Balls removed");
202 rez = 0;
204 }
205 menu = 0;
206 pose = pose0;
207 } else if(cmd == "ADJUST") {
208 setBalls("ADJUST");
209 } else if(cmd == "HIDE") {
210 setBalls("0");
211 } else if(cmd == "SHOW") {
212 setBalls("SHOW");
213 } else if(cmd == "DUMP") {
215 } else if(cmd == "INVISIBLE") {
216 visible = !visible;
217 llSetAlpha((float)visible*alpha, ALL_SIDES);
218 } else if(cmd == "REDO") {
219 redo = !redo;
220 if(redo) say(button+" ON"); else say(button+" OFF");
221 } else if(cmd == "CHAT") {
222 chat = !chat;
223 if(chat) say(button+" ON"); else say(button+" OFF");
224 } else if(cmd == "USERS") {
225 if(user == owner) {
226 all = !all;
227 if(all) llOwnerSay(button+" ON"); else llOwnerSay(button+" OFF");
228 } else llWhisper(0,button+" ON (can be switched by owner only)");
229 } else if(cmd == "OFF" || cmd == "RESET") {
230 llMessageLinked(LINK_THIS,0,"POSE","0"); //STAND msg to pos/pose
231 if(chat) llOwnerSay(button);
232 setBalls("DIE");
233 llSleep(0.5);
234 if(user == owner) {
235 if(cmd == "OFF") llResetOtherScript("~run");
237 }
238 llWhisper(0,button+" deactivated (owner only)");
239 rez = 0;
241 } else { //SAVE //Z-adjust
242 if(user == owner) {
243 llMessageLinked(LINK_THIS,0,cmd,pose); //msg to pose
244 doMenu(); return;
245 } llWhisper(0,button+" deactivated (owner only)");
246 }
247 if(redo) doMenu();
248 }
249 on_rez(integer r) {
250 rez = 0;
252 }
253 timer() {
254 llWhisper(ch,"LIVE"); //msg to balls: stay alive
255 llWhisper(ch+1,"LIVE");
256 }
257 }

Back to the Best Free Tools in Second Life and OpenSim.