• 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!

HTML5 Getting an "error out of bounds" issue in HTML5 but not in Windows

C

Carcophan

Guest
Hello Everyone!

I have stumbled into a strange error that only seems to exist in, and crash, my Chrome/HTML5 compiles.

It is not recognized as an error during a Windows compile in F5/F6 - which seems to run just fine.

There are no errors in the debugger window for Windows - nor the HTML5 version when run in F5 and F6 mode. Errors do exist in the Chrome Developer Console though, during the crash.

I should note that I CAN get things to work just fine with other peoples code, like a tutorial example. So it is deff something that I am doing :(.

Chrome Developer Console output:
Code:
Error: Error: region out of bounds(ds_grid_set_region): 0
--------------------------------------------------------------------
    function _Sg("Error: region out of bounds(ds_grid_set_region): 0")
    function ds_grid_set_region(0, 0, 15, 26, 26, 0)
    function gml_Script([instance], [instance], 26, 26, 0, 1, 1, 1, 1, 3, 5, 5, 3)
    function gml_Object_obj_Level7_Create_0([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function _Re2(9, [unknown])
    function _h23(9)
    function _T13()
    function _y13(11004.607)

Random Map  ###game_end###-2
Random Map  Error: Error: region out of bounds(ds_grid_set_region): 0
--------------------------------------------------------------------
    function _Sg("Error: region out of bounds(ds_grid_set_region): 0")
    function ds_grid_set_region(0, 15, 0, 26, 26, 0)
    function gml_Script([instance], [instance], 26, 26, 0, 1, 1, 1, 1, 3, 5, 5, 3)
    function gml_Object_obj_Level7_Create_0([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function _Re2(9, [unknown])
    function _h23(9)
    function _T13()
    function _y13(11004.607)
The grid in question:
global.mazeWidth = 26;
global.mazeHeight = 26;
global.grid1 = ds_grid_create(global.mazeWidth , global.mazeHeight );


Is later used in:
for ( global.i = 0; global.i < global.mazeWidth ; global.i++){
for ( global.j = 0; global.j < global.mazeHeight ; global.j++){

show_debug_message(string(global.i) and string(global.j)) yields '25 and 25' instead of 26, and 26. Which is fine, because 25 really means '26' here (right??).

show_debug_message(string(ds_grid_width(global.grid1)) + " W") yields '26'
show_debug_message(string(ds_grid_height(global.grid1)) + " H") yields '26'


Am I missing a -1 or +1 somewhere? I don't get it. I do not understand the Chrome error message honestly... and am guessing that the issue is because something is a '26' when it should really be a '25'?
 
C

Carcophan

Guest
The output information is making 'less sense' to me now.

The one error line shows: ds_grid_set_region(0, 0, 15, 26, 26, 0)\

The code, though, is: ds_grid_set_region(global.grid1, 0, 0, global.mazeWidth , global.mazeHeight , 0);

I am guessing that the '15' is the grid? IF so, why is it 'third' in the error output list? Shouldn't it be something like this in the error output: ds_grid_set_region(15, 0, 0, 26, 26, 0)?
 

FrostyCat

Redemption Seeker
ds_grid_set_region() doesn't take the width and height of the region, it takes the bottom-right coordinates of the region. So you're one over the limit.
Code:
ds_grid_set_region(global.grid1, 0, 0, global.mazeWidth-1, global.mazeHeight-1, 0);
 
C

Carcophan

Guest
Thanks for the feedback.

I changed those values and the error message actually does not change. It remains as 26, 26 for some reason in the Chrome Developer.


I have also changed the 'Script' argument values to be mazeH/W -1, and the error message goes down to '25'.
global.mapVars = mapVars(global.mazeWidth, global.mazeHeight, ...);

When both that script line, and the set_region are -1, then the error is also '25'
 
Top