the script is activated by addressing the object name
example: door capture // will make the object named door go into active capture mode
, to set a new frame say , door set , to play the frames go into play mode , say door play , and then call the frame requested , door frame 1 for ex.
CODE
//Linked animation Script by nightspy rebus.
//notice scale doesn't work on objects an avie sits on
string control_part;
list pos;
list rot;
list scale;
vector org;
vector tpos;
animate(string x)
{
integer i=(integer)x;
vector scalet=llList2Vector(scale,i);
vector post=llList2Vector(pos,i);
rotation rott=llList2Rot(rot,i);
llSetScale(scalet);
llSetPos(post);
llSetLocalRot(rott);
}
default
{
state_entry()
{
llListen(0,"","","");
llListen(1221,"","","");
llOwnerSay("play mode: "+(string)
llGetListLength(pos)+" frames captured");
}
link_message(integer sender_num, integer num, string message, key id)
{
control_part=llToLower(llGetObjectName());
list cmd=llParseString2List(llToLower(message),[" "],[""]);
if(llList2String(cmd,0)==control_part)
{
if(llList2String(cmd,1)=="frame")
{
if(llList2Integer(cmd,1)>(llGetListLength(pos)+-1));
else
animate(llList2String(cmd,2));
}
if(llList2String(cmd,1)=="capture")
{
state capture;
}
if(llList2String(cmd,1)=="frames")
{
llOwnerSay((string)llGetListLength(pos)+" frames captured");
}
}
}
}
state capture
{
state_entry()
{
pos=[];
rot=[];
scale=[];
llListen(0,"","","");
llOwnerSay("capture mode");
}
listen(integer channel,string name,key id,string message)
{
if(id==llGetOwner())
{
control_part=llToLower(llGetObjectName());
list cmd=llParseString2List(llToLower(message),[" "],[""]);
if(llList2String(cmd,0)==control_part)
{
if(llList2String(cmd,1)=="play")
{
state default;
}
if(llList2String(cmd,1)=="frames")
{
llOwnerSay((string)llGetListLength(pos)+" frames captured");
}
if(llList2String(cmd,1)=="set")
{
{
pos+=llGetLocalPos();
rot+=llGetLocalRot();
scale+=llGetScale();
}
}
}
}
}
}
And an exmaple controller scripts
CODE
default
{
state_entry()
{
llListen( 0, "", NULL_KEY, "" );
}
listen( integer channel, string name, key id, string message )
{
llMessageLinked(LINK_SET, 0, message, "");
}
}
CODE
integer door=FALSE;
integer i;
default
{
state_entry()
{
llListen(0,"","","");
}
listen(integer channel,string name,key id,string msg)
{
if(id==llGetOwner())
{
if(msg=="open door")
{
if(door==FALSE)
{
for(i=0;i<5;i++) //set the number of frames to play for door object aniamtion
{
llSay(1221,"door frame "+(string)i);
llSleep(1);
}
door=TRUE;
}
}
if(msg=="close door")
{
if(door==TRUE)
{
llSay(1221,"door frame 0");
llSleep(1);
}
door=FALSE;
}
}
}
}