Table of Contents

About

This script was tested and works on OpenSim version 0.7.4!

This is a very short script that I have been asked to created by MrChristian Luminos who told me that there is no such script available either on marketplace or the wiki. The script just toggles a sound on and off when an avatar touches the primitive the script is in.

Setup

  • Drop the script in a primitive of your choice.
  • Edit the script and modify the SOUND parameter at the top of the script to reference a sound UUID or a sound name if the sound-clip is in the same primitive this script will be placed in. The script triggers one of my sneezing recording from Wizardry and Steamworks.

Code

touch_sound_toggle.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
// Change this to either the NAME of a sound in the same primitive
// as this script, OR the key of the sound to be played if it is not
// in the same primitive as this script.
string SOUND = "9fb1f482-5edf-1544-98c4-b8f86ea9ea26";
integer o = -1;
 
default
{
 
    touch_start(integer total_number)
    {
        if(o = ~o) {
            llStopSound();
            return;
        }
        llLoopSound(SOUND, 1);
    }
}

Hacks

The sound is played using llLoopSound and at volume 1 (maximum). However, you can replace those with say:

llPlaySound(SOUND, .5);

If you want the sound to be played just once and at half volume.


secondlife/touch_sound_toggle.txt ยท Last modified: 2022/11/24 07:46 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.