LSL Script : SetPos Slave

From Micasim

Jump to: navigation, search
// Name this script something like "Pos 1", "Pos 2", etc.  Reset the script.
//   Send a Link Message with the script number (the thing after Pos)
//   in the integer, and a vector in the string, and this will call
//   SetPos 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;
        vector pos = (vector)str;
        llSetPos(pos);
    }   
}