Moves a HUD to the same position no matter which attachment point is used. This only works if you put the script in the root prim, and the root prim is about the same size as the HUD.
default
{
attach(key id)
{
if (id==NULL_KEY) //being detached
return;
vector scale=llGetScale();
integer point=llGetAttached();
if ((point==31)||(point==35)) //center
{
llSetPos(<0,0,0>);
}
else
if (point==32) //top right
{
llSetPos(<0,scale.y,-scale.z>);
}
else
if (point==33) // top
{
llSetPos(<0,0,-scale.z>);
}
else
if (point==34) //top left
{
llSetPos(<0,-scale.y,-scale.z>);
}
else
if (point==36) //bottom left
{
llSetPos(<0,-scale.y,scale.z>);
}
else
if (point==37) //bottom center
{
llSetPos(<0,0,scale.z>);
}
else
if (point==38) //bottom right
{
llSetPos(<0,scale.y,scale.z>);
}
}
}