Jump to content

Help needed with llSay script


Marsellus Walcott
 Share

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

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

Recommended Posts

Howdy

I'm currently struggling with a problem that I can't see to figure out.

The idea behind the script I need is to have it say something when touched, following a list. I need it to say each item of that list once per touch, pausing between items until it's touched again, eventually looping to the first item.

So, if 

list ChatList = ["A","B","C","Etc."];

I need it to say just "A" when first touched. Then "B" when touched a second time, "C" a third, "Etc." on its fourth touch, and it loops back to "A" if touched a fifth time. 

I can get it to say everything at once. To say it in different lines. Even to say it randomly (using a script I got here in these very forums), but I just can't figure out how to make it wait until touched again before it follows up with the list.

I'm quite sure this is something simple that somehow I just can't seem to get a grip.

Any help would be much appreciated.

Cheers ^^

Edited by Marsellus Walcott
Link to comment
Share on other sites

You need a counter controlling what to be handled, where the counter increases with each touch. Something like this:

list myList=["A","B","C","Etc."];

integer nCounter;

default
{
    state_entry()
    {
        nCounter= 0;
    }

    touch_start(integer total_number)
    {
        integer n= llGetListLength( myList );
        
        llSay( 0, "We proudly presents :" + llList2String( myList, nCounter));
        
        nCounter++;
        if (nCounter>=n)
            nCounter= 0;
    }
}

Remember a list is zero based, that is first entry is 0, second is 1 etc.

Based on the simplicity of above, you can really make quite advanced things,  combined with strided lists, categories are easy handled and used.

Edited by Rachel1206
  • Thanks 1
Link to comment
Share on other sites

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