Swimmie Chaffe Posted March 15, 2015 Share Posted March 15, 2015 Greetings,I am wondering if there is any way to read llDialog list from a notecard, but read a list only as labels and keep associated actions static. What I am hoping to accomplish is to have a line such as below in a script:list MENU = ['option 1," "option 2", "option 3", "option 4"];and substitute these generic "option 1" ... list with more meaningful labels read from a notecard. In the end, I would like to be able to prompt an action using the original list -- e.g., if an avatar chooses option 1, no matter what label it may be associated with, will prompt the same action that is associated with option 1.Is it possible to do this? If so, how shall I set up a script and notecard? Your advise will be appreciated. Thanks in advance!Swimmie Link to comment Share on other sites More sharing options...
Ivanova Shostakovich Posted March 15, 2015 Share Posted March 15, 2015 You can use llListFindList to obtain the index of a particular choice in one list, and use the result with llList2String to return the contents of that index in another list. 1 Link to comment Share on other sites More sharing options...
Ohjiro Watanabe Posted March 15, 2015 Share Posted March 15, 2015 Here is an example of a notecard based menu: http://wiki.secondlife.com/wiki/User:Kephra_Nurmi/lsDialog 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 15, 2015 Share Posted March 15, 2015 Try http://wiki.secondlife.com/wiki/Read_Note_Card_Configuration Code your notecard with a single line with values for your list options: Blue,Red,Green,Puce or Left,Right,Inside,Outside or Chicago,New York,Boston, Kokomo whatever..... In your dataserver event, read the line as a single variable and decode as list gOptions = llCSV2List(data); Then go ahead and use gOptions in your llDialog statements, wherever they appear, and in the if tests in your listen event. 1 Link to comment Share on other sites More sharing options...
Swimmie Chaffe Posted March 18, 2015 Author Share Posted March 18, 2015 Thanks Ivanova, Ojiro and Rolig for your replies! I can have a script read a list from a NC, but when I do that, a list on the NC replaces the original list. What I am trying to do is to retain the original generic list (option 1, option 2 etc), so that I can use option 1, option 2 etc, as global variables. I'll study Wikis you shared more closely. Thanks again! Link to comment Share on other sites More sharing options...
Innula Zenovka Posted March 18, 2015 Share Posted March 18, 2015 I am a little confused, still, about what you want to do, but if I correctly understand you, I think you might want to take a look at one of the scripts Rolig has contributed to the library, Dialog Choices from Numbered Buttons, That does pretty much what I think you're describing. Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 18, 2015 Share Posted March 18, 2015 Swimmie Chaffe wrote: [ ....] I can have a script read a list from a NC, but when I do that, a list on the NC replaces the original list. [ .... ] Sorry. I thought that's what you wanted to do. Something generically like this, using the appropriate global variables .... dataserver (key id, string data){ if (id == gkTheKeyIWasExpecting) { glMyButtons = llCSV2List(data); // where "data" is a notecard line with button labels separated by commas }}touch_start(integer num){ llListen(giMyChannel,"","",""); llDialog(llDetectedKey(0)," \n Pick an option", glMyButtons,giMyChannel);}listen (integer channel, string name, key id, string msg){ integer idx = llListFindList(glMyButtons,[msg]); if (idx == 0) { // Do option one } else if (idx == 1) { //Do option two } // And so forth} 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