• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

Windows BUG with 1D array

I created 1D array to store text, thats been used in drawing pages of book, but I keep getting error on 3rd page, why is array 2D? even tho I only created 1D and dont use second dimension anywhere.
pageTwo is page+1
I created 20 slots for 1D array
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object oEventLog:

Push :: Execution Error - Variable Index [0,3] out of range [1,2] - -1.LogInProgress(100052,3)
at gml_Object_oEventLog_Draw_64 (line 57) - draw_text_ext(bX+(18*scale),bY+(3*scale), string(LogInProgress[pageTwo]), 20, 14*scale);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oEventLog_Draw_64 (line 57)
 

FoxyOfJungle

Kazan Games
You are accessing the array index out of range, according to what is written in the error message. If you use array_lenght(), you must use array_lenght() - 1, as this function returns the number of values but skips zero. Post your code here to see how you're doing.
 
You are accessing the array index out of range, according to what is written in the error message. If you use array_lenght(), you must use array_lenght() - 1, as this function returns the number of values but skips zero. Post your code here to see how you're doing.
Im not using array length anywhere, since I dont have use for it

CREATE:
LogInProgress[0] = "You woke up at " + string(oDayCycle.hours) + " o'clock";
pagesFilled = 0;
page = 0;

var i = 1;
repeat(19)
{
LogInProgress = " ";
}

DRAWGUI:
var pageTwo = page + 1;
//draw pages
draw_text_ext(bX+(3*scale),bY+(3*scale), string(LogInProgress[page]), 20, 14*scale);
draw_text_ext(bX+(18*scale),bY+(3*scale), string(LogInProgress[pageTwo]), 20, 14*scale);
 

FoxyOfJungle

Kazan Games
You are setting the array variable LogInProgress to just one string, notice its "repeat" loop. You should do it this way:

GML:
var i = 0;
repeat(19)
{
    LogInProgress[i] = " ";
    i++;
}
But we still have little information, what do you really want to do?
 
You are setting the array variable to just one string, notice its "repeat" loop. You should do it this way:

GML:
var i = 0;
repeat(19)
{
    LogInProgress[i] = " ";
    i++;
}
But we still have little information, what do you really want to do?
Oh my god, from all that coding and banging my head, I became blind xDDDDDDDDDDDDDD
 
Top