Jump to content

indecision to > list <


Daniells Brandi
 Share

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

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

Recommended Posts

I have this code of list

 

list exemple = ["1","2","3","4","5","6"];
integer counter = 0;

listing(){
        integer len = llGetListLength(ani);                
        if (counter >= len)
            counter = 0;
         Say(0,llList2String(exemple,counter) );
         counter++;
        } 

 

 that works as follows

1 > 2 > 3 > 4 > 5 > 6 > 1 > 2 > 3 >....

------------

have some form of work like this ...

 

1 > 2 > 3 > 4 > 5 > 6 > 5 > 4 > 3 > 2 > 1 > 2 > 3 >....

 

thanks

 

Link to comment
Share on other sites

It's hard to know why the code is producing those results, because you didn't show us how your listing function is being called in the main script.  Your function increments counter each time it is called, but evidently something else in your script is changing its value between calls.  I suggest adding a statement like

llOwnerSay((string)counter) );

just before wherever your function is called, to see what its current value is.

Incidentally, you can use a shorter code to do what you want.....

 

listing(){    integer len = (ani !=[]);    //Same thing as llGetListLength(ani)    llSay( 0,llList2String( exemple,(++counter)%len ) );}

 

 

Link to comment
Share on other sites

What you said did not understand Rolig Loon

the list goes the same way  (sorry my english)

 

2 > 3 > 4 > 5 > 6 > 1 > 2 > 3 > 4 > 5 > 6 > 1 > 2 > .....

 

wanted to run this way..

1 > 2 > 3 > 4 > 5 > 6 > 5 > 4 > 3 > 2 > 1 > 2 > 3 >...

 

list exemple = ["1","2","3","4","5","6"];integer counter = 0;listing(){    integer len = (exemple !=[]);    //Same thing as llGetListLength(ani)    llOwnerSay(llList2String( exemple,(++counter)%len ) );}default{    state_entry()    {//        llSay(0, "Hello, Avatar!");    }    touch_start(integer total_number)    {       listing();    }}

 

Link to comment
Share on other sites

Oh!   I didn't understand what you wanted.  I thought that it was doing 1 > 2 > 3 > 4 > 5 > 6 > 5 > 4 > 3 > 2 > 1 > 2 > 3 >... by mistake.  :smileyhappy:

OK, so you want it to count to the end of exemple and then reverse?  I can't get in world to try this at the moment, but I think it looks correct.......

 

list exemple = ["1","2","3","4","5","6"];integer count;integer Dir = -1;  //Should be 1, not -1. See the posts below....listing(){     llSay(0,llList2String(exemple, (count = count + Dir)));     integer len = (exemple !=[]);     if  (count == 0 || count == len-1)     {          Dir = -Dir;     }}default{     touch_start(integer num)     {          listing();     }}

 It will skip the first entry in exemple the first time that it goes around the cycle, but I think it will be correct after that.

 EDIT: Two small typing errors corrected above.  See also the note regarding the sign on Dir.

Link to comment
Share on other sites

Does not work Dolig, get on the end of the list (6) and when he arrives at the beginning, is not positive.

yes, that is what i want by clicking on the object, starts the 1st item will listae until the last when it comes in last, back to the penultimate (5) after (4) 2 and 3 when it arrives in the first list item (1) goes to the 2nd (2)> (3)> ..

Link to comment
Share on other sites

Good.  I assume that you also corrected my two typing errors.  I have corrected them in my post above too.  Sorry about that.  BTW, if you want to have the numbers start correctly, you can add one additional variable (start), as I have here....

list exemple = ["1","2","3","4","5","6"];integer count;integer Dir = 1;integer start = TRUE;listing(){     llSay(0,llList2String(exemple, (count = count + Dir)));     integer len = (exemple !=[]);     if  (count == 0 || count == len-1)     {          Dir = -Dir;     }}default{     touch_start(integer num)     {         if (start)         {            llSay(0,llList2String(exemple, 0));            start = FALSE;         }         else         {                         listing();         }     }}

 

Link to comment
Share on other sites

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