How to show values of variables in realtime (SOLVED)

Started by PERXEO, Wed 26/04/2023 20:06:55

Previous topic - Next topic

PERXEO

I am trying to modify a dialog window to show the options with custom designs, but I have a question about how to show the value of variables in real time in "runtime", with a function such as "trace" or "console.log" or something similar, but I don't know how to do it...
The situation is that in a customScript I read
All of the Custom Dialog functions run on the non-blocking thread. That means that you should not make any blocking calls, such as Character.Say, Wait or Display within them, as they may not behave correctly

and I don't know any other way to display values on the screen apart from display and player.Say
Thanks!!

Crimson Wizard

#1
I'm sorry, but have you tried reading the manual?
https://adventuregamestudio.github.io/ags-manual/Scripting.html
As Khris suggested in the previous thread:
Quote from: Khris on Mon 24/04/2023 12:23:56You should really read it from top to bottom at least once.
At least read the list of possible script commands: that will give you an idea of what AGS provides.
Testing out every basic feature will also help in the future, at least you will know what you may use.

Searching on forums may also help. 90% of questions are asked over again all the time. Sometimes even randomly reading the topic titles, like 5-6 forum pages back, may give you a hint.



Answering the question though, methods of displaying the text in non-blocking way are:

1. Since you are working with custom options, you may draw your variable values right there on the surface even. The way to print values is String.Format - it converts a sequence of text, ints and floats into a single string.
2. GUI Labels.
3. Textual Overlays.
4. Character.SayBackground - is a non-blocking speech, using textual Overlays internally.
5. Actually, graphical Overlays too, where you may assign your own DynamicSprite with anything drawn on it, and display on screen.
6. Drawing right on the room background (dirty, but may be useful sometimes). See Room.GetDrawingSurfaceForBackground.
7. Writing to a file (see "File" in the manual)
8. Writing to the engine log with System.Log. You will have to enable log when running your game, this is done either by editing a config file or passing a parameter from command line, as explained here:
https://adventuregamestudio.github.io/ags-manual/EngineConfigFile.html
https://adventuregamestudio.github.io/ags-manual/RuntimeEngine.html#command-line
unfortunately there's currently no way to display this log in the editor at runtime, but you may open the file with a good text editor and set "auto reload" mode (I know that some text editors support this).

PERXEO

I'm sorry for the question, but I thought there was some kind of log or something similar that could show the value of the variables. The truth is that I have not only read the manual, but I have also translated it into Spanish... what happens is that sometimes, what we need is not usually in the form we expect it to be and even if we have it in front of our eyes we do not see. Nevertheless, thanks for the answer!

Crimson Wizard

#3
Quote from: PERXEO on Wed 26/04/2023 20:40:42I'm sorry for the question, but I thought there was some kind of log or something similar that could show the value of the variables.

Unfortunately AGS does not support displaying variable values in a way that other game engines may do (like for example, a table of variables or objects existing at runtime). It's a general problem with it, as it currently does not store variable information withing a game, such as variable names for instance, only raw data.

The only way to display a variable's value is to command to print it explicitly in script, using standard text displaying or printing methods mentioned above.

There's a log (System.Log), as noted above, it displays all kinds of things, but you may configure it to display only your prints too, if necessary.
Or you may write your own file the way you prefer.

Commonly people use a GUI with a set of labels, or a ListBox though, for diagnosing things at runtime.


SMF spam blocked by CleanTalk