Marsellus Walcott Posted March 22, 2019 Share Posted March 22, 2019 (edited) 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 March 22, 2019 by Marsellus Walcott Link to comment Share on other sites More sharing options...
Rachel1206 Posted March 22, 2019 Share Posted March 22, 2019 (edited) 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 March 22, 2019 by Rachel1206 1 Link to comment Share on other sites More sharing options...
Marsellus Walcott Posted March 22, 2019 Author Share Posted March 22, 2019 Thank you very much! Worked perfectly, and I just learned another subject to further properly study. ^^ You're golden. Cheers 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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