Text width

Started by Totoro, Sat 20/03/2004 11:50:26

Previous topic - Next topic

Totoro

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?

Scummbuddy

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

- 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

Kinoko

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.

Moox

different sized fonts?

Radiant

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.

SMF spam blocked by CleanTalk