Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Nahuel on Wed 07/09/2022 09:37:36

Title: Custom Display Text per Character | Text GUI selection during the game [SOLVED]
Post by: Nahuel on Wed 07/09/2022 09:37:36
Hi everyone, I hope you all are doing well.

I'm facing an issue that the Display function can only point to the particular configuration under general settings > custom text window.
My goal is to create a different text color based on the character that is playing, this should be only 3, instead of showing the same text window i would like to customise the colour of the text displayed but I cannot access the font-color property anywhere.

Any ideas of how to achieve this?

Thanks for your time.

Nahuel
Title: Re: Custom Display Text per Character | Text GUI selection during the game
Post by: Khris on Wed 07/09/2022 11:22:39
Assuming you have created a custom TextWindowGUI named  gTextGui  you can call
Code (ags) Select
  gTextGui.TextColor = some_new_color;

The manual entry even has a custom ready-to-use extender function as example code:
Code (ags) Select
function MySay(this Character*, const string message) {
  gTextGui.AsTextWindow.TextColor = this.SpeechColor;
  this.Say(message);
}


Set the character's .SpeechColor, then use  cEgo.MySay("Hello World!");
Title: Re: Custom Display Text per Character | Text GUI selection during the game
Post by: Nahuel on Wed 07/09/2022 13:28:55
Thanks Khris,

I noticed that the accesor AsTextWindow did he trick, I changed it to
Code (ags) Select

function MySay(this Character*, const string message) {
  gTextGui.AsTextWindow.TextColor = this.SpeechColor;
  Display(message);
}


And the general configuration is not pointing to the new gTextGui and also customised the message to add the Char name.

Unfortunately gTextGui.TextColor = some_new_color; this is returning an error but of course fixed with AsTextWindow

Thanks again
Title: Re: Custom Display Text per Character | Text GUI selection during the game [SOLVED]
Post by: eri0o on Wed 07/09/2022 13:47:06
You should reaaaally use a character Say function instead of using the Display function. Display pauses the entire game and is only there for backwards compatibility - later if you want to have some animation going on or do a function at the same time, it won't be possible.
Title: Re: Custom Display Text per Character | Text GUI selection during the game [SOLVED]
Post by: Nahuel on Wed 07/09/2022 13:54:16
Quote from: eri0o on Wed 07/09/2022 13:47:06
You should reaaaally use a character Say function instead of using the Display function. Display pauses the entire game and is only there for backwards compatibility - later if you want to have some animation going on or do a function at the same time, it won't be possible.

I understand perfectly  :smiley: eri0o thanks  :=, the issue here is that I'm creating a P&C for my niece (6 years old) so mainly I'm bypassing stuff in order to help my niece to read more (and even pause the game). It's only for this game and I wouldn't use it in any other game. But understood complely.
Title: Re: Custom Display Text per Character | Text GUI selection during the game [SOLVED]
Post by: Snarky on Wed 07/09/2022 14:10:51
If your concern is that Character.Say() auto-advances before your niece can finish reading the text, there is a game setting you can use to ensure that it stays up until the player clicks.
Title: Re: Custom Display Text per Character | Text GUI selection during the game [SOLVED]
Post by: Nahuel on Wed 07/09/2022 14:12:41
Quote from: Snarky on Wed 07/09/2022 14:10:51
If your concern is that Character.Say() auto-advances before your niece can finish reading the text, there is a game setting you can use to ensure that it stays up until the player clicks.

Thanks Snarky, will check that now.