|
Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
|
03-11-2006 10:02
Hello, I'm really a noob when it comes to coding. I am trying to make a script that will play sounds when my avatar if flying. But its not working. To me it looks correct. Can somebody look at this and tell me what I am doing wrong? Thank you all so much for your kind help in here. default { state_entry() { if(llGetAgentInfo(llGetOwner())&AGENT_FLYING) { //Flying state flying; } else { //Not FLying state notflying; } } }
state flying { state_entry() { llPlaySound ("UUID", 0.5); llSleep (2.5); llLoopSound ("UUID"), 0.5); } timer() { if(!(llGetAgentInfo(llGetOwner())&AGENT_FLYING)) { state notflying; } } }
state notflying { state_entry() { llStopSound (); } timer() { if(llGetAgentInfo(llGetOwner())&AGENT_FLYING) { state flying; } } }
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
03-11-2006 11:13
You've not used llSetTimerEvent. The code in the timer will only check whether someone is flying or not if it's actually active. Put in a call to it in all of the state_entry blocks. I'd think that llSetTimerEvent(1.0) should be perfectly fine, no need to go below that.
Incidentally, I wouldn't bother having three states - just make the default "notflying" and keep "flying", or vice versa. It will only make a difference if you reset the script, and then only for a tiny period of time.
|
|
Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
|
03-11-2006 11:30
Thank you very much. That got it working great.
|