# Table That Automatically Rezzes More Chairs

You are about to reply to a thread that has been inactive for 4404 days.

Please take a moment to consider if this thread is worth bumping.

## Recommended Posts

How are tables that automatically rezzes more chairs scripted?  The only thing I can think of is to set up a call to the main script that would increase when an avatar sits on a chair.  That would call for an additional chair, and the chairs would change its position to fit around the table.  When an avatar stands up, the chair that avatar was sitting on would disappear, and the chairs would be repositioned.  It is the repositioning that is frustrating.

##### Share on other sites

They tell me that's why we scripters get paid the big bucks.  :smileytongue:

Repositioning is always tricky.  If your table's a circle, though, this one is fairly easy to figure out.  Start with a minimal number of chairs (n = 2) around a small table.   Then, if both chairs are occupied,

(1) Increase the radius of the table

(2) Divide 2*PI by n+1 to get the number of radians between chair positions.  There are your new local rotations.

(3) Relocate the occupied chairs to two of the newly-calculated positions and rez a new chair at the n+1th position.

If someone stands up, remove the empty chair and do steps 1-3 in reverse.

You'll want to use llGetLinkPrimitiveParams(linkno,[PRIM_POS_LOCAL,PRIM_ROT_LOCAL]) to get the current positons/rotation of each chair if you don' already know them, and llSetLinkPrimitiveParamsFast for repositioning. them.

##### Share on other sites

Wow!  Much appreciation, Rolig!

I will definitely give this a try, and see what I can do.  It is always exciting to try new things, and see if you can solve it.  Kind of like a puzzle.

##### Share on other sites

That's what programming/scripting is .... solving logical puzzles.  Personally, I tend to lose interest once I know that I have solved the puzzle.  The finished product is nice, but all the fun for me is in creating it.

##### Share on other sites

This is a pretty trivial task actually. Make a strided list like this:

list chairs_data = [ stride1, stride2,..., strideN];

where N is a number of chairs.

Each stride is defined like this:

stride = vector position_offset_from_the root, vector rotation_offset_from_the_root_in_Euler_format, integer rezzed_flag(TRUE/FALSE), integer occupied_flag(TRUE/FALSE)

The list above contains all data needed to rez/remove chairs at preset locations and the flags are dynamically updated every time a chair is rezzed/removed.

##### Share on other sites

You are about to reply to a thread that has been inactive for 4404 days.

Please take a moment to consider if this thread is worth bumping.