Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Flying detection

Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
04-30-2006 10:19
I'm tweaking a pair of wings to only become visible when I'm flying.
So, the script is simple, here's the pseudocode:

variable 'flying';
if (not flying) then check if we are flying yet, if so then set flying to true
else check if we have stopped flying yet, if so then set flying to false

This is triggered every second on a timer event, so I made sure it's optimal in that it only performs two tests (one on the variable 'flying', and one on llGetAgentInfo to see if the flying status has changed). This way it isn't constantly triggering the llSetAlpha() functions to make the wings visible/invisible.

However, it seems like a really bad way to check for flying, having to poll every second. I'm wondering if there's a cheat I'm not seeing? I'd hoped that moving_start() and moving_end() would have provided better methods, but then remembered they don't seem to have the faintest clue if the avatar is moving or not, as that would have been much more efficient (ie you only start checking if you started moving, if you stop then stop checking entirely).

Is there are a more elegant way to go about this or is what I have as good as I'm gonna get?
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
04-30-2006 10:24
It's only once per second ... good enough already.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-30-2006 11:27
You can also attach controls, so you can check right after the user has hit PgUp or Home to fly. Also, if you use the franimation overrider, you can piggyback off that by putting it in your wings, because it sends out link messages when you change animation states.

But it still uses timers, you can't get away from that.

There's a freely redistributable script for hiding wings when you're flying for sale at the Coonspiracy Store.
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
04-30-2006 11:31
Ah controls! That'll be the one I'm after, cheers :)
Never bothered with vehicles or anything similar, so never bothered to touch input, *shakes head* I'm sure I stumbled into the control pages of the LSL wiki while looking llAgentInfo() as well, heh.