Difference between revisions of "User:Toady Nakamura/Touch Toggle Particle"

From Second Life Wiki
Jump to navigation Jump to search
(start & stop particle for list of scripts)
 
m (</source>)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
    by Toady Nakamura]
by Toady Nakamura
    Place in prim, touch to turn particles on and off.
Place in prim, touch to turn particles on and off.
    Example of on/off toggling
Example of on/off toggling


<style ="lsl2">
 
<source lang="lsl2">
integer particleOn = 0;
integer particleOn = 0;


Line 49: Line 50:
     }
     }
}
}
 
</source>
</style>
Visit my LSL wiki page for my library of simple scripts !  [[User:Toady Nakamura|Toady Nakamura]]

Latest revision as of 19:41, 10 January 2016

by Toady Nakamura Place in prim, touch to turn particles on and off. Example of on/off toggling


integer particleOn = 0;

particle()
{
particleOn = 1;

llParticleSystem([
    PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK,
    PSYS_SRC_PATTERN, 8, //wuz 4
    PSYS_PART_START_COLOR, llGetColor(0),
    PSYS_SRC_MAX_AGE, 1.0
    ]); 
  
}

stopParticle()
{
    particleOn = 0;
    llParticleSystem([]);
}
//-------------------------------------------------
default
{
    state_entry()
    {
        stopParticle(); // OFF
    }
    
    on_rez(integer start_params)
    {
        llResetScript();    
    }
    
    touch_start(integer num_detected)
    {
        if(!particleOn)
        {
            particle(); //ON
        }
        else
        {
            stopParticle();
        }
    }
}

Visit my LSL wiki page for my library of simple scripts ! Toady Nakamura