Author Topic: Is it possible to have two characters speak in different fonts during dialog?  (Read 241 times)

Hi everybody

I'm back with what I can only assume is another total novice question.
I've checked the manual and couldn't find anything. I checked the forums and found something from over ten years ago suggesting what I'm after is techincally not possible but that it might find it's way into a later version of A.G.S. I have the latest version so I was wondering if it is now possible to have two characters speak to each other using different fonts.

In my example, I have an interaction where the playable character is talking to a character who is talking hieroglyph style gibberish. The whole dialog takes quite a while to the deliberate and intended annoyance of the player. I have imported a dingbat/wingdings style font that I can use for the unintelligible character, however; I have only been able to change the fonts of all characters in any given room by using the Game.SpeechFont = eFontRuritaria; on the room_Load() function.

Is it using the most recent A.G.S. to have characters display speech in different fonts?

All answers and thoughts are appreciated!

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Lifetime Achievement Award Winner
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
There is still no per-character speech font setting, it is only possible if you set SpeechFont everytime before calling Say line.

Obviously, manually adding such action every time will be inefficient (and drive you mad), but this is where custom functions may come handy. For example, you may write following extension function:

Code: Adventure Game Studio
  1. void SayGibberish(this Character*, String text)
  2. {
  3.     FontType oldFont = Game.SpeechFont; // remember previous font
  4.     Game.SpeechFont = eFontRuritaria;
  5.     this.Say(text);
  6.     Game.SpeechFont = oldFont; // restore previous font
  7. }

Then use it like:
Code: Adventure Game Studio
  1. cNPC.SayGibberish("Hello, my name is Bob");

Expanding this method, you may set up personal font for each character in your game, if necessary.
« Last Edit: 18 May 2018, 14:14 by Crimson Wizard »


  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
I give a pretty thorough step-by-step explanation of how to write a custom function for exactly this purpose here:

Thanks guys

I'm still getting my head around all that "void" business but both your posts, and the explanation in that other post of Snarky's, are very comprehensive.
Thanks a million.


  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
I'm still getting my head around all that "void" business

The short version is that "void" is what you put in front of functions that don't return any results.

The long version gets complicated because AGS has two quirks that are meant to make things easier (but actually just confuse things):

Functions can return values. For example, the built-in function Random(int max) returns a random number between 0 and max. You can write your own functions, and then you should put at the start of the line what kind of value it returns: is this a function that calculates a whole number (int), that gives you back some text (String), that tells you whether something is true or false (bool), etc. If the function doesn't give any output at all, you should put void, which here means "nothing" or "not applicable". For example, a SaySomething() function doesn't really have any answer it can output: it should just do it.


Code: Adventure Game Studio
  1. // This is a function that returns an int
  2. int Max(int a, int b)
  3. {
  4.   if(a>b)
  5.     return a;
  6.   else
  7.     return b;
  8. }
  10. // This is a function that doesn't return anything, it just carries out a series of commands
  11. void TryFishing()
  12. {
  13.   player.Say("Nice day for fishing!")
  14.   player.Walk(123,58);
  15.   player.LockView(34);
  16.   player.Animate(0, 3, eOnce, eBlock, eForwards);
  17.   player.UnlockView();
  18.   player.Say("No luck today!");
  19. }

See the difference?

Now, the quirks are:

1) Instead of putting "int" in front of a function, you can just write "function". In that case, the return type is int by default.
2) If the return type of a function is int, you don't actually have to return a value at all. (If you don't, it will return 0 by default.)

This means that you can get away with not using "void" or "int" functions, you can just write "function" for both. In fact, all the standard script functions (on_mouse_click(), repeatedly_execute(), etc.) do this. However, it is better to be consistent and always put the correct return type explicitly: that way there's never any uncertainty about whether it's meant to return anything, and it helps avoid certain kinds of bugs.

Thanks Snarky!

I think it's starting to make sense.
I was wondering how repeatedly execute was operating... So to speak.

Thanks for your insight :smiley: