Ignoring Specific Words in Strings [SOLVED]

Started by Atelier, Wed 13/01/2010 21:42:31

Previous topic - Next topic

Atelier

I'm afraid I have another question about the text parser. Here's the code I have for a say command:

Code: ags

function InputBox_OnActivate (GUIControl *control)
{
   Parser.ParseText(InputBox.Text);
   String saycommand = InputBox.Text; //The string I'm using to store the command temporarily is saycommand.

   if (Parser.Said("say rol")) Display("You say aloud: \"\%s\"\.", saycommand);


This works fine, however, since the player types in "say something" the say also appears in the display, so it ends up like this:

Code: ags

You say aloud: "say something".


Is there a way to extract the word 'say' from my saycommand string, so it's just left with whatever the player typed after it? I'd be really grateful for any solutions.

Khris

saycommand = saycommand.Substring(4, saycommand.Length-4);

Atelier

Thank you Khris, I've also extended it to extract synonym words for say too, so it's pretty cool.

SMF spam blocked by CleanTalk