Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: coolhotdogguy on Thu 06/08/2020 10:36:21

Title: Unable to Change Font (compiler error)
Post by: coolhotdogguy on Thu 06/08/2020 10:36:21
First off thank you,
I have been pulling my hair out trying to figure out what I am doing wrong. I am trying to change the font in my game (I already have one imported) So I look around and learn I need to use the code

static FontType Game.NormalFont = eFontMyFont;

in the global script.

But if I try to run the game i get the "Variable 'Game' is already defined" error message on this line of code. I cannot find where Game has already been defined. I just started this project so I know that I haven't defined it at least.

Thank you again!

EDIT: Thank you everyone! What I learned I needed to do was to put my code in the game.start function. (also didn't need static FontType)
Title: Re: Unable to Change Font (compiler error)
Post by: Privateer Puddin' on Thu 06/08/2020 10:45:25
You just need this bit:

Code (ags) Select
Game.NormalFont = eFontMyFont;

https://adventuregamestudio.github.io/ags-manual/Game.html#gamenormalfont
Title: Re: Unable to Change Font (compiler error)
Post by: zeta_san on Thu 06/08/2020 10:47:21
Hello,
I try to help you
you imported the font
font menu -> right button -> new font?
Title: Re: Unable to Change Font (compiler error)
Post by: Khris on Thu 06/08/2020 12:18:02
The line at the top for each entry contains information about the data type, and whether the method/property is static or not.
The actual line looks different, and you can usually find example code near the end of the manual entry (https://www.adventuregamestudio.co.uk/manual/ags53.htm#Game.NormalFont). As is the case here:

QuoteExample:

Game.NormalFont = eFontSpecial;

will change the normal font to the font "Special".

You're supposed to put this inside the  game_start  function btw, or you'll still get errors.