Unofficial LSL Reference

[[functions:llpreloadsound]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

Function: llPreloadSound

llPreloadSound(string sound)

Preload a sound. The idea of preloading a sound is to transmit the sound in advance, so that when the time to play it comes, it is already cached by the surrounding avatars' viewers, and plays without delay.

Sleeps the script for 1.0 seconds.

Parameters

sound

Sound name or UUID of the sound clip to preload.

Notes

  • If used in a HUD, the preload is only effective for the owner.
  • Sounds are usually deleted from the cache when relogging.
  • If the sound is a UUID, it doesn't need to be present in the prim.
  • If the name of a sound present in the prim's inventory matches the UUID of a different sound, the sound that will be preloaded is the one in the item, not the UUID.
  • If the name is not a UUID, and it is not present in the prim's inventory, or if an item with that name which is not a sound exists in the prim's inventory, an error will be privately said (20m range) to the owner in DEBUG_CHANNEL.

Short examples

llPreloadSound("My Sound"); // Preloads the sound "My Sound" (the clip must exist in the prim)

Complete examples

llPreloadSound-example.lsl
default
{
    on_rez(integer param)
    {
        // Preload a bubbling sound when this object is rezzed.
        llPreloadSound("00000000-0000-0000-0000-000000000115");
    }

    touch_start(integer count)
    {
        // When touched, the sound will immediately be ready to play if the avatar
        // was present when the object was rezzed.
        llPlaySound("00000000-0000-0000-0000-000000000115", 1.0);
    }
}

See also