Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Chair unwilling to share.

InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
08-01-2007 18:10
I need some help, I must be getting tired. I wanted to be sure this wasn't already talked out recently and read every entry in this Scripting tip section for 8 pages back.

Now for the trouble. I am a mediate scripter, and I seem to remember seeing this once somewhere. I have a chair, with a camera view adjustment to get you looking in a first person view, when you sit down. So you don't have the chair back to the wall, you don't see the wall behind you, and see in front of you.

It works great. Now I am having one small problem. It seems that once the chair (actually couch is linked, it seems someone is able to try to, and is successful in sitting on the same cushion as myself.

I don't want them to, seems it messes up both our cams, and the second person sits in some odd position, and if I get up, causes my cam to give a cam trying to clear without permissions error.

That only happens when two people sit on the same cushion and no other time.

I need something that will allow a person to stay on and not let another sit on the same cushion. Any help would be greatly appreciated.

-InuYasha Meiji
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
08-01-2007 19:22
Does the seat have an llSitTarget set? That should make it so only one agent can sit on the prim. (If that's not working, some more vigorous head-scratching is in order.)

Also, if the changed() CHANGED_LINK event handler isn't careful about which avatar it got perms from, it can create errors such as you're seeing (usually it's about stopping animations without permission, but it's the same problem: the script isn't checking that the agent it's about to act on is the one it's gotten permissions from).
InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
I will go over it, but...
08-02-2007 01:38
I am getting permissions and check the change. This script used to work without fail, but for some reason just started mucking up. I will check it again. But thus far it is having trouble.

-InuYasha Meiji
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
08-02-2007 02:08
Use a variable to keep track of the prim count of the link set.

If you then get a change event check if the link count increased.

depending on the number of prims in the link set you can thus determine if more than one person is sitting and just get the key of the last "prim" in the link set and then unsit that one.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
08-02-2007 02:39
From: Squirrel Wood
Use a variable to keep track of the prim count of the link set.

If you then get a change event check if the link count increased.

depending on the number of prims in the link set you can thus determine if more than one person is sitting and just get the key of the last "prim" in the link set and then unsit that one.
But it's a couch, so the problem (as I understand it) is that multiple agents are supposed to be able to sit on the linkset, but not on any single prim. So I was thinking a call to llGetPermissionsKey() at time of unsit would be useful for avoiding the cam perms error, although one could keep track of that with a global variable, too.

I think that linksets with llSitTarget set on one or more prims give the "No room to sit here" warning when all the sitTarget prims are full. (Of course, without llSitTarget, a large prim can accommodate multiple avatars sitting on it.) But if the script has been working all along and just started acting up, then... (grasping at straws) maybe something in llSitTarget has changed, or maybe it doesn't exclude a second sitter quickly enough under lag, or...
Jhary Priestly
JPC
Join date: 18 Jan 2007
Posts: 19
08-02-2007 11:45
The example within http://rpgstats.com/wiki/index.php?title=LlSitTarget#How_We_Choose_Our_Seats (Wiki -> llSitTarget) should help you solving your problem.
InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
Will check.
08-02-2007 13:40
Thanks for the replys. I will keep trying. Haven'y done much today. It is 95 degrees here and having trouble thicking.

-InuYasha