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 (!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?