Jump to content

llListen help...again...


OddbroShillings
 Share

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

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

Recommended Posts

I have this script. Appearently I have issues with "llListen" If only somebody could make good clear sence or a good tutorial.

Hmm.

 

Anyways, I have this script and I need llListen added to is for the function. I also want it where it has 2 "if (message)" but i only have 1 funtion, so I need help with the other function in off mode. If some can show me the function for off(non fullbright), and also need help with this llListen thing. Please....anyone...I need your help.

float delay = 2.0; //set the delay in seconds.
integer On = FALSE;

default
{
    state_entry()
    {
        llSetTimerEvent(delay);
        }
        timer()
        {
            On = !On;
            llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,On]);    
            }
        }

 

 

I tried to add a llListen but i dont know what Im doing wrong, because by the timmer() I keep getting a syntax error.

Link to comment
Share on other sites

It's not clear what you need a llListen handle for, since you don't have a listen event that would hear any chat.  The only problem with your script so far, though, is that you have mismatched brackets.  Try

float delay = 2.0; //set the delay in seconds.integer On = FALSE;default{    state_entry()    {        llSetTimerEvent(delay);    }    timer()    {        On = !On;        llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,On]);        }}

 If you want to listen for something, put your llListen handle somewhere where it will be activated before you need to listen (probably in the state_entry event, but not necessarily), and then create a listen event with commands that tell the script what to do when it receives a message.  Study http://wiki.secondlife.com/wiki/LlListen and http://wiki.secondlife.com/wiki/Listen for syntax and examples.

Link to comment
Share on other sites

Well thats just it, I need a listen event in the script, but have no idea how to put one in and where to put it. I want the listen event to trigger that script. Does that help any?

 

EDIT: I need it where, I say,(or an object) says something and it will trigger that whole script. Not only that, but I need an "off" portion for the script.

BTW, you have been very helpful, Thank you very much.

Link to comment
Share on other sites

No, it really doesn't help much at all.  As it is, the script starts automatically.  It sets a timer, which makes the object that it is in switch from FULLBRIGHT on to off every 2.0 seconds.  Would you rather turn the timer on with a chat command? If so, put the llListen handle in the state_entry event and then put your on/off swtich in a listen event, like this ...

float delay = 2.0; //set the delay in seconds.integer On = FALSE;default{    state_entry()    {        llListen(23,"","","");    }    listen(integer channel, string name, key id, string msg)    {        if (msg == "Start")        {            llSetTimerEvent(delay);        }        else if (msg == "Stop")        {            llSetTimerEvent(0.0);        }    }    timer()    {        On = !On;        llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,On]);        }}

 You can make that simple script much more compact, of course. Thing is, you might have something very different in mind when you say that you want to "trigger" the script with chat.  Scripting is only superficially about syntax.  It's primarily about knowing what you want to do and imagining a clear, logical roadmap for how you're going to get there.  You might want ....

float delay = 2.0; //set the delay in seconds.integer On = FALSE;integer Lsn;integer Guess;default{    state_entry()    {        Lsn = llListen(23,"","","");    }    listen(integer channel, string name, key id, string msg)    {        if (msg == "Start")        {            llSetTimerEvent(delay);            llSay(0,"System armed and locked.");            Guess = (integer)llFrand(5.0);        }        else if (msg == "Stop")        {            llSay(0,"I'm sorry, Dave. I can't let you do that.");            llSay(0,"You'll have one chance to guess the secret number between 0 and 4 that will disarm the system.");        }        else if ((integer)msg == Guess)        {            llSay(0,"System shutting down.");            llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]);                llSetTimerEvent(0.0);        }        else        {            llSay(0,"I will NEVER shut down, and I'm not listening to you..... lalalalalala!");            llListenRemove(Lsn);        }    }    timer()    {        On = !On;        llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,On]);        }}

 Or not. :smileytongue:

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4635 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...