Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Arg, how many avatars sitting? or Block?

Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
12-19-2009 16:52
I'm scripting something that requires the change stand to only be called when one avatar is sat on the root prim, Child prims can also be sat on but I DONT want it to activate the change when they do?

Is there a way to block those prims from passing theres someone sitting/standing on them? or even a way to get the number who are sitting? so I can block out more than one?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-19-2009 17:08
the number sitting av is
llGetNumberOfPrims() - llGetObjectPrimCount( llGetKey() );

their link numbers start at
llGetObjectPrimCount( llGetKey() ) + 1;

IF you have a sit target set for a specific prim, you can find the first avatar to sit on that prim by comparing their location to the sit offset, the one that matches, is the one on that prim first (or most recently since the av occupying that spot left)

technically avs aren't seated on a particular prim, they are seated on the object, but a prim may provide targeting in the form of a sit target...
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
12-19-2009 17:10
From the wiki http://wiki.secondlife.com/wiki/LlGetNumberOfPrims ......

CODE

//Returns the number of agents on the object
integer GetNumberOfAgents()
{//count avatars
return llGetNumberOfPrims() - llGetObjectPrimCount(llGetKey());
}


ETA: Um... what she said. :p
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Kayaker Magic
low carbonated footprint
Join date: 11 Sep 2008
Posts: 109
12-20-2009 00:23
llAvatarOnSitTarget() will only return something if there is an avatar sitting on the prim that is running the script that is calling llAvatarOnSitTarget. So you can have a dozen avatars sitting on other prims, jumping on and off, and changed() in the root prim can still find out if someone is sitting on the root prim.
All the prims and all the avatars get linked into one prim list, so you may have to search that list if you need to know the link number of a particular avatar.