|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
03-13-2008 20:25
Leave it to LSL to not function according to documentation... watch me set a sit target (in non root prim) then sit on it... using llAvatarOnSitTarget returns a NULL KEY!!!!!! WTH? Fails in Havoc1 and Havoc4 sims. Any ideas? state_entry() { llSitTarget(<0,0,0.1>,<0,0,0,1>  ; // for some amazing reason, has to be nonzero } changed(integer change) { if (change & CHANGED_LINK) { llSleep(0.5); // added because I thought things might be happening too fast key avatar=llAvatarOnSitTarget(); //who is sitting on me? llSay(0,(string)avatar); // Says NULL KEY!!!!!!! } Thx!
|
|
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
|
03-13-2008 22:51
What documentation have you been reading? The LSL Portal spells out this behavior for llAvatarOnSitTarget:
Caveats: * A prim does not have a sit target unless llSitTarget has been called with a nonzero vector as the first argument. * If the prim lacks a sit target or the avatar is seated upon a different prim, the only way to determine how many and which avatars are seated upon the object is to scan the link set.
The LSL Wiki is not quite as explicit but it also says that llAvatarOnSitTarget only works if a sit target is defined. Calling llSitTarget with the ZERO_VECTOR for the sit target actually clears the sit target, which causes llAvatarOnSitTarget to always return NULL_KEY.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
03-14-2008 16:07
the amazing reason that the sit target vector must be non-zero is because that is used as the clear target value, it had to be something, to be able to clear it so they chose that as the simplest logical way to handle it, so that the physics engine has a single value it can use to determine where to place an sitting avatar, since if there is no target, it will place the av on the nearest up facing edge, which could be different for various sized/oriented prims.
_____________________
| | . "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... | - 
|
|
Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
|
03-15-2008 08:44
From: BamBam Sachertorte What documentation have you been reading? The LSL Portal spells out this behavior for llAvatarOnSitTarget:
Caveats: * A prim does not have a sit target unless llSitTarget has been called with a nonzero vector as the first argument. * If the prim lacks a sit target or the avatar is seated upon a different prim, the only way to determine how many and which avatars are seated upon the object is to scan the link set.
The LSL Wiki is not quite as explicit but it also says that llAvatarOnSitTarget only works if a sit target is defined. Calling llSitTarget with the ZERO_VECTOR for the sit target actually clears the sit target, which causes llAvatarOnSitTarget to always return NULL_KEY. Yes, I am using the LSL Portal script directly. Cut and pasted. It returns a NULL_KEY, and as you can see, I am using a nonzero target, and still, a NULL is returned. As I mentioned, it lives in a child prim. Is there a way that scripts elsewhere in the object (say in the root) could affect this behavior? This code *does* work if used by itself in test cube(s) Where this is failing is in a boat, with multiple seats... multiple sit targets. -Ryder-
|
|
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
|
03-15-2008 10:05
I've never really had any trouble with this... I always just complete my build (bench, vehicle, what have you) Then when I'm all done and know where I want people to sit, I just half-sink a poseball everywhere I want them, make sure one does *not* end up as root prim, then link the whole thing together.
Seems like whenever someone clicks on an area where a poseball is (I usually alpha them) they will sit there, otherwise They will sit on the first space available until you run out of poseballs / sit positions.
Might just try something along those lines to see if it gets the results you want. Plenty of free "just sit" poseballs out there in the script library. Pretty short and sweet.
Take care, - Hap
|