GML [SOLVED] Problem with variable used in array. Incorrect dialog displayed.

A

Agletsio

Guest
I'm having quite a weird problem (from my perspective at least).

I'm using a variable "writing" to store a value to use in an array dail_in[writing]. But what happens now is that in the first two sentences the dialogue reads "0" and only at line 3, and onward, does it start displaying the correct dialogue.

I've looked over my code and I can't seem to find anything that could cause this problem. AMi missing something?

The variables to control the dialog are activated via a timeline.

Any help will be greatly appreciated!



Create Event
Code:
writing = 0;
iswriting = false;

//Intro
intro[0] = "August 1, 2019 "
intro[1] = "Kalahari Desert, South Africa"


//Dialogue Intro
dial_in[0] = "Sammy, what the hell is going on!?"
dial_in[1] = "****! How did they find us?"
dail_in[2] = "Who are 'they'???"
dail_in[3] = "Don't worry, Mike. I got this."


intro_1 = false;
intro_2 = false;
intro_3 = false;

timeline_index = timeline0;
timeline_running = true;
Step Event
Code:
if iswriting = true {
if keyboard_check_pressed(vk_enter) {
writing += 1;
}
}
Draw Event
Code:
if intro_1 = true {
draw_set_font(font0);
draw_set_colour(c_white);
draw_set_halign(fa_center);
draw_text(960,350,intro[0]);
}

if intro_2 = true {
draw_set_font(font0);
draw_set_colour(c_white);
draw_set_halign(fa_center);
draw_text(960,480,intro[1]);
}

if iswriting = true {
draw_set_colour(c_white);
draw_text(960,896,dail_in[writing])
}
 
Top