Jump to content

Start looping sound when avatar is detected.


Charles Hera
 Share

You are about to reply to a thread that has been inactive for 4271 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi. I need to be able to start a sound that loops (short one file ambiant sound) when an avatar is detected within hearing range. Not particular about the range :) I just need to have the sound play only when needed, not all the time which is what I hve now.

Found a lot of interesting stuff on the forums, but nothing relating to this. If someone could point me in the correct direction I would appreciate it. Not a from scratch script  guy but I can usually get things to work by tinkering and trial and error. Thanks.

Link to comment
Share on other sites

Well, one way to do it would be to use llSensorRepeat  to detect if anyone is in range.  If they are, the sensor event will fire, and you can start looping the sound with llLoopSound and if no one is about, the no_sensor event fires and you can stop the sound with llStopSound

However (and I'm not trying to discourage you), why do you need to keep starting and stopping the sound?  If no one is in hearing range, they're not going to hear it, and I don't really see the difference between starting and stopping the sound and leaving it playing all the time.   If an ambient sound plays in the forest and no one hears it, and all that...    

Link to comment
Share on other sites

Honestly I don't either. It is however a "rule" in an art contest. I may just leave it as it is and if needed I guess I could delete the sound. Maybe I interpreted the rules incorrectly. Since I am not a script person, I feel very happy with all I DID accomplish in the build LOL. Thanks for the input.

Since you can't hear the sound until you are very close to the build, maybe it will be OK. I was thinking the purpose was to keep the lag down but if the sensor is checking continually that doesn't seem like it would help much. Appreciate your comment.

Link to comment
Share on other sites

LOL  I had actually thought of that too. I think I am going to just pretend I missed that part of the rules as it really makes little sense. Going onward!  I thought it had to do with sim resources but it certainly seems that having a sensor on to detect would create more lag than a tiny one line looping sound. I am guessing the REAL issue was not to have your sound overlap a neighobor's installation. Mine does not so I am thinking it will be fine.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4271 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...