Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Atelier on Wed 13/01/2010 21:42:31

Title: Ignoring Specific Words in Strings [SOLVED]
Post by: Atelier on Wed 13/01/2010 21:42:31
I'm afraid I have another question about the text parser. Here's the code I have for a say command:


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:


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.
Title: Re: Ignoring Specific Words in Strings
Post by: Khris on Wed 13/01/2010 23:16:23
saycommand = saycommand.Substring(4, saycommand.Length-4);
Title: Re: Ignoring Specific Words in Strings [SOLVED]
Post by: Atelier on Thu 14/01/2010 17:42:18
Thank you Khris, I've also extended it to extract synonym words for say too, so it's pretty cool.