Jump to content
ProletarianGothic

Play Sound When User Types Something on A Channel

Recommended Posts

I've made this script to play a sound from an objects inventory when a user types "one" on channel 23.

It should work, it shows up green "script is okay" symbol on the top right corner of the script text box, but it doesn't work, no matter what I do.

Help? Here is the script. It's not my sound as that works, and its not the sound files I';ve chosen as those all play fine independently.

 

Quote

default
{
    state_entry()
    {
        llListen(23,"", NULL_KEY, "");
    }
    listen(integer channel, string name, key id, string message)
    {
        if (message == "one") {
        llPlaySound(llGetInventoryName(INVENTORY_SOUND,0),1);
        }
    }
}

 

Share this post


Link to post
Share on other sites

The script works fine for me.

Possible problems for you might be:
- The script isn't running. 
- You are on a 'no scripts' parcel.
- Other reasons I can't think up right now.

Share this post


Link to post
Share on other sites

To check if the listen event fires you could add a

llOwnerSay("I hear you!");

Then, if that works, try a llOwnerSay to check the 'if'.

Share this post


Link to post
Share on other sites

If you haven't tried Ron's suggestion, do it.  That will tell you whether the script is listening at all.  Then,

1. Be sure that you are actually typing in channel 23  >>>  "/23 one"

2. Try using llTriggerSound instead of llPlaySound

Share this post


Link to post
Share on other sites

After you save/compile the script in the object, make sure that the "Running" checkbox is in fact checked. I have seen instances where it was turned off without my realizing it.

Also, how far away from the object is your camera? Because sometimes sounds in SL tend to have a steep falloff as your viewport gets further away from the source. As a test, zoom your camera right up to the object and listen if you can hear the sound. Combine that with the other diagnostic instrumentation suggested by the others.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...