Generic llSitTarget Positioning Script

Tired of taking ages to set script targets? Well, this one should make things easy for you: just put the vector for positioning and the rotation in angles, separated by commas, and the object will reset the SitTarget for you. Then just shout die on public chat, and the script will remove itself; SitTargets are an object property, and you don’t need to have a script inside the prim to keep the SitTarget working.

This is also part of my series of LSL training courses.

default
{
    state_entry()
    {
        list data = llCSV2List(llGetObjectDesc());

        llWhisper(0, "Angle is: " + llList2String(data, 0) + ","
                                  + llList2String(data, 1) + ","
                                  + llList2String(data, 2) + "; xyz is: "
                                  + llList2String(data, 3) + ","
                                  + llList2String(data, 4) + ","
                                  + llList2String(data, 5));

        rotation myRot = llEuler2Rot( < llList2Float(data, 0) * DEG_TO_RAD,
                                        llList2Float(data, 1) * DEG_TO_RAD,
                                        llList2Float(data, 2) * DEG_TO_RAD > );

        vector target;
        target.y = llList2Float(data, 3);
        target.x = llList2Float(data, 4);
        target.z = llList2Float(data, 5);
        llSitTarget(target, myRot);
        llListen(0, "", "", "die");
    }

    listen(integer c, string n, key k, string m)
    {
        if(m=="die") llRemoveInventory(llGetScriptName());
    }
}
Code language: LSL (Linden Scripting Language) (lsl)