Jump to content

@.@ Is it possible?


Poocaz
 Share

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

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

Recommended Posts

So, for those who had posted on my earlier post "multiple listen fors within a listen script", if you are reading this you probably already have deduced that I am making a listener, which performs various actions/replies when keywords are detected in a specified chat. If your not one of those earlier people, well.... thats what im doing :p

By now, I am at a meager 100 lines of if(message""){ lines lol (anyone care to tell me how many lines of script you can make in a script, is there even a cap? O.o) and I was begining to wonder, can you have multiple instances of the same word present in a listen script. So take for example the following code, which most likely contains improper syntax, but is made to represent the function I would want based on what I currently know about LSL:

default

 {

 state_entry()

    {

        llListen(0,"", llGetOwner(), "");

    }

 

    listen(integer channel, string name, key id, string message) {

    if(message=="get lost"){

    llSay(0,"You seriously want me to get lost?");

    {if(message=="yes"){

    llSay(0,"Ok then..");

    }

   

    if(message=="no"){

    llSay(0,"Then why did you tell me t- >.< nvm...");

        }

    }

    if(message=="go away"){

    llSay(0,"You really want me to go away?");

    {if(message=="yes"){

    llSay(0,"Ok");

    }

    if(message=="no"){

    llSay(0,"Jeez, such a dolt, make up your mind already!);

        }

    }

}

Anyone get what im aiming at? The idea of having the same word(s) , in this case "yes" and "no", appear multiple times throughout the script, i guess the script would not progress (would not listen for any other keywords; besides the two) until either the yes or no was stated/said. Upon being said the script would run the following command(s) (in our case they are llSay commands), then go back to listening for the keywords "go away" or "get lost". If either was called the process would begin again. Script stops and listens for those two keywords specified "yes" or "no", does following command (if any), goes back to listening.

Sorry, I'm not very good at explaining >.<, but I hope one of you pros got the jist of it and can throw me some pointers.

Thanks,

Z

Link to comment
Share on other sites

You can do that, but it won't do what you expect.  As written, every one of your if tests that ask if(message == "yes") will always return TRUE, so every single block of code in them will always be executed.  Same with the ones that test for "no".  If you want to have a sequence of actions like that, you''ll need to add a flag or a counter or some kind.

if (message == "yes")

{

     if (counter == 1)

     {

          //do this stuff the first time

         counter = 2;

     }

     else if (counter == 2)

     {

          // do this stuff the second time

     }

}

else if (message == "no")

and so forth

Link to comment
Share on other sites

Other idea :

 

string MSG_1 = "get lost";string QUESTION_1 = "You seriously want me to get lost?";string MSG_2 = "Ok then..";string MSG_3 = "Then why did you tell me t- >.< nvm...";string MSG_4 = "go away";string QUESTION_2 = "You really want me to go away?";string MSG_5 = "Ok";string MSG_6 = "Jeez, such a dolt, make up your mind already!";string YES ="yes";string NO ="no";default{    state_entry()    {        llOwnerSay( (string)llGetUsedMemory());        llListen(0,"", llGetOwner(), MSG_1);        llListen(0,"", llGetOwner(), MSG_4);    }    listen(integer channel, string name, key id, string message)     {        if ( message == MSG_1)            state getLost;        else            state goAway;    }}state getLost{    state_entry()    {        llSay(0, QUESTION_1);        llListen(0,"", llGetOwner(), YES);        llListen(0,"", llGetOwner(),  NO);    }    listen(integer channel, string name, key id, string message)     {        if (message == YES )            llSay(0, MSG_2);        else            llSay(0, MSG_3);        state default;    }}state goAway{    state_entry()    {        llSay(0, QUESTION_2);        llListen(0,"", llGetOwner(), YES);        llListen(0,"", llGetOwner(),  NO);    }    listen(integer channel, string name, key id, string message)     {        if (message == YES )            llSay(0, MSG_5);        else            llSay(0, MSG_6);        state default;    }    }

 

 

Link to comment
Share on other sites

Other idea :

 

string MSG_1 = "get lost";string QUESTION_1 = "You seriously want me to get lost?";string MSG_2 = "Ok then..";string MSG_3 = "Then why did you tell me t- >.< nvm...";string MSG_4 = "go away";string QUESTION_2 = "You really want me to go away?";string MSG_5 = "Ok";string MSG_6 = "Jeez, such a dolt, make up your mind already!";string YES ="yes";string NO ="no";default{    state_entry()    {        llOwnerSay( (string)llGetUsedMemory());        llListen(0,"", llGetOwner(), MSG_1);        llListen(0,"", llGetOwner(), MSG_4);    }    listen(integer channel, string name, key id, string message)     {        if ( message == MSG_1)            state getLost;        else            state goAway;    }}state getLost{    state_entry()    {        llSay(0, QUESTION_1);        llListen(0,"", llGetOwner(), YES);        llListen(0,"", llGetOwner(),  NO);    }    listen(integer channel, string name, key id, string message)     {        if (message == YES )            llSay(0, MSG_2);        else            llSay(0, MSG_3);        state default;    }}state goAway{    state_entry()    {        llSay(0, QUESTION_2);        llListen(0,"", llGetOwner(), YES);        llListen(0,"", llGetOwner(),  NO);    }    listen(integer channel, string name, key id, string message)     {        if (message == YES )            llSay(0, MSG_5);        else            llSay(0, MSG_6);        state default;    }    }

 

 

Link to comment
Share on other sites

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