OsStopSound

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Script fixed)
Line 5: Line 5:
 
|delay=0
 
|delay=0
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
 
 
//
 
//
 
// osStopSound Script Example
 
// osStopSound Script Example
 
//
 
//
  
integer on = FALSE;
+
string soundName;
string soundname = "youresound"; //sound file name
+
integer power;
 
+
 
default
 
default
 
{
 
{
 
     state_entry()
 
     state_entry()
 
     {
 
     {
         on = FALSE;
+
         // Get the first inventory sound name
         soundname = llGetInventoryName(INVENTORY_SOUND, 0);
+
         soundName = llGetInventoryName(INVENTORY_SOUND, 0);
 +
       
 +
        if (soundName == "")
 +
        {
 +
            llOwnerSay("Inventory sound missing ...");
 
         }
 
         }
 +
       
 +
        else
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "Touch to see osStopSound usage.");
 +
        }
 +
    }
  
     touch_start(integer total_number)
+
     touch_start(integer number)
 
     {
 
     {
         if(llDetectedKey(0) != llGetOwner())
+
         if (power = !power)
        return;
+
        if(soundname != "")
+
 
         {
 
         {
             if(on)
+
             osLoopSound(LINK_THIS, soundName, 1.0);
            osStopSound(0);
+
        }
            else
+
 
             osLoopSound(0, soundname, 1);
+
        else
            on = !on;
+
        {
 +
             osStopSound(LINK_THIS);
 
         }
 
         }
 
     }
 
     }
 
}
 
}
 
 
</source>
 
</source>
 
|description=Stop the sound playing in the specified prim of a linkset.
 
|description=Stop the sound playing in the specified prim of a linkset.

Revision as of 09:43, 26 November 2020

osStopSound(integer linknum)
Stop the sound playing in the specified prim of a linkset.
Threat Level This function does not do a threat level check
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
//
// osStopSound Script Example
//
 
string soundName;
integer power;
 
default
{
    state_entry()
    {
        // Get the first inventory sound name
        soundName = llGetInventoryName(INVENTORY_SOUND, 0);
 
        if (soundName == "")
        {
            llOwnerSay("Inventory sound missing ...");
        }
 
        else
        {
            llSay(PUBLIC_CHANNEL, "Touch to see osStopSound usage.");
        }
    }
 
    touch_start(integer number)
    {
        if (power = !power)
        {
            osLoopSound(LINK_THIS, soundName, 1.0);
        }
 
        else
        {
            osStopSound(LINK_THIS);
        }
    }
}
Notes
This function was added in 0.9.0.1


Personal tools
General
About This Wiki