Table of Contents

Start Functions Events Constants Types Language Articles

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

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