Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Animated wing script, anyone?

Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
12-24-2005 12:33
I've been looking for, for free or purchase, an animated wing script for a project I'm working on.

Anyone know of one for sale, copyable/transferrable, or an open-source one?

Thanks,
Aaron
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
12-26-2005 16:41
Here's a reference to start:
/54/64/33003/1.html

However... wing scripts are pretty simple. More so now that they've made it so prims can move on avatars.


All you'd really need:

* llSetRot - rotates wings into position (alternately, llSetLinkAlpha for earlier scripts)

* llSetTimerEvent and timer event - for timing the flaps

* llMessageLinked and link_message event - for synchronizing the movements of the wings.


The workflow would look something like this:
CODE
// Four prim wings with llSetLinkAlpha:
// Assumes prims 1 and 2 are frame 1 and prims 3 and 4 are frame 2.

integer frame = 0;

default
{
state_entry()
{
llSetTimerEvent(2.0); // Times the wings
}
timer()
{
if(frame)
{
llSetLinkAlpha(1,0.0,ALL_SIDES);
llSetLinkAlpha(2,0.0,ALL_SIDES);
llSetLinkAlpha(3,1.0,ALL_SIDES);
llSetLinkAlpha(4,1.0,ALL_SIDES);
frame = 0;
}
else
{
llSetLinkAlpha(3,0.0,ALL_SIDES);
llSetLinkAlpha(4,0.0,ALL_SIDES);
llSetLinkAlpha(1,1.0,ALL_SIDES);
llSetLinkAlpha(2,1.0,ALL_SIDES);
frame = 1;
}
}
}


OR:

CODE
// Two prim wings with llSetRot
// Master script

// Supply your own rotations here
rotation one = <0,0,0,1>;
rotation two = <0,0,0,1>;
integer frame = 0;

default
{
state_entry()
{
llSetTimerEvent(2.0); // Times the wings
}
timer()
{
if(frame)
{
llMessageLinked(LINK_SET,0,"","");
}
else
{
llMessageLinked(LINK_SET,1,"","");
}
!frame; // Not sure if LSL uses this properly. If it doesn't, use the frame
// change workflow I used in the last script.
}
link_message(integer sender, integer num, string str, key id)
{
if(num)
{
llSetRot(one);
}
else
{
llSetRot(two);
}
}
}


CODE
// Two prim wings with llSetRot
// Child script

// Supply your own rotations here
rotation one = <0,0,0,1>;
rotation two = <0,0,0,1>;

default
{
link_message(integer sender, integer num, string str, key id)
{
if(num)
{
llSetRot(one);
}
else
{
llSetRot(two);
}
}
}
_____________________
---
Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
12-29-2005 23:52
I've got to turn on post notifcations again. I just now saw your response! Thanks Jeffrey!