Game Development Community

Need hello, world" level help -- displaying text?

by Dayton Williams · in Torque Game Builder · 10/29/2006 (6:42 pm) · 1 replies

I need a way to display game statistics and also a dialog engine. Both of these are strings that I will either read from a dialog file at run-time, or directly compute at run-time.

Game statistics are things like "% chance to hit enemy".

Dialog will be short conversations / plot sequences. There will be a dialog window of sorts that pops up, I need a way to update the text in it dynamically (this will be an RPG).

Something as simple as this must be easy to do ... I just don't see it in my docs anywhere. Thanks!

#1
10/30/2006 (3:45 am)
You can do this either via your own gui implementation built using TGB objects (and addons such as the text resource) or by making use of the built in GUI functionality.

Hit F10 to access the GUI editor. A basic overview of this can be found at www.garagegames.com/docs/tge/general/ch03.php assuming it's accessable for none TGE licensees?

For displaying text you can use the guiTextCtrl, dropping it onto the "mainScreenGui" and setting its text / name so you can access it from script. Once the name is set, you can then dynamically change the text displayed, for example if you name the control "Option1Text" then in your script files you can use

Option1Text.setText("This is my line of text");

You probably also want to read up on "gui profiles" which allow you to change font type/size/colour etc

For dialogs, you can create a new gui which contains text controls/buttons/bitmaps and then push/pop this into view as you see fit. The link above demonstrates how to create a new dialog and display/hide it.

There's also a little more information on the TDN Gui section although this section is still a work in progress.

Hopefully the above has given you a rough starting point though and should make it easier for you to search the forums for additional information on a specific part.