Jump to content

simple play sound on rez just refused to work, please help


kiki Chaika
 Share

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

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

Recommended Posts

 

I have tried to write this one line simple thing for like 4 hr now and NONE of them work.

What I wanted to do is when an object is being rez (temp rez), it will play a sound in its content.

I have tried the following scripts:

 

default
{
state_entry()
{
llPlaySound("land",1.0);
}
}

 

Not working

 

 

default
{
on_rez(integer start_param)
{

llPlaySound("land",1);
}

}

 

Not working

 

default
{

state_entry() {

llPlaySound(llGetInventoryName(INVENTORY_SOUND,0),1);

}

}

 

Still not working.

 

The sound is called land

 

please help and thanks..

 

kiki

 

 

Link to comment
Share on other sites

You can trigger the state_entry() event  to play  the  sound  anytime you rez  the  object  by  resetting  the  script in  an on_rez()  event.

 

default
{
on_rez(integer start_param)
{

llResetScript();
}

 

state_entry()

{

llPlaySound(llGetInventoryName(INVENTORY_SOUND,0),1.0);

}



}

 

Alternatively you can trigger an arbitrary event like dataserver() or  timer(), but a reset should do it.

Link to comment
Share on other sites

Your first and third attempts will fail because the script does not restart when you rez your object.  A state_entry event is triggered when the script starts.  The second attempt should work, as long as you have the sound file in the same object as the script and its name is exactly as you typed it (capitalization counts).  The problem you are likely to to run into, though, is that unless people nearby have already heard the sound, so it has preloaded for them, they won't hear it when you play it on rez.  You'll have to preload the sound first.

The easiest way to do that is to preload the sound in your on_rez event and trigger a timer event at the same time. Then, play the sound a second or two later, after it has already preloaded.  Set the timer delay to be the length of your sound.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2752 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...