User:Toady Nakamura/Touch Toggle Particle

From Second Life Wiki
< User:Toady Nakamura
Revision as of 15:17, 30 July 2015 by Toady Nakamura (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
   by Toady Nakamura]
   Place in prim, touch to turn particles on and off.
   Example of on/off toggling

<style ="lsl2"> 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();
       }
   }

}

</style>