I have a child prim in an object that I put a static pose animation in along with a standard poseball script without the hide/show function. I wanted it so that the sittarget would self adjust according the users height because for taller av's there feet kept going into the floor, so I found this script on LSL wiki for free and entered what I thought was all the correct pertinent information, but every time I try to save the script I get a syntax error at line 38, 1(the very last line). Here is the script exactly as I put it in the prim: //Sets / Updates the sit target moving the avatar on it if necessary.
UpdateSitTarget(vector pos, rotation rot)
{//Using this while the object is moving may give unpredictable results.
llSitTarget(<0.29, 0.05, -0.1>,<-90.0, 0.0,90.0>);//Set the sit target
key user = llAvatarOnSitTarget();
if(user)//true if there is a user seated on the sittarget, if so update their position
{
vector size = llGetAgentSize(user);
if(size)//This tests to make sure the user really exists.
{
//We need to make the position and rotation local to the current prim
rotation localrot = <-90.0, 90.0, 0.0>;
vector localpos = <-0.29, -0.1, 0.05>;
if(llGetLinkNumber() > 1)//only need the local rot if it's not the root.
{
localrot = llGetLocalRot();
localpos = llGetLocalPos();
}
integer linkNum = llGetNumberOfPrims();
do
{
if(user == llGetLinkKey( linkNum ))//just checking to make sure the index is valid.
{
//<0.008906, -0.049831, 0.088967> are the coefficients for a parabolic curve that best fits real avatars. It is not a perfect fit.
float fAdjust = ((((0.008906 * size.z) + -0.049831) * size.z) + 0.088967) * size.z;
llSetLinkPrimitiveParamsFast(linkNum,
[PRIM_POS_LOCAL, (pos + <0.0, 0.0, 0.4> - (llRot2Up(rot) * fAdjust)) * localrot + localpos,
PRIM_ROT_LOCAL, rot * localrot]);
jump end;//cheaper but a tad slower then return
}
}while( --linkNum );
}
else
{//It is rare that the sit target will bork but it does happen, this can help to fix it.
llUnSit(user);
}
}
@end;
} This is my first attempt at making anything in sl and I've been banging my head for 2 days straight on what I did wrong, any help at all would be greatly appreciated.