Hi its me again so I was building the diolouge engine until I reached the part thrird part of the toturial https://www.youtube.com/watch?v=2StFT0pYrp8&theme=dark and basically I have been going nuts trying to fix this error: "############################################################################################
ERROR in action number 1
of Draw Event for object obj_diosys:
Push :: Execution Error - Variable Index [3] out of range [3] - -6.char(100027,3)
at gml_Object_obj_diosys_Draw_0 (line 47) - var _current_chw = string_width(_txt_upch) - string_width(char[c,i]);
############################################################################################
gml_Object_obj_diosys_Draw_0 (line 47)
"
also heres the entire for loop:
" for (var i = 0; i < global.page_number; i++) {
//Is gonna get the the amount of text on the text length array on (i)
text_length[i] = string_length(global.text[i]);
for (c = 0; c < text_length[i]; c++) {
var _char_pos = c+1;
//stores every charcter in the char 2D array
char[c,i] = string_char_at(global.text[i],_char_pos);
//get the current width of the line
var _txt_upch = string_copy(global.text[i],1,_char_pos);
var _current_chw = string_width(_txt_upch) - string_width(char[c,i]);
//get the last free space
if (char[c,i] == " ") { last_free_space = _char_pos+1; }
//get the line break to the line varibles
if (_current_chw - line_break_offest[i] > line_width) {
line_break_pos[line_break_num[i],i] = last_free_space;
line_break_num[i]++;
var txt_upchlast = string_copy(global.text[i],1,last_free_space);
var last_fstsp = string_char_at(global.text[i],last_free_space);
line_break_offest[i] = string_width(txt_upchlast) - string_width(last_fstsp);
}
}
//(for loop) for getting the actual x and y cordinates of the charcters of the current page
for (var cx = 0; cx < text_length[i]; cx++) {
var _char_pos = c+1;
var txt_x = tbox_x + border;
var txt_y = tbox_y + border;
//get the current width of the line
var _txt_upch = string_copy(global.text[i],1,_char_pos);
var _current_chw = string_width(_txt_upch) - string_width(char[c,i]);
var _txtline = 0;
// another(for loop) for how many line breaks has happend
for (var lb = 0; lb < line_break_num[i]; lb++) {
if (_char_pos >= line_break_pos[lb,i]) {
var str_copy = string_copy(global.text[i],line_break_pos[lb,i],_char_pos-line_break_pos[lb,i]);
_current_chw = string_width(str_copy);
//record the "line" the character should be in
_txtline = lb+1;
}
}
char_x[c,i] = txt_x + _current_chw;
char_y[c,i] = txt_y + _txtline*line_sep;
}
}"
I Have no idea why this happens everything is correct so I may sound like a big noob for asking two times but please help!