TessaAnnaMarie Posted June 8, 2023 Share Posted June 8, 2023 Okay i have 2 lists. I'll keep it simple here. list Numbers = ["1", "2", "3", "4", "5"] list Letters = ["A", "B", "C", "D", "E"] What I need to do is check to see if something is in a list. if(msg == llListFindList(Numbers, (Numbers)msg)) { llSay(0, **this is where I need help**); } Simple. But what I need the outcome to do is use the letter that corresponds to the number. Meaning if the message is "3", the outcome will say "C". I'm pretty sure this is doable, but I can't for the life of me figure out how. Link to comment Share on other sites More sharing options...
CmpZ Posted June 8, 2023 Share Posted June 8, 2023 (edited) I'm not in front of a computer that can run SL at the moment, so I can't test it, but I believe you do this: Do_The_Thing( string value ) { integer n; n = llListFindList( Numbers, [value] ); if (-1 == n) { // not found } else { llOwnerSay( llList2String( Letters, n ) ); } } The difference between this & your original code is that this one saves the result from llListFindList &, if it's in range (not -1), uses it as the index into the Letters list. Edited June 8, 2023 by CmpZ Corrected type of second actual argument to llListFindList 1 Link to comment Share on other sites More sharing options...
TessaAnnaMarie Posted June 8, 2023 Author Share Posted June 8, 2023 17 minutes ago, CmpZ said: I'm not in front of a computer that can run SL at the moment, so I can't test it, but I believe you do this: Do_The_Thing( string value ) { integer n; n = llListFindList( Numbers, value ); if (-1 == n) { // not found } else { llOwnerSay( llList2String( Letters, n ) ); } } The difference between this & your original code is that this one saves the result from llListFindList &, if it's in range (not -1), uses it as the index into the Letters list. Thank you! Some minor adjustments and yes, this works! Thank you! 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