The first in an occasional series of hopefully useful scripts or snippets. I’ll start simply, with two short scripts, one for setting the ‘Sit’ position of a prim, and the other for displaying floating text above a prim.

Basic ‘Sit’ script

This script sets the ‘sit’ position and rotation that will be used for an avatar that sits on the prim.

default
{
    state_entry()
    {
      // Position offset.
      vector pos = <0, .1, 0>;

      // Rotation, in degrees.
      vector rot = <0, 0, 0>;
      // Convert degrees to radians.
      rot *= DEG_TO_RAD;
      // Convert to a quaternion.
      rotation rotFinal = llEuler2Rot(rot);
      // Assign the position and rotation.
      llSitTarget(pos, rotFinal);
    }
}

Notes

Setting the position to <0, 0, 0> will reset the position to the default (which is not necessarily <0, 0, 0>). If this is the position you need, set it to something unnoticeably different, such as <0, 0.005, 0>.

Displaying Text Above A Prim

integer showText = TRUE;
updateText(string newText)
{
    if(showText)
    {
        llSetText(newText, <0.0, 0.0, 0.5>, 0.5);
    }
}

Notes

You can also use this to display text floating above your avatar, by attaching the prim with this script (you’ll probably want to make it invisible, unless you drop the script into an item of clothing).