A simple and low lag poseball script. Add 1 animation to prim with script.
Add script and 1 animation to prim. Change settings at top of script.
Float Text and Prim will turn invisible while avatar is using
/////////// USER SETTINGS ////////////////////
string floattext = "Sit Here";
string sittext = "Pose!";
vector textcolor = <1,1,1>;
vector sittarget = <0,0,1>;
vector sitangle = <0.0,0.0,0.0>;
//////////// BEGIN SCRIPT ////////////////////
rotation sitrotation;
default
{
on_rez( integer sparam )
{
llResetScript();
}
state_entry()
{
sitrotation = llEuler2Rot(sitangle * DEG_TO_RAD); // convert the degrees to radians, then convert that vector into a rotation
llSitTarget(sittarget, sitrotation);
llSetText(floattext, textcolor, 0.8);
llSetSitText(sittext);
}
changed(integer change)
{
if(change & CHANGED_LINK) // If someone has sat on, or "linked," to this prim...
{
key avataronsittarget = llAvatarOnSitTarget();
if( avataronsittarget != NULL_KEY ) //Someone is sitting on the object
{
llSetText("", textcolor, 0.8);
llSetLinkAlpha(LINK_SET,0,ALL_SIDES); // Turn Invisible
// Before animating, first check if we have permission to do so:
if ((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && llGetPermissionsKey() == avataronsittarget) {
// If we do, we can animate:
llStopAnimation("sit");
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
} else {
// If we dont, ask for them:
llRequestPermissions(avataronsittarget, PERMISSION_TRIGGER_ANIMATION);
// We'll animate in the run_time_permissions event, which is triggered
// When the user accepts or declines the permissions request.
}
}
else //stood up
{
llSetText(floattext, textcolor, 0.8);
llSetLinkAlpha(LINK_SET,1,ALL_SIDES); // Make Visible
}
}
}
run_time_permissions(integer perm)
{
if(perm)
{
llStopAnimation("sit");
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
}
}
}
|