LSL Script : SetRot Slave

From Micasim

Jump to: navigation, search
// Name this script something like "Rot 1", "Rot 2", etc.  Reset the script.
//   Send a Link Message with the script number (the thing after Pos)
//   in the integer, and a rotation in the string, and this will call
//   SetRot on the vector.

integer mynum;

default
{
    state_entry()
    {
        string name = llGetScriptName();
        list nameparts = llParseString2List(name, [" "], []);
        mynum = llList2Integer(nameparts, 1);
    }

    link_message(integer sender, integer num, string str, key id)
    {
        if (num != mynum) return;
        rotation rot = (rotation)str;
        llSetRot(rot);
    }   
}