きょうの Second Life をひとつの場所で ギフトとフリービー を毎時間更新 7言語 無料 でお店を掲載
グリッド障害
  • 予定: Scheduled Billing Maintenance, 11月16日(月) 09:30–10:30 SLT
  • グリッド状況: Unscheduled Group Chat Maintenance (investigating)
  • 開催中: UUtopiaのUnitarian Universalist土曜礼拝
  • 開催中: The Dharma of Community: 仏教社会と在家の生き方
  • 開催中: SLCSハーベストフェスト:ゲーム、音楽、お楽しみ
  • 14:00 SLT: Cascadiaのムーンダンスで NAD GOUGH ライブ 14:00 SLT
  • ニュース: REZZ MALL: Second Lifeのブランドが集まるウェブモール
  • Viewer: Second Life Viewer 26.5 チャットを刷新
  • 予定: Scheduled Billing Maintenance, 11月16日(月) 09:30–10:30 SLT
  • グリッド状況: Unscheduled Group Chat Maintenance (investigating)
  • 開催中: UUtopiaのUnitarian Universalist土曜礼拝
  • 開催中: The Dharma of Community: 仏教社会と在家の生き方
  • 開催中: SLCSハーベストフェスト:ゲーム、音楽、お楽しみ
  • 14:00 SLT: Cascadiaのムーンダンスで NAD GOUGH ライブ 14:00 SLT
  • ニュース: REZZ MALL: Second Lifeのブランドが集まるウェブモール
  • Viewer: Second Life Viewer 26.5 チャットを刷新
LSLスクリプト

LSL sound loop script for ambient sound

Free LSL ambient sound script for Second Life: loop birds, waves, rain or a fire crackle from any object, set the volume and touch to turn it on and off.

52行 ·

Sound brings a place to life: waves on a beach, birds in a garden, a crackling fireplace. This sound loop script plays a sound on repeat from any object, with a volume setting and touch to switch it on or off.

lsl-sound-loop-script.lsl · 52行 このスクリプトをチェック
// Ambient Sound Loop - free LSL script from WhatSL (https://whatsl.com/scripts/lsl-sound-loop-script)
// Free to use, change and put in your own creations, also ones you sell.
//
// Plays a sound on repeat: birds, waves, a fire, rain, a shop jingle.
// Put a sound in the object's Contents (or paste a sound UUID into SOUND_NAME). Touch to turn it on and off.

string  SOUND_NAME   = "";    // "" = the first sound in Contents; or a sound name or UUID
float   SOUND_VOLUME = 0.6;   // 0.0 to 1.0; keep ambient sounds soft
integer START_ON     = TRUE;
integer OWNER_ONLY   = FALSE; // TRUE = only the owner can turn it on and off

integer gOn = FALSE;

string soundToPlay()
{
    if (SOUND_NAME != "") return SOUND_NAME;
    return llGetInventoryName(INVENTORY_SOUND, 0);
}

setSound(integer on)
{
    llStopSound();
    gOn = FALSE;
    if (!on) return;
    string snd = soundToPlay();
    if (snd == "")
    {
        llOwnerSay("Put a sound in my Contents, or set SOUND_NAME.");
        return;
    }
    llLoopSound(snd, SOUND_VOLUME);
    gOn = TRUE;
}

default
{
    state_entry()
    {
        setSound(START_ON);
    }

    touch_start(integer total)
    {
        if (OWNER_ONLY && llDetectedKey(0) != llGetOwner()) return;
        setSound(!gOn);
    }

    changed(integer change)
    {
        if (change & CHANGED_INVENTORY) setSound(gOn);
    }
}

自由に使用・改変でき、販売する作品にも組み込めます。

How to set it up

  1. Put a sound into the object's Contents (or copy a sound's UUID).
  2. Add the script and save. The sound starts playing.
  3. Touch the object to stop it and touch again to start it.

Settings

  • SOUND_NAME: empty plays the first sound in the Contents. You can also type a sound name or paste a sound UUID.
  • SOUND_VOLUME: 0.0 to 1.0. Ambient sounds sound best soft, around 0.3 to 0.6.
  • START_ON: whether the sound plays as soon as the script starts.
  • OWNER_ONLY: TRUE stops visitors from switching it off.

Tips

  • Use sounds that are made to loop, without a gap or click at the end.
  • Visitors hear the sound near the object. Place several quiet sources around a big area rather than one loud one.
  • For music for a whole parcel, use the parcel's music stream instead of a sound loop.

Frequently asked questions

Why can't I hear anything?

Check that sound effects are turned up in your viewer's volume controls, that the object has a sound in its Contents, and that you are close enough to the object.

Can I play several sounds in a row?

This script loops one sound. Playing a list of sounds needs llPlaySound with a timer for each clip.

Does a sound loop cause lag?

Very little. The region tells viewers to loop the sound once; the viewer does the rest.

自分のスクリプトをチェック: LSL構文チェッカー →

ほかのスクリプトすべてのスクリプト
LSLスクリプト · 55行

LSLのドアスクリプト:タッチで開閉し、自動で閉まる

Second Life用の無料LSLドアスクリプトです。ドアをタッチすると蝶番を軸に開き、もう一度タッチするか数秒後に自動で閉まります。閉じた位置を覚えるので、後からドアを動かしても問題なく動作し、効果音も設定できます。

LSLスクリプト · 69行

LSL sit and pose script for chairs and pose balls

Free LSL sit script for Second Life chairs, benches and pose balls: sit and play your own animation, set the sit position, hide the ball while in use.

LSLスクリプト · 96行

LSL tip jar script with thank-you message and total

Free LSL tip jar script for Second Life clubs, DJs, hosts and stores: quick pay buttons, a thank-you message, the total and last tipper in floating text.