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
Building Open_Table  

Open_Table

Table script. Add to the table this script and a chair. The name should be 1 Prim Chair, or you must change the name in the notecard

Category: Building
By : Falados Kapuskas
Created: 2011-08-09 Edited: 2011-08-09
Worlds: Second Life

the Zip file

Download all files for Open_Table
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Open_Table_1.lsl
Get file # 2. Open_Table_2.lsl
Get file # 3. Open_Table_3.lsl
1
2 // This file is part of Open Round-Table.
3 //
4 // Open Round-Table is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Open Round-Table is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Open Round-Table. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // Author: Falados Kapuskas
18 // Version: 1.0
19
20 integer BROADCAST_CHANNEL;
21 integer OCCUPIED=0;
22 integer TOTAL_CHAIRS=0;
23 integer MIN_CHAIRS=1;
24 float Z_OFFSET = 0.0;
25 float RADIUS = 4;
26 float ANGLE = TWO_PI;
27 float ELBOW_ROOM = 1.5;
28 string CHAIR_OBJECT;
29 key gDataserverRequest;
30 integer CHANNEL_MASK = 0xFFFFFF00;
31 integer CHAIR_MASK = 0xFF;
32 integer MAX_CHAIRS = 0xFF;
33 integer gReadLine;
34
35 check()
36 {
37 if( OCCUPIED >= TOTAL_CHAIRS || TOTAL_CHAIRS < MIN_CHAIRS )
38 {
39 if( TOTAL_CHAIRS < MAX_CHAIRS ) //Dont overflow the mask (Max 255 chairs)
40 {
41 rotation quat = llEuler2Rot(<0, 0, -90> * DEG_TO_RAD );
42 llRezObject(CHAIR_OBJECT,llGetPos()+llRot2Fwd(llGetRot())*RADIUS,ZERO_VECTOR,llGetRot() * quat,BROADCAST_CHANNEL | TOTAL_CHAIRS);
43 }
44 }
45 }
46
47 default
48 {
49 on_rez(integer param)
50 {
52 }
54 {
56 {
57 gReadLine = 1;
58 gDataserverRequest = llGetNotecardLine("Config",gReadLine);
59 } else {
60 llOwnerSay("Couldn't Find Notecard: 'Config'");
61 }
62 }
63 dataserver(key req, string data)
64 {
65 if(req == gDataserverRequest)
66 {
67 if(data == EOF) state active;
68 if(gReadLine == 1)
69 {
70 CHAIR_OBJECT = data;
71 if(llGetInventoryType(data) == INVENTORY_NONE) return;
72 }
73 if(gReadLine == 3) RADIUS = (float)data;
74 if(gReadLine == 5) ELBOW_ROOM = (float)data;
75 if(gReadLine == 7)
76 {
77 MIN_CHAIRS = (integer)data;
78 if(MIN_CHAIRS < 1) MIN_CHAIRS = 1;
79 }
80 if(gReadLine == 9) Z_OFFSET = (float)data;
81 if(gReadLine == 11)
82 {
83 MAX_CHAIRS = (integer)data;
84 if(MAX_CHAIRS > 255 ) MAX_CHAIRS = 255; //Over 255 will overflow the mask
85 else if(MAX_CHAIRS < 1) MAX_CHAIRS = 1; //What the hell are you doing?
86 }
87 gReadLine += 2;
88 gDataserverRequest = llGetNotecardLine("Config",gReadLine);
89 }
90 }
91 changed(integer change)
92 {
94 {
95 gReadLine = 1;
96 gDataserverRequest = llGetNotecardLine("Config",gReadLine);
97 } else {
98 llOwnerSay("Couldn't Find Notecard: 'Config'");
99 }
100 }
101 }
102
103
104 state active
105 {
107 {
108 BROADCAST_CHANNEL = (integer)(llFrand(-1e6) - 1e6) & CHANNEL_MASK;
109 llListen(BROADCAST_CHANNEL,"","","");
110 check();
111 }
112
113 on_rez(integer param)
114 {
115 llRegionSay(BROADCAST_CHANNEL,"#die#");
117 }
118
119 listen(integer channel, string name, key id, string message)
120 {
121 if( llSubStringIndex(message,"#sit#") == 0)
122 {
123 ++OCCUPIED;
124 }
125 if( llSubStringIndex(message,"#unsit#") == 0)
126 {
127 --OCCUPIED;
128 if( TOTAL_CHAIRS > MIN_CHAIRS)
129 {
130 llRegionSay(BROADCAST_CHANNEL,"#die#" + llGetSubString(message,7,-1));
131 --TOTAL_CHAIRS;
132 }
133 }
134 check();
135 }
136
137 changed(integer change)
138 {
139 if(change && CHANGED_INVENTORY)
140 {
141 llRegionSay(BROADCAST_CHANNEL,"#die#");
143 }
144 }
145 object_rez(key id)
146 {
147 llShout(BROADCAST_CHANNEL,"#table#" + llList2CSV([RADIUS,ANGLE,ELBOW_ROOM,Z_OFFSET,++TOTAL_CHAIRS]));
148 check();
149 }
150 }

