text parser[D2 style talking interface]

Started by DeadlyJynx, Wed 12/05/2004 19:02:49

Previous topic - Next topic

DeadlyJynx

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]

--This is not a sig... this a a bar.

Scummbuddy

- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

LordHart

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.

Phemar


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.

Scorpiorus

#4
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);
}

Phemar


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?

Scorpiorus

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........"
{
....
....
....

SMF spam blocked by CleanTalk