|
Cypher Ragu
[Mad Scientist]
Join date: 6 Jul 2008
Posts: 174
|
10-20-2008 19:40
Hello everyone... I've been working on a control system for some of my products, and I have run into a roadblock. The system involves reading different notecards and creating lists of actions the script would need to perform. All of the user input is through llDialog. Some of the lists it would create would be: --Buttons to be displayed on the dialog --Strings to say in chat, depending on previous input --Strings and integers to broadcast to other products What I need to do is be able to find out the NUMBER of the choice the user has selected from the dialog menu, rather than just the string itself. For example, if the user chooses Choice1, the script would turn that into an integer so it can broadcast the correct message to all the other products. Choice 1 >> Mssg 1 >> Action 1 Choice 2 >> Mssg 2 >> Action 2 ...Etc... Any help is appreciated, although I'm sure this post is pretty hard to understand 
_____________________
Life is a highway... And I just missed my exit.
|
|
Klug Kuhn
Registered User
Join date: 7 Sep 2007
Posts: 126
|
10-20-2008 19:57
Try using llListFindList(). Say if your menu_button list is [ Choice0, Choice1, Choice2 ], then in the listen event you'd check:
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ integer input_index = llListFindList(menu_button, (list)input); if(input_index == 0) { llSay(0,Mssg0); // perform Action 0 } else if(input_index == 1) { llSay(0,Mssg1); // perform Action 1 } else if(input_index == 2) { llSay(0,Mssg2); // perform Action 2 } _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
10-20-2008 20:31
llSubStringIndex to find the space in your message then llSubString starting at whatever llSubStringIndex returned + 1 to the end of the string ie llSubString(message, llSubStringIndex(message, " "  + 1, -1);
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
10-20-2008 20:55
I often prepend or append the number to the actual button string. Then just strip it off, convert it to an integer, and you're golden. Note that this takes carefully truncating the strings to fit the number in, but you really can't get 24 characters on a button anyway, so....
|
|
Cypher Ragu
[Mad Scientist]
Join date: 6 Jul 2008
Posts: 174
|
10-21-2008 20:22
Thanks everyone, your suggestions worked perfectly.
_____________________
Life is a highway... And I just missed my exit.
|