Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

what am i missing ?

Schmu Abdallah
Registered User
Join date: 24 Dec 2006
Posts: 6
01-07-2007 07:38
hello
this plays an animation when you sit on it
problem is the height detection, it works but only when you stand up and sit again
and not for the first time, i dont know what am i missing?
it says the correct vector everytime

CODE

default
{
state_entry()
{
if (llStringLength(SIT_TEXT)>0)
llSetSitText(SIT_TEXT);
set_text();
}


changed(integer change)
{
if (change & CHANGED_LINK)
{

if (llAvatarOnSitTarget() != NULL_KEY)
{
{
avatar = llAvatarOnSitTarget();
size = llGetAgentSize( avatar );
height = size.z - 1;
}
llSay( 0, "vector " + (string)height);
vector POSITION=<0.0, 0.15, height>;
llSitTarget(POSITION, ZERO_ROTATION);
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
}
else
{
integer perm=llGetPermissions();
if ((perm & PERMISSION_TRIGGER_ANIMATION) && llStringLength(animation)>0)
llStopAnimation(animation);
llTargetOmega(<0.,0.,0.>,PI,1.0);
set_text();
animation="";
}
}
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
animation=llGetInventoryName(INVENTORY_ANIMATION,0);
llStartAnimation(animation);
llTargetOmega(<0,0,0.3>,PI,1.0);
llSetText("",<0,0,0>,0.0);
}
}
}


also the rotation will rotate the world rather then the table for the person who sits on it
how can i fix this?

thanks for your time :)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-07-2007 09:34
It is because you have already sat on the prim when you set the sit target, so its using the old value.
Schmu Abdallah
Registered User
Join date: 24 Dec 2006
Posts: 6
01-07-2007 12:50
oh duh now i see it, thanks for the hint
Schmu Abdallah
Registered User
Join date: 24 Dec 2006
Posts: 6
01-08-2007 17:13
i have moved the height detection ouf of the changed_link event
but now im missing a trigger i dont wont to have to touch it or have repeat sensors
how can i trigger something when someone sits on it but before he sits ?

thx
Bad Maladay
Registered User
Join date: 3 Apr 2006
Posts: 4
01-08-2007 21:47
As far as I know you can't. The way a sit works prevents it. The sit target is set before the sit and the simulator makes the AV sit on the target when they select sit from the menu. I don't think you can get any info about the sit till it is over.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-09-2007 01:15
Bad is correct, its a chicken and egg situation.
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
01-10-2007 21:25
One option is to move the sit ball after they sit.