1
global variable name 'game_width' index (100009) not set before reading it.
at gml_Object_objTextbox_Create_0 (line 16) port_x = (global.game_width  
- box_width - port_width) * 0.5

The error Picture

I created in Game global.game_height and width, but it doesn't work. What am I supposed to do?

The error picture 2

karel
  • 5,489
  • 46
  • 45
  • 50
  • Looks like `objtextbox` is created earlier than the `game` object, that way it cannot find the `global.game_width` before it's initialised. Not sure how that's possible to change though, as you're running it already later than the `game` object. – Steven Apr 23 '19 at 06:35
  • 1
    Thanks a lot now I know what I have wrong and rewrote it and it works – Michelle Moonknight Apr 24 '19 at 15:10
  • Looks like I've understanded the problem now, and decided to make my comment an answer. :) – Steven Apr 25 '19 at 06:27

1 Answers1

1

Looks like the objtextbox object is created earlier than the game object.
And because the game object creates the variable, it cannot find the global.game_width before it's initialised.

Inside the Text Layer Properties on the left sidebar, you'll see all the objects that are loading inside the room. The game object is not shown there, so you've to place the game object inside the room (and change the order they're loaded first) to let it work.

I'm not sure if this still applies as you've already rewrote your code, but that's something to remember for the next time.

Steven
  • 1,996
  • 3
  • 22
  • 33