SOLVED My Textbox Code (is a fixed problem just a copy and paste code now i guess.)

Hey so I had a problem with my textbox that made it loop over and over again or just not be able to be used again after it closed, if you're having problems, you can either copy and paste my code or try and figure out how you can fix yours.

Create Event:

GML:
begintext = false
draw_set_font(font0)
txt_num = 1
draw_set_color(c_white)
//this is how long the text can beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee//
txt[1] = "This is a character test."
txt[2] = "A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A"
//put txt[3] = "hello" here to add another text. you can add as many as you like, as long as you remember to change the numbers in the step event.
txt1 = ""
time = 0
exited = true
textx = view_xview[0] + view_wview[0]/35
texty = view_yview[0] + view_hview[0]/1.5
textbox = false
endtextbox = true
textboxopen = false

Step Event:

GML:
if endtextbox = false{
textboxopen = false
if begintext = true{
if keyboard_check_pressed(ord("X")){
time = time + 100000
}
else{time = time + 2}
if keyboard_check_pressed(ord("Z"))
{
    time = 0
    txt_num = txt_num + 1
    global.textbox = true
    txt1 = ""
}

if txt_num < 2{
    global.canwalk = false
    global.textbox = true
}

if txt_num > 2{
    global.canwalk = true
    global.textbox = false
    textboxopen = false
    endtextbox = true
    textbox = false
}
else{txt1 = string_copy(txt[txt_num], 0, time/3)}}
if begintext = true{
obj_player.image_index = 0
}
}

Interaction With Player Object:

GML:
if txt_num = 1 {
if keyboard_check_pressed(ord('Z')){
if textboxopen = false{
begintext = true
txt_num = 1
endtextbox = false
}}
}
if txt_num > 2{
if keyboard_check_pressed(ord('Z')){
begintext = true
endtextbox = true
txt_num = 1
}
}

Draw Event:

GML:
if endtextbox = false{
draw_set_color(c_white)
draw_rectangle(textx-20,texty-30,textx+940,texty+220,0)
draw_set_color(c_black)
draw_rectangle(textx-10,texty-20,textx+930,texty+210,0)
draw_set_color(c_white)
draw_text_ext(textx+25,texty,"*",70,900)
draw_text_ext(textx+70,texty,txt1,60,800)
}
textx = view_xview[0] + view_wview[0]/20
texty = view_yview[0] + view_hview[0]/1.45
 
Last edited:
I just made it so it only triggers the text box if its after the final line. Make sure its a keyboard_check_pressed though. This is the code that fixed it.

Interacting With Player Object

if txt_num = 1 {
if keyboard_check_pressed(ord('Z')){
if textboxopen = false{
begintext = true
txt_num = 1
endtextbox = false
}}
}
if txt_num > 2{
if keyboard_check_pressed(ord('Z')){
begintext = true
endtextbox = true
txt_num = 1
}
}
 
Top