Open_Table

Add a notecard called 'Config' to the table. Do not change the order or number of lines in this notecard.

Category: Building
By : Falados Kapuskas
Created: 2011-08-09 Edited: 2011-08-09
Worlds: Second Life

1 ==== Chair Object Name ====
2 1 prim chair
3 ==== Minimum Distance from Table (In Meters) ====
4 1.2
5 ==== Minimum Distance from surrounding chairs (In Meters) ====
6 0.5
7 ==== Minimum number of chairs to show (1 or more) ====
8 1
9 ==== Chair's Offset (Z Offset) ====
10 -0.2
11 ==== Maximum number of chairs ====
12 8

Open_Table

The chair script. Put this in a prim called '1 Prim Chair', or change the notecard to your chair

Category: Building
By : Falados Kapuskas
Created: 2011-08-09 Edited: 2011-08-09
Worlds: Second Life

1 // This file is part of Open Round-Table.
2 //
3 // Open Round-Table is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // Open Round-Table is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Open Round-Table. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // Author: Falados Kapuskas
17 // Version: 1.0
18
19 vector wtf = <0,00, 90>;
20
21 float REFRESH_TIME = 1.0;
22
23 integer BROADCAST_CHANNEL=-1;
24 integer CHAIR_NUM;
25 integer MAX_CHAIRS;
26 float Z_OFFSET;
27 float RADIUS;
28 float ANGLE;
29 float ELBOW_ROOM;
30
31 integer CHANNEL_MASK = 0xFFFFFF00;
32 integer CHAIR_MASK = 0xFF;
33 key gTable;
34
35
36 apply()
37 {
38 if(llKey2Name(gTable) == "") llDie();
39 list params = llGetObjectDetails(gTable,[OBJECT_POS,OBJECT_ROT" title="View Definition" class="tooltip">OBJECT_ROT]);
40 rotation rot = llList2Rot(params,1);
41 vector pos = llList2Vector(params,0);
42 float t = 0;
43 float n = MAX_CHAIRS;
44 float theta = ANGLE;
45 if(n > 0)
46 {
47 t = llFabs(CHAIR_NUM/n);
48 theta = ANGLE/(n);
49 }
50 float arc_len = RADIUS * theta;
51 if(arc_len < ELBOW_ROOM)
52 {
53 RADIUS = ELBOW_ROOM / theta;
54 }
55 float tangle = t*ANGLE;
56 vector o = <llCos(tangle),llSin(tangle),0>*RADIUS;
57 o.z = Z_OFFSET;
58 vector position = pos + o*rot;
59 llSetPos(position);
60 llSetRot( llEuler2Rot(<0,0,PI/2>) * llEuler2Rot(<0,0,tangle>)*rot );
61 }
62
63 default
64 {
65
67 {
68 llSetSitText("Be Seated");
69 rotation quat = llEuler2Rot(wtf* DEG_TO_RAD);
70 llSitTarget(<0.0, 1.0, 0.1>, quat);
71 }
72
73
75 {
76 BROADCAST_CHANNEL = i & CHANNEL_MASK;
77 CHAIR_NUM = i & CHAIR_MASK;
78 llListen(BROADCAST_CHANNEL,"","","");
79 }
80
81 listen(integer channel, string name, key id, string message)
82 {
83 if(llSubStringIndex(message,"#table#") == 0 )
84 {
85 list params = llCSV2List( llGetSubString(message,7,-1) );
86 gTable = id;
87 RADIUS = llList2Float(params,0);
88 ANGLE = llList2Float(params,1);
89 ELBOW_ROOM = llList2Float(params,2);
90 Z_OFFSET = llList2Float(params,3);
91 MAX_CHAIRS = llList2Integer(params,4);
92 llSetTimerEvent(2.0);
93 apply();
94 }
95 if(llSubStringIndex(message,"#die#") == 0 )
96 {
97 if( message == "#die#") llDie();
98 list params = llCSV2List( llGetSubString(message,5,-1) );
99 integer dienum = llList2Integer(params,0);
100 if(dienum == CHAIR_NUM) llDie();
101 if(dienum < CHAIR_NUM) --CHAIR_NUM;
102 --MAX_CHAIRS;
103 }
104 }
105
106 changed(integer change)
107 {
108 if(change & CHANGED_LINK)
109 {
110 integer i;
112 key sitting = llAvatarOnSitTarget();
114 for( i = 2; i <= prims; ++i)
115 {
117 {
118 sitting = llGetLinkKey(i);
119 jump done;
120 }
121 }
122 }
123 @done;
124 if( sitting == NULL_KEY)
125 {
126 llRegionSay(BROADCAST_CHANNEL,"#unsit#" + llList2CSV([CHAIR_NUM]));
127 } else {
128 llRegionSay(BROADCAST_CHANNEL,"#sit#" + llList2CSV([CHAIR_NUM]));
129 }
130 }
131 }
132
133 timer()
134 {
135 apply();
136 }
137 }

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