Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: DeadlyJynx on Wed 12/05/2004 19:02:49

Title: text parser[D2 style talking interface]
Post by: DeadlyJynx on Wed 12/05/2004 19:02:49
hoe can i get a chat screen like the one Diablo ll has.
its would go great with the game me and my friends are creating.
if you need a bigger explanation..
here it is

you type somthing in and i want it displayed  so that  i can see wut i said[kinda like a multiplayed chat interface]
Title: Re: text parser[D2 style talking interface]
Post by: Scummbuddy on Wed 12/05/2004 19:23:50
theres a text parser template available in the tech archive forum. http://www.agsforums.com/yabb/index.php?topic=9435.0
Title: Re: text parser[D2 style talking interface]
Post by: LordHart on Thu 13/05/2004 04:52:57
Also, I suggest if you want to have a parser, have plenty of patience, as you need to edit the parser as its only bare minimum there, and it takes a long time.
Title: Re: text parser[D2 style talking interface]
Post by: Phemar on Fri 14/05/2004 15:24:28

I think what he wants is for the player to type something in and it displayed as speech.


[I'm not sure at all about this]
string speech=GetTextBoxText(int GUI, int OBJECT);
DisplaySpeech (CHAR, "%s", speech);
return;


This is probably all wrong.

I'd also like to know how to get the player to say something if the player says "say door" kinda thing, then I will have the player say door.
Title: Re: text parser[D2 style talking interface]
Post by: Scorpiorus on Fri 14/05/2004 15:46:32
Quote from: Zor© on Fri 14/05/2004 15:24:28I'd also like to know how to get the player to say something if the player says "say door" kinda thing, then I will have the player say door.

Something like this:

ParseText(input); //load for parsing

if (Said("say rol")) // if "say blah blah blah........"
{

   //getting rid of 'say' word
   int delta = StrContains(input, "say")+StrLen("say")+1;
   int i = delta;
   while (i<=StrLen(input))
   {
      StrSetCharAt(input, i-delta, StrGetCharAt(input, i));
      i++;
   }

   // finally display
   DisplaySpeech(GetPlayerCharacter(), input);
}
Title: Re: text parser[D2 style talking interface]
Post by: Phemar on Fri 21/05/2004 12:58:25

Alright, but where shall I put that.

I've got this script for my parser:


if (interface == 0) {
    if (button == 0)
    {string forparser,unknownbuffer;
     StrCopy(forparser,"");
     GetTextBoxText(0,0,forparser);
     SetTextBoxText (0,0, "");
     InterfaceOff(0);
     if (StrComp(forparser,""))
      {ParseText(forparser);
       if (SaidUnknownWord(unknownbuffer)) {
         if (rand==0) {
           Display ("I don't understand the word '%s'.",unknownbuffer);
           rand=1; return;
           }
         if (rand==1) {
           Display ("Could you rephrase the word '%s'?",unknownbuffer);
           rand=2; return;
           }
         if (rand==2) {
           Display ("%s is greek to me!", unknownbuffer);
           rand=0; return;
           }
         }
       if (Said("talk self")) {
         DisplaySpeech (KEV, "Well, how do you do?");
         Display ("You talk to yourself and you already know what you're going to say.");
         }
//Should I put it here?
       else {
         CallRoomScript (1);
         }       
       }
     }
   }


Where?
Title: Re: text parser[D2 style talking interface]
Post by: Scorpiorus on Fri 21/05/2004 13:26:51
Yeah, put it there and replace the input variable with forparser one.

Also change the "if" conditional a bit, so the script would work correctly when the player just types-in "say":

if (Said("say rol") && StrContains(forparser, "say ")>-1) // if "say blah blah blah........"
{
....
....
....