Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llAvatarOnSitTarget() Question

Miriel Enfield
Prim Junkie
Join date: 12 Dec 2005
Posts: 389
05-24-2007 10:15
If there are multiple avatars seated on an object, which key does llAvatarOnSitTarget() return? I've got a modeling stand and I need to kick off anyone who tries to sit while someone else is using it.
_____________________
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
05-24-2007 10:54
The last person to sit down should be the last in the Linked list hierarchy.

llUnSit(llGetLinkKey(llGetNumberOfPrims)))

That should give them the boot.
Storm Thunders
Polyavatarist
Join date: 31 May 2006
Posts: 157
05-24-2007 10:54
It was a couple versions ago when I tried this, so ymmv.

If you've only got one sit target defined, I don't think anyone else can sit on it.

If I haven't defined a sit target and someone sits on it, I don't get a change event triggered, and llAvatarOnSitTarget() returns a NULL_KEY. If you need to know if someone is sitting on your object, you must have a sit target defined.
Miriel Enfield
Prim Junkie
Join date: 12 Dec 2005
Posts: 389
05-24-2007 11:19
Milambus, I'm not sure that will work. I was checking the link numbers in world and when I sat on a cube, it seemed to go from being link number 0 to link number 1. I could just be misunderstanding how link numbers work, though.

Storm, more than one person can sit on a prim. The person I sold the stand to has said that his models are having problems because clueless newbies are sitting on the stand while a model's on it.

EDIT: I checked in world, and that last paragraph is incorrect. Only one person can sit on a prim. In a multiprim object, however, multiple people can sit.
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
05-24-2007 11:28
From: Miriel Enfield
when I sat on a cube, it seemed to go from being link number 0 to link number 1. I could just be misunderstanding how link numbers work, though.
Unlinked prims always have a link number of 0. The root of a linkset always has a link number of 1. So when you sat on the previously-unlinked cube, it became part of a linkset, and changed its link number.

Using the number of prims as the avatar's link number works precisely because link numbers in a link set begin with 1. There are 2 links in the set. The box is 1, the avatar is 2. This is somewhat counterintuitive to coders used to working with arrays which begin at 0, in which case the proper index of the avatar would be n - 1, not n.
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
05-24-2007 11:34
From: Miriel Enfield
Milambus, I'm not sure that will work. I was checking the link numbers in world and when I sat on a cube, it seemed to go from being link number 0 to link number 1. I could just be misunderstanding how link numbers work, though.


Yes, thats how Link Numbers work.
0 - Single Prim (no links)
1 - Root Prim (others linked to it)
2 to n - The prims attached to the root

In your case:
Chair by itself = 0

Chair that is sat upon = 1
Sitter on the chair = 2
Second sitter on the chair = 3
Miriel Enfield
Prim Junkie
Join date: 12 Dec 2005
Posts: 389
05-24-2007 11:49
Aha! Okay, thank you. I was wondering if something like that was going on, but it just seemed so strange.