Test Output Problem

Hi! I want to output a test from an array to a text field using JavaScript. The problem is that my output does not work correctly, only numbers are output before the beginning of the text (if you write the line “12 test 1” in the code, the result will be “12”). I tried to implement this through scene variables. I started learning JavaScript quite recently. How to correctly output from the code to the text field? Is there any way to directly access the object with the text.
My code: image

Hi!
I suppose you will find the answer in the documentation: JavaScript Code events [GDevelop wiki]

I did according to this documentation. But this did not lead to any result. The problem remains the same.

You can print the value of your variable to the console:

console.log(output1);
console.log(wind);

As a result, you will check what is written in the variables, there may be an error in the reference to the scene variable.

Update:
The result is displayed in the developer’s console, when starting the game, press Ctrl + Shift + i to open it.

Outputs this message:image
What can it mean?

You need to run in debug mode: Game Debugger and Profiler [GDevelop wiki]

If I understand correctly, Electron (the technology on which the assembly for desktop operating systems is based) allows you to run a project in two modes:

  • release - in this mode, the engine tries to optimize the written code for execution. The code (variable) you have written is most likely not used in the game logic (the variable is not involved in the conditions and actions) and the engine analyzed it and “excluded” this code from execution. To still execute this code, run it in debug mode.
  • debug - in this mode, it executes all the written code. Then your code will be executed and you will see the output to the console.

This is a common optimization problem in engines, compilers, and development environments.

Here is the result of my running your code:
image

image

Thanks for the help) I found my mistake from your picture. I did not correctly implement the value output. Earlier I output using “toString(Variable(test))”. Now everything is working as it should)

1 Like