Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Flapping wings on vehicle

Ursula Madison
Chewbacca is my co-pilot
Join date: 31 Jul 2004
Posts: 713
02-11-2005 13:51
Hey gang... I'm not that hot with scripting, so I figured I'd ask...

I have a vehicle that has wings on it, and ideally I would like them to flap on command.
I've got them so they'll rotate (child rotation) but I'm not sure how to make them flap until I tell them to stop. I have one listen event in the main script, and it sends link messages to the wings to start them flapping... I just don't know the logic to make them continue flapping until another link message is sent to stop them.

I know this is probably a horrible example of coding, but amazingly it compiles and runs, and to my untrained eye it should turn the flapping on and off... but it doesn't turn it off. What am I missing?

CODE
rotation Standard = <-0.09571, 0.00502, 0.05209, 0.99403>;
rotation Upper = <-0.38168, -0.01041, 0.05129, 0.92281>;
rotation Lower = <0.19533, 0.01984, 0.04843, 0.97934>;

default
{
state_entry()
{
llSetLocalRot( Standard );
}

link_message( integer sender, integer num, string message, key id )
{

if( message == "wings on" )
{
while( message != "wings off" )
{
llSetLocalRot( Upper );
llSleep(0.25);
llSetLocalRot( Lower );
llSleep(0.25);
}
}
else
{
if (message == "wings off" )
{
llSetLocalRot( Standard );
}
}
}
}
_____________________
"Huh... did everything just taste purple for a second?" -- Philip J. Fry
Ricky Zamboni
Private citizen
Join date: 4 Jun 2004
Posts: 1,080
02-11-2005 14:13
There was a thread about two weeks ago in which a wing flapping script was discussed in the context of a bird. IIRC, it used the link messages to change the child to a state with a timer() cycling through the wing positions. The script examples in that thread will probably help you.

/54/4e/33550/1.html
_____________________
Cubey Terra
Aircraft Builder
Join date: 6 Sep 2003
Posts: 1,725
02-11-2005 14:28
The problem is that when it enters the while loop, it can no longer detect link_message events, so wings_off will remain FALSE. Instead, try using a timer to flap only when wings_off is FALSE. That way your script will still respond to link_messages.
_____________________
C U B E Y · T E R R A
planes · helicopters · blimps · balloons · skydiving · submarines
Available at Abbotts Aerodrome and XstreetSL.com

Ross Zadoq
Registered User
Join date: 5 Sep 2004
Posts: 1
Designer Needed -- Paid Gig!
02-11-2005 14:34
I'm looking to hire a talented designer to help me create an in-world movie.
Please contact me ASAP for the details:
Ross Zadoq
[email]ross@san.rr.com[/email] / 858 337 7393 / 323 933 7505
look forward to hearing from u!
Ursula Madison
Chewbacca is my co-pilot
Join date: 31 Jul 2004
Posts: 713
02-11-2005 14:34
Oooooh, I see what you're saying, Cubey.

It would seem the use of a while statement may have been a bad idea. :D

[Edit] Okay, taking Cubey's advice, I was able to get it to work, as seen in the screenshots below. Thanks, Cubey! :D
_____________________
"Huh... did everything just taste purple for a second?" -- Philip J. Fry
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
02-12-2005 09:30
Oooooh, the pirates' assault vehicles from Castle in the Sky ! Lovely :)
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
Olmy Seraph
Valued Member
Join date: 1 Nov 2004
Posts: 502
02-12-2005 09:36
Ooooo! I want a flopter! And a giant flying robot too, heh.
_____________________
Some people are like Slinkies... not really good for anything, but they sure bring a smile to your face when you push them down the stairs.
Ursula Madison
Chewbacca is my co-pilot
Join date: 31 Jul 2004
Posts: 713
02-12-2005 17:23
Hee, you recognized it! In Burning Life, there was a Castle in the Sky display, and a big robot like in the movie. Unfortunately, I lost the pics I took with my flitter and the robot. I don't know who built it, as that info was lost too.

Anyway, I actually built the flitter way back in September I think... and then put it on the back burner as the scripting was making my head hurt. Recently upon rereading the wiki, child rotation finally made sense and viola... there she be. :D
_____________________
"Huh... did everything just taste purple for a second?" -- Philip J. Fry
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
02-12-2005 18:03
From: Ursula Madison
I don't know who built it, as that info was lost too.

Keith Extraordinaire. :)
_____________________
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
02-13-2005 03:08
Someday I'll script this little critter:
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.