Yonke Ming
Fat Laughing Hyena
Join date: 18 Jun 2005
Posts: 16
|
06-22-2005 20:44
Well, I need help with inputting text. See, I want it so that the script prompts you and you type something and that code is executed. For example... ---------------------------------------- Script: "How many apples do you want?"
You type in "3".
Script: "You recieve 3 apples". ---------------------------------------- Or in a much more complex case, say that I wanted you to choose a fruit AND how many.
---------------------CASE 1----------------------------------------- Script: "Which fruit do you want and how many?"
You type in "3 apples".
Script: "You recieve 3 apples".
-------------------CASE 2-------------------------------------------
Script: "Which fruit do you want and how many?"
You type in "53 oranges".
Script: "You recieve 53 apples". -----------------------------------------------------------------------
Yeah, something like that.
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
06-22-2005 21:13
it is an interesting idea. Most people just use a multi item vender, and then on pay divided the amount given by the price the results, minus the remainder, equals the number of items given.
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
06-22-2005 21:49
Try looking up llParseString2List in the scripting wiki (actually, just click the link, I already did it for you  ). llParseString2List allows you to split one string into many strings, given a seperator. For example, if you fed it "2 apples" and told it to parse the string with a seperator of " " (1 space), it will spit out a list containing two strings, "2" and "apples". Here's some code to get you started: default { state_entry() { string str = "2 apples"; list parsedStr = llParseString2List(str, [" "], []); llSay(0, llList2String(parsedStr, 0)); // Say first element of list. llSay(0, llList2String(parsedStr, 1)); // Say second element of list. } }
That should make an object say "2" then "apples" outloud. ==Chris
|