Jump to content

Simple Script to Play a Non Looped Sound on click


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

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

Recommended Posts

I have been looking for a script that will play a sound I made on click, its a non looped sound so I am assuming it does not need to be turned off and I only want the sound to play when a user clicks a part of the object. I have several scripts but none seem to do what I need, I could of sworn there was one in the LSL library but have been unable to find it. Any help would appreciate:)

Link to comment
Share on other sites

You want either llPlaySound  or llTriggerSound  (if the object isn't a hud and doesn't move, then it doesn't matter which you use).    If you only want it to play when a particular part of the object is touched, then you could either put the script and sound in that particular child prim or you could keep everything in the root prim and say something like

 

touch_start(integer total_number)	{		if(llGetLinkName(llDetectedLinkNumber(0))=="touch me"){			llPlaySound("my sound",1.0);		}	}

 That's not optimised (if I were making it, I'd loop through the linkset in state entry, reading the names of the prims, and store the number of the prim I need to touch) but it demonstrates the idea.

  • Like 1
Link to comment
Share on other sites

  • 9 years later...
You are about to reply to a thread that has been inactive for 832 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...