Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Totoro on Sat 20/03/2004 11:50:26

Title: Text width
Post by: Totoro on Sat 20/03/2004 11:50:26
Hello :) Though I don't think I am a beginner anymore, the question seems to be so basic, or I am missing something really stupid, so I put it here...
WHen I have my character talk, the displayed speech stretches over the whole screen, but I don't like it that way. I want it to be put only over his head, using several lines if the text is too long. How can I set the maximald width (or length? I mean the maximal x-value-extension) of speech r displayed text?
Title: Re:Text width
Post by: Scummbuddy on Sun 21/03/2004 16:30:46
From the manual:
DisplaySpeechAt
DisplaySpeechAt (int x, int y, int width, CHARID, string message)

Similar to DisplaySpeech, except that the text is displayed with its top left corner at (X,Y), in an area WIDTH wide.
You can use this function to write the character's speech text anywhere you like, and AGS will still play the character's talking animation and so on if appropriate.

NOTE: This function does not support QFG4-style speech.

Example:

DisplaySpeechAt (220, 20, 100, EGO , "My name is ego");

will display the message in the top right corner of the screen, and play the character's talking animation.
See Also: DisplaySpeech, DisplaySpeechBackground

Title: Re:Text width
Post by: Kinoko on Sun 21/03/2004 23:56:16
But isn't there a way to just set the text width for that character? Because DisplayTextAt works fine until you have to write a dialogue, and for a main character, it could be extremely frustrating to have to set the width individually for every response to every interaction etc.
Title: Re:Text width
Post by: Moox on Mon 22/03/2004 03:07:59
different sized fonts?
Title: Re:Text width
Post by: Radiant on Mon 22/03/2004 09:25:15
Simply write a function

Speak (int person, string text) {
  DisplaySpeechAt (character[person].x - 50, character[person].y - 20,
  100, person, text);
}

You'd have to add some checking to see if the x is close to either screen edge.