• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML var _txtb_x = textbox_x + text_x_offset[page]; giving me an error message

Krazytv

Member
Hello! I've been following this tutorial pretty closely and I've been having problems figuring out why this error is happening
https://youtu.be/6Bzj7GdSkJI

So far besides this one, there haven't been any errors

___________________________________________
############################################################################################
ERROR in
action number 1
of Draw Event
for object obj_textbox:

Variable obj_textbox.text_x_offset(100036, 0) not set before reading it.
at gml_Object_obj_textbox_Draw_0 (line 83) - var _txtb_x = textbox_x + text_x_offset[page];
############################################################################################
gml_Object_obj_textbox_Draw_0 (line 83)

I've asked around but I can never find a good fix for it/the advice given is vague at best
If anyone can help me out that's be greatly appreciated!!

bad bug.png
 

TsukaYuriko

☄️
Forum Staff
Moderator
You did not declare and assign a value to text_x_offset before the line of code in question runs. Ensure that it is declared and that a value is assigned to it before that line runs.
 

Krazytv

Member
I have a create event that assigns values to the variables- though when I assign a text_x_offset[0] = 0; in it, it only creates a blank textbox
Then again I may be placing it wrong in the event

bad bug2.png
bad bug3.png
 

Nidoking

Member
It's not the addition of the new line that's causing the text not to draw. It's something else. This might be a good time to learn to use either debug prints or the debugger itself to step through your Draw event and figure out what it's doing that it shouldn't be, or not doing that it should.
 
Top