Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sit Script Problems

Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
02-14-2006 16:27
Now, I've been building furniture for a while and know my way around a sit script, but I've run into a problem, I've create a table and chairs in one, working the same way as a Picnic Bench.

The problem is, I need a sit script so people sit facing the table. When I put one in, the first person sits just fine, the second, however, sits back to front. I've experimented and found out this is because they're behind that seat.

I'm wondering if theres a way round this without resorting to carving up the seat part into individule seats, therefore making it many more prims.

Please let me know :)
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.
---------------
Zapoteth Designs, Temotu (100,50)
---------------
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
02-14-2006 16:31
I haven't tried it, but I think that setting a new sit target after each person sits would work.
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
02-14-2006 16:55
yep you need a new sit target for each person. It doesn't really have to be close to where you want them to sit. Can be any random prim that doesn't have a sit target already.

Few things to note:

1) Sittargets will be used in order unless an avatar right clicks a prim that has a sit target that's not being used in which case that sit target will be used. In order means by link numbers. so if an object has 3 unoccupied sit targets and someone sits on the object but not directly on one of the 3 targets, then the target in the lowest link number will be used.

2) Sittargets are kind of a pain in prims that aren't nicely rotated because that sit target is relative to the prim, not the object. Here's a script that will make them relative to the root prim instead of the prim they're in.

CODE

// You can change where they sit relative to the root prim here.
// IF this is set to <0.0, 0.0, 0.0> or ZERO_VECTOR, the sit target will be REMOVED!
vector sit_position = <0.0, 0.0, 0.1>;
// You can change which way they're rotated here.
rotation sit_rotation = ZERO_ROTATION;
// If you don't want to use a rotation but instead a Euler, set the above to ZERO_ROTATION and this variable to a vector representing DEGREES around each axis.
vector sit_euler = ZERO_VECTOR;

state_entry()
{
if (sit_rotation == ZERO_ROTATION) {
sit_rotation = llEuler2Rot(sit_euler);
}
llSitTarget(sit_position - (llGetLocalPos() / llGetLocalRot()), sit_rotation / llGetLocalRot());
}


I can't get in world to test this but I think it'll work.
_____________________
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
02-14-2006 17:36
Do I put multiple scripts in the same prim? Or do I have to resort to cutting them up for individule sit places.
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.
---------------
Zapoteth Designs, Temotu (100,50)
---------------
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
02-14-2006 17:47
IIRC sit target is a property of the prim. So if there's enough prims in the linkset (even if they're not anywhere near where you want to put people) you can put a different sit target script in each.

If there aren't enough prims, what I was suggesting is changing the sit target every time on a change event (LINK_CHANGE I think). The avatar already sitting should stay put and the new one should be placed at the new sit target.
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
02-14-2006 18:32
From: AJ DaSilva
IIRC sit target is a property of the prim. So if there's enough prims in the linkset (even if they're not anywhere near where you want to put people) you can put a different sit target script in each.

If there aren't enough prims, what I was suggesting is changing the sit target every time on a change event (LINK_CHANGE I think). The avatar already sitting should stay put and the new one should be placed at the new sit target.


There aren't enough.. Ok, I'll try to play with some scripts, and fail miserably :p , thanks!
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.
---------------
Zapoteth Designs, Temotu (100,50)
---------------
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
02-14-2006 18:58
Ugh, I just looked at what's involved in doing it and it's not fun...

Well I guess it might be okay, but it really depends on whether llAvatarOnSitTarget checks the location to see if there's an av there or just whether there's an av that sat using a sit target. Otherwise you'll have to keep a list of who's sitting on it and where and check to see who it was that stood up when they did.

Good luck.
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
02-14-2006 18:59
From: AJ DaSilva
Ugh, I just looked at what's involved in doing it and it's not fun...

Well I guess it might be okay, but it really depends on whether llAvatarOnSitTarget checks the location to see if there's an av there or just whether there's an av that sat using a sit target. Otherwise you'll have to keep a list of who's sitting on it and where and check to see who it was that stood up when they did.

Good luck.


Lol, uh-oh, might as well resort to seperate prims huh?

Thanks anyway :)
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.
---------------
Zapoteth Designs, Temotu (100,50)
---------------
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
02-14-2006 19:57
have to use separate prims, but as I said, they don't have to be anywhere near where the avatar actually sits, just use all your existing prims.
_____________________
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
02-15-2006 02:51
Unless they've broken something you DON'T have to use separate prims, you can set sit targets between different people sitting down, although there's doubtless much fun and confusion in getting it all working neatly.

If you search this forum for a thread I started with something about multiple sit targets in one prim you'll find an outline script that starts the job off just wonderfully.
Copper Surface
Wandering Carroteer
Join date: 6 Jul 2005
Posts: 157
02-15-2006 03:55
I've played with dynamically setting sittargets and found them workable depending on the level of script complexity you find acceptable. However, if your entire object has as many prims as the number of people you want sitting on it, you might as well put sittargets in them. If you find that putting sittargets in oddly oriented prims is a problem, I have a tool which lets you to visually adjust these sittargets easily without even scripting. I can send you a copy in world.
Hillary Melville
Emotionally Anarchic
Join date: 5 Jun 2005
Posts: 16
02-15-2006 04:09
From: Eloise Pasteur
If you search this forum for a thread I started with something about multiple sit targets in one prim you'll find an outline script that starts the job off just wonderfully.


Just to save anyone else who is interested the trouble of searching, here is the post that Ms Pasteur mentioned that contains the Elusive Secret of Multiple Sit Targets :)

/54/f8/64644/1.html#post676943