Question Regarding the Text Parser [SOLVED]

Started by dgill, Wed 07/11/2007 00:49:39

Previous topic - Next topic

dgill

Is there anyway to use the group number associated with a word in the text parser instead of having to type out the word itself?  I want to use this to be able to randomly pick a word using the int values and then convert that int into the word associated with it and output it to the screen.  Is this possible in anyway.

monkey0506

#1
There's no way to directly access the parser's word bank, however you could set up an array in the global script:

Code: ags
// put this in your script header
import String ParserWords[20];

// put this at the top of your global script
String ParserWords[20]; // change 20 to as many parser words as you need
export ParserWords;

// put this in your global script's game_start function
ParserWords[0] = "a";
ParserWords[1] = "all";
ParserWords[2] = "an";
ParserWords[3] = "at";
// etc.

// then inside of some function you can do:
Parser.ParseText(ParserWords[Random(19)]); // use one less than max parser words because Random is inclusive 0-X, so if you have 20 words your array indices are 0-19

dgill

That will work, thanks for the help.

SMF spam blocked by CleanTalk