Letter by letter msg display, Does it possible ?

Started by Gumustdo, Sun 27/09/2009 06:00:56

Previous topic - Next topic

Gumustdo

Hello,
I've tried out AGS quite a bit week ago. And have a questing about text/dialog displaying.
Dialog are displayed all sentence/speech at once. Does is possible to make it display letter by letter like SNES's RPG style?

Here's an example from ClockTower[SNES]
http://www.youtube.com/watch?v=Ng72snjGLCU

Thanks in advance ;)

tzachs

Here is something to start with, put in globalscript.asc:

Code: ags

function SayLetterByLetter(this Character*, String sentence)
{  
  String builder = "";
  int i=0;
  while (i < sentence.Length)  
  {
    builder = builder.AppendChar(sentence.Chars[i]);
    this.SayBackground(String.Format("%s", builder));    
    Wait(5);
    i++;
  }
  Wait(40);  
}


and in globalscript.ash:
Code: ags

import function SayLetterByLetter(this Character*, String sentence);


and you can use it from the rooms script;
Code: ags

cEgo.SayLetterByLetter("This is the first sentence");

NsMn

Nope, it's not possible in General, you would have to make a costum GUI/function. Try this code:

Code: ags

//global script start

int Letterspeed;

function SayRPGGUI(this Character*,const string message){
 String Text=message;
 gRPGSpeech.Visible=true;
 int for=1;
 while(for<=Text.Length){
  lblRPGSpeech.Text=Text.Truncate(for);
  PlaySound(2);
  Wait(1);
  for=for+Letterspeed;
 }
 WaitKey(10000);
 gRPGSpeech.Visible=false;
 lblRPGSpeech.Text="";
}


Should work. Remember to declare the function and Letterspeed in the Global header, and to set Letterspeed in game_start (if it's 0, the game will crash because the loop will be repeated to many times).

Gumustdo

Thank you very much, NsMn,tzachs. :D

I'll try them out.

SMF spam blocked by CleanTalk