Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Phemar on Wed 28/04/2004 14:09:46

Title: About Lip-Syncing...
Post by: Phemar on Wed 28/04/2004 14:09:46
I'm having trouble with my text-parser...

It works fine as long as everything is according to my "dictionary" If I type something that isn't in my parser-list it says "I don't understand 'doro' ", just like it should. After that it doesn't understand anything I say, it just goes "I don't understand ' ' ", just like it shouldn't. This could cause some serious problems for the player, you see. Here is some code I though might help:

 if (interface == 0) {    //parser
   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;
          }
        }
      }
    }
  }


Secondly I get a "two room changes requested within one script" error for this: (error line in bold)
   if (gotnum==1) {
     DisplaySpeech (ALL, "I don't think this is the right place...");
     DisplaySpeechBackground (ALL, "I think I'll look around the street corner here...");
     MoveCharacterBlocking (ALL, 270, 117, 1);
     ChangeCharacterView (ALL, 8);
    SetPlayerCharacter (KEV);
     }
   }
 }
They're both solved!


And lastly does anyone have any tips for synchronising talking frames to the text being said? (tutorials, which letters should be grouped...etc.)[/u][/i]

Anything anyone contributes is already greatly appreciated!


EDIT: Oh yes, is there any function for disabling and enabling walkbehinds?

EDITEDIT: Why oh why does it not preserve my indentation? oh well...
Done too!
Title: Re:Text-Parser, Lip-Sync and a few other things...
Post by: SSH on Wed 28/04/2004 14:22:11
Quote from: Zor© on Wed 28/04/2004 14:09:46
And lastly does anyone have any tips for synchronising talking frames to the text being said? (tutorials, which letters should be grouped...etc.)
Just checking that you knwo that lipsync is for Sierra-style speech only

Quote
EDIT: Oh yes, is there any function for disabling and enabling walkbehinds?
SetWalkbehindBaseline... if you set the baseline to 0, everything will be in front of it.

Quote
EDITEDIT: Why oh why does it not preserve my indentation? oh well...

use [ pre ] ...code... [ / pre ], which CJ should really add to the yabbse help page

I'm afraid I know nothing about the parser stuff, though  :-\
Title: Re:Text-Parser, Lip-Sync and a few other things...
Post by: Phemar on Wed 28/04/2004 14:56:00

Yep, thank you very much. I have been using Sierra-style speech.

Changed it to [ pre ]

And thanks for the walkbehind tip!
Title: Re:Text-Parser, Lip-Sync and a few other things...
Post by: Scorpiorus on Wed 28/04/2004 15:18:12
QuoteIf I type something that isn't in my parser-list it says "I don't understand 'doro' ", just like it should. After that it doesn't understand anything I say, it just goes "I don't understand ' ' ", just like it shouldn't.
if (SaidUnknownWord(unknownbuffer)) { <-check that brace

QuoteSecondly I get a "two room changes requested within one script" error for this: (error line in bold)
Is KEV in another room? Could you post the rest of script code within the function?
Title: Re:Text-Parser, Lip-Sync and a few other things...
Post by: Phemar on Wed 28/04/2004 16:22:29
KEV is in room 3. KEV is the main character, ALL is the cop and SCO is the cop scooter.

    if (Said("look window")) {
     MoveCharacterBlocking (KEV, 294, 161, 1); //move to window
     AnimateCharacter (KEV, 4, 0, 1); //kev crouchs
     DisplaySpeech (KEV, "Oh s**t! The cops are here already!");
     SetPlayerCharacter (SCO);
     NewRoomEx (4, 313, 156); //sends the scooter to outside room
     }
   }

in room 4:
  // script for room: Player enters screen (after fadein)
 if (GetPlayerCharacter()==SCO) {
   MoveCharacterBlocking (SCO, 224, 182, 1);
   Wait (40);
   ChangeCharacterView (SCO, SCOOTER);
   SetPlayerCharacter (ALL);
   ChangeCharacterView (ALL, ALLAN);
   NewRoomEx (4, 214, 152);
   MoveCharacterBlocking (ALL, 136, 152, 1);
   Wait (40);
   SetBackgroundFrame (1);
   if (gotnum==0) {
     ObjectOff (0);
     }
   SetCharacterView (ALL, BLANK);
   SetCharacterView (SCO, BLANK);
   WaitMouseKey (500);
   SetBackgroundFrame (0);
   if (gotnum==0) {
     ObjectOn (0);
     }
   ReleaseCharacterView (SCO);
   ReleaseCharacterView (ALL);
   Wait (40);
   if (gotnum==1) {
     DisplaySpeech (ALL, "I don't think this is the right place...");
     DisplaySpeechBackground (ALL, "I think I'll look around the street corner here...");
     MoveCharacterBlocking (ALL, 270, 117, 1);
     ChangeCharacterView (ALL, 8);
     SetPlayerCharacter (KEV);
     }
   else if (gotnum==0) {
     DisplaySpeech (ALL, "Ah ha! You're going down, baby!");
     ObjectOn (1);
     WaitMouseKey (500);
     ObjectOff (1);
     MoveCharacterBlocking (ALL, 125, 142, 1);
     ChangeCharacterView (ALL, BLANK);
     Wait (80);
     }
   }
 }    


Oh, and thanks, now the parser totally works!
Title: Re:Text-Parser, Lip-Sync and a few other things...
Post by: Scorpiorus on Wed 28/04/2004 16:48:34
SetPlayerCharacter(KEV) would change the room but the problem is that you already requested a room change with the NewRoomEx (4, 214, 152); line. Keep in mind the room isn't changed instantly. Instead the engine finishes running current script (player enters screen) first. A solution would be to remove NewRoomEx (4, 214, 152); line  at all.
Title: Re:Text-Parser, Lip-Sync and a few other things...
Post by: Phemar on Wed 28/04/2004 19:09:25

That newroomex isn't the problem...it's by the bold word.

The NewRoomEx works just fine...you see the player is already in room 4 so he just gets sent to new co-ords...
Title: Re:Text-Parser, Lip-Sync and a few other things...
Post by: Scorpiorus on Wed 28/04/2004 21:46:36
Just try replacing NewRoomEx (4, 214, 152); with

character[GetPlayerCharacter()].x = 214;
character[GetPlayerCharacter()].y = 152;


That's because you still call NewRoom() two times! 1st - NewRoomEx (4, 214, 152); and the 2nd one indirectly by setting player character who is in a different room - SetPlayerCharacter (KEV).
Title: Re:Text-Parser, Lip-Sync and a few other things...
Post by: Phemar on Thu 29/04/2004 04:50:49

Right, so it worked...wierd. But thanks!!!
Title: Re:About Lip-Syncing...
Post by: Scorpiorus on Thu 29/04/2004 17:48:55
No problem ;)

Just to make it clear - AGS doesn't allow two or more NewRoom() commands going withing the same script sequence, like:

function room_*() {

   NewRoom(...);
   NewRoom(...);
}

You had:

function room_*() {

   NewRoom(...);
   SetPlayerCharacter(KEV);
}

but since SetPlayerCharacter(KEV); requires the room to be changed it calls NewRoom() by itself and you have it like there two NewRoom commands present:

NewRoom(...);
SetPlayerCharacter(KEV); --> calls NewRoom(<KEV's room>);

...and that's not allowed.

~Cheers