Jump to content

Help with Trigger with chat command


TrinityReclusive
 Share

You are about to reply to a thread that has been inactive for 544 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Ok i cant seem to get this right so help would be great.

I want to trigger the following particle script with a chat command  On & Off (channel not important can change latter)

default
{
    state_entry() {
        llParticleSystem( [  
            PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE,
            PSYS_SRC_BURST_PART_COUNT,(integer) 4,
            PSYS_SRC_BURST_RATE,(float) .05,          
            PSYS_PART_MAX_AGE,(float)  .6,            
            PSYS_SRC_BURST_SPEED_MIN,(float)1,        
            PSYS_SRC_BURST_SPEED_MAX,(float) 7.0,      
            PSYS_PART_START_SCALE,(vector) <0,.1,0>,
            PSYS_PART_END_SCALE,(vector) <.04,.5,0>,   
            PSYS_PART_START_COLOR,(vector) <1,0,0>,  
            PSYS_PART_END_COLOR,(vector) <.2,0,0>,   
            PSYS_PART_START_ALPHA,(float)0.5,          
            PSYS_PART_END_ALPHA,(float)0.00,          
            PSYS_PART_FLAGS,
                 PSYS_PART_EMISSIVE_MASK |     
                 PSYS_PART_FOLLOW_VELOCITY_MASK |
                 PSYS_PART_FOLLOW_SRC_MASK |   
                 PSYS_PART_INTERP_SCALE_MASK                  
        ] );
    }
}

The above is the particle i want to trigger on and off with a chat command. I have tried different ways from what i have read but never worked.

So i ask the pros here what to add and where to get the above particle to trigger On & Off by chat Command. My Minds is melting but then its 3 am lol

Help please if you would be so kind.

script.jpg

Link to comment
Share on other sites

To use chat to trigger anything, a script must first set up a listener by calling llListen() and having a listen() event handler. The linked wiki articles give some examples.

The llParticleSystem() call, then, will move from the state_entry() handler to the listen() handler, where it should appear when the input text is "on" (or whatever chat you want) and where the corresponding "off"-like command clears the particles with the empty-list call:  llParticleSystem([]); 

Instead, state_entry() will contain that call to llListen(). You'll need to make a design decision about whether it just keeps one listener open all the time or if should only listen after some even earlier trigger (such as a touch). If it should listen at all times, the script won't need to keep the listen "handle" in order to remove or manipulate that listen later, but in that case you should carefully consider whether it really, really needs to be listening to general chat on channel 0 (extra super laggy) or if it might be okay to listen on some other channel (so the chatter would specify which channel, typing "/1 on" to send "on" to a channel 1 listener).

Also specified in the llListen() call is to whom the script will listen. The combination of listening for everybody's chat on channel 0 should be avoided in almost all cases. If you really, really need to do that, then you probably would want to track listen handles so as to specify the exact "on" or "off" command for which it's momentarily listening, using complementary calls to llListenControl() to switch between them.

Link to comment
Share on other sites

  • 2 years later...
You are about to reply to a thread that has been inactive for 544 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...