• 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!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows Compile error: global depths

I

izark

Guest
FATAL ERROR in
action number 1
of Create Event
for object fog_system1:

Pop :: Execution Error - Variable Index [0,-1] out of range [1,0] - -5.__objectID2Depth(100006,-1)
at gml_Script___global_object_depths (line 258) - global.__objectID2Depth[ objID ] = global.__objectDepths;
} // end for
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script___global_object_depths (line 258)
called from - gml_GlobalScript_1 (line 1) - __global_object_depths()

It is always stuck on the first object from the resource tree.
It is a project imported from 1.4, however, I could run it other times, this error just appears now for no reason.
The window: Made with gamemaker appears, then the error pops up. What can it be? There are not many objects in the game right now, most of them are unused. if I delete imported objects from GM 1.4 will this error be fixed? It has something to do with imported depths of objects from GM 1.4.

Thanks.

This is where the stuck is, at the end of all:

// Initialise the global array that allows the lookup of the depth of a given object
// GM2.0 does not have a depth on objects so on import from 1.x a global array is created
// NOTE: MacroExpansion is used to insert the array initialisation at import time
gml_pragma( "global", "__global_object_depths()");

// insert the generated arrays here
global.__objectDepths[0] = -2; // c_padre
global.__objectDepths[1] = -2; // c_base_start
global.__objectDepths[2] = -2; // c_grid
global.__objectDepths[3] = 1; // puzzle_back
global.__objectDepths[4] = 0; // tiles_bosque
global.__objectDepths[5] = -5000; // objOverlay
global.__objectDepths[6] = 0; // screen_shot
global.__objectDepths[7] = -2; // c_base
global.__objectDepths[8] = -3; // o_victory
global.__objectDepths[9] = -2000; // black_screen_2
global.__objectDepths[10] = -30; // destello2
global.__objectDepths[11] = 0; // test
global.__objectDepths[12] = -2; // o_boton2
global.__objectDepths[13] = -30; // destello_fallo
global.__objectDepths[14] = -30; // destello
global.__objectDepths[15] = 0; // inter
global.__objectDepths[16] = -2000; // black_screen
global.__objectDepths[17] = -2; // barra
global.__objectDepths[18] = -2; // object68
global.__objectDepths[19] = -2; // object66
global.__objectDepths[20] = -2; // o_boton
global.__objectDepths[21] = 0; // bloque
global.__objectDepths[22] = 10000000; // distorsion
global.__objectDepths[23] = 10000001; // catarata
global.__objectDepths[24] = 10; // object13
global.__objectDepths[25] = 1410065417; // object33
global.__objectDepths[26] = 1000; // object28
global.__objectDepths[27] = 100000010; // catarata2
global.__objectDepths[28] = 0; // oPlayer
global.__objectDepths[29] = 0; // object72
global.__objectDepths[30] = 0; // object29
global.__objectDepths[31] = 0; // object119
global.__objectDepths[32] = 0; // object71
global.__objectDepths[33] = 10; // object27
global.__objectDepths[34] = -2; // object5
global.__objectDepths[35] = 10; // object31
global.__objectDepths[36] = -2; // puzzle4_0
global.__objectDepths[37] = -4; // object65
global.__objectDepths[38] = 1; // puerta
global.__objectDepths[39] = 0; // uzzle4
global.__objectDepths[40] = 0; // object125
global.__objectDepths[41] = -2; // puzzle21_2
global.__objectDepths[42] = 0; // uzzle5
global.__objectDepths[43] = -2; // puzzle3_0
global.__objectDepths[44] = 0; // uzzle2
global.__objectDepths[45] = 0; // tele
global.__objectDepths[46] = 0; // object18
global.__objectDepths[47] = -3; // puzzle2_1
global.__objectDepths[48] = 0; // object15
global.__objectDepths[49] = 0; // track2
global.__objectDepths[50] = 0; // puzzle_padre
global.__objectDepths[51] = 0; // uzzle7
global.__objectDepths[52] = 0; // track
global.__objectDepths[53] = -2; // puzzle8_0
global.__objectDepths[54] = 0; // puzzle_hijos_padre
global.__objectDepths[55] = -2; // puzzle6_0
global.__objectDepths[56] = -3; // object57
global.__objectDepths[57] = 1; // object32
global.__objectDepths[58] = 0; // uzzle3
global.__objectDepths[59] = 0; // uzzle8
global.__objectDepths[60] = 0; // uzzle6
global.__objectDepths[61] = -4; // object54
global.__objectDepths[62] = -4; // object67
global.__objectDepths[63] = -2; // object51
global.__objectDepths[64] = -3; // object55
global.__objectDepths[65] = -3; // puzzle8_1
global.__objectDepths[66] = -3; // o_error
global.__objectDepths[67] = -10; // object20
global.__objectDepths[68] = 0; // object17
global.__objectDepths[69] = 0; // uzzle9
global.__objectDepths[70] = 0; // catara
global.__objectDepths[71] = 1410065417; // object26
global.__objectDepths[72] = -10; // puzzle11_2
global.__objectDepths[73] = -1; // object108
global.__objectDepths[74] = -1; // object94
global.__objectDepths[75] = 0; // uzzle11
global.__objectDepths[76] = 0; // uzzle13
global.__objectDepths[77] = -1; // object93
global.__objectDepths[78] = -3; // object58
global.__objectDepths[79] = -1; // object102
global.__objectDepths[80] = -1; // object95
global.__objectDepths[81] = -1; // object112
global.__objectDepths[82] = -1; // object103
global.__objectDepths[83] = -1; // object98
global.__objectDepths[84] = -1; // object100
global.__objectDepths[85] = -1; // object109
global.__objectDepths[86] = -1; // object110
global.__objectDepths[87] = -2; // puzzle_10_1
global.__objectDepths[88] = -4; // object69
global.__objectDepths[89] = -1; // object111
global.__objectDepths[90] = -1; // object105
global.__objectDepths[91] = -2; // object114
global.__objectDepths[92] = -1; // object97
global.__objectDepths[93] = 0; // uzzle12
global.__objectDepths[94] = -2; // object117
global.__objectDepths[95] = -3; // object123
global.__objectDepths[96] = 0; // uzzle14
global.__objectDepths[97] = 0; // object116
global.__objectDepths[98] = -3; // object120
global.__objectDepths[99] = 0; // object126
global.__objectDepths[100] = -2; // object113
global.__objectDepths[101] = -3; // object121
global.__objectDepths[102] = 0; // object128
global.__objectDepths[103] = -3; // object122
global.__objectDepths[104] = -3; // object124
global.__objectDepths[105] = -2; // object115
global.__objectDepths[106] = -2; // object77
global.__objectDepths[107] = 0; // uzzle15
global.__objectDepths[108] = -3; // object137
global.__objectDepths[109] = 0; // object130
global.__objectDepths[110] = 0; // object127
global.__objectDepths[111] = -1; // object76
global.__objectDepths[112] = -1; // object107
global.__objectDepths[113] = -3; // object136
global.__objectDepths[114] = 0; // object129
global.__objectDepths[115] = 0; // object131
global.__objectDepths[116] = -3; // object132
global.__objectDepths[117] = -3; // object135
global.__objectDepths[118] = -3; // object134
global.__objectDepths[119] = -3; // object138
global.__objectDepths[120] = -10; // puzzle15_1


global.__objectNames[0] = "c_padre";
global.__objectNames[1] = "c_base_start";
global.__objectNames[2] = "c_grid";
global.__objectNames[3] = "puzzle_back";
global.__objectNames[4] = "tiles_bosque";
global.__objectNames[5] = "objOverlay";
global.__objectNames[6] = "screen_shot";
global.__objectNames[7] = "c_base";
global.__objectNames[8] = "o_victory";
global.__objectNames[9] = "black_screen_2";
global.__objectNames[10] = "destello2";
global.__objectNames[11] = "test";
global.__objectNames[12] = "o_boton2";
global.__objectNames[13] = "destello_fallo";
global.__objectNames[14] = "destello";
global.__objectNames[15] = "inter";
global.__objectNames[16] = "black_screen";
global.__objectNames[17] = "barra";
global.__objectNames[18] = "object68";
global.__objectNames[19] = "object66";
global.__objectNames[20] = "o_boton";
global.__objectNames[21] = "bloque";
global.__objectNames[22] = "distorsion";
global.__objectNames[23] = "catarata";
global.__objectNames[24] = "object13";
global.__objectNames[25] = "object33";
global.__objectNames[26] = "object28";
global.__objectNames[27] = "catarata2";
global.__objectNames[28] = "oPlayer";
global.__objectNames[29] = "object72";
global.__objectNames[30] = "object29";
global.__objectNames[31] = "object119";
global.__objectNames[32] = "object71";
global.__objectNames[33] = "object27";
global.__objectNames[34] = "object5";
global.__objectNames[35] = "object31";
global.__objectNames[36] = "puzzle4_0";
global.__objectNames[37] = "object65";
global.__objectNames[38] = "puerta";
global.__objectNames[39] = "uzzle4";
global.__objectNames[40] = "object125";
global.__objectNames[41] = "puzzle21_2";
global.__objectNames[42] = "uzzle5";
global.__objectNames[43] = "puzzle3_0";
global.__objectNames[44] = "uzzle2";
global.__objectNames[45] = "tele";
global.__objectNames[46] = "object18";
global.__objectNames[47] = "puzzle2_1";
global.__objectNames[48] = "object15";
global.__objectNames[49] = "track2";
global.__objectNames[50] = "puzzle_padre";
global.__objectNames[51] = "uzzle7";
global.__objectNames[52] = "track";
global.__objectNames[53] = "puzzle8_0";
global.__objectNames[54] = "puzzle_hijos_padre";
global.__objectNames[55] = "puzzle6_0";
global.__objectNames[56] = "object57";
global.__objectNames[57] = "object32";
global.__objectNames[58] = "uzzle3";
global.__objectNames[59] = "uzzle8";
global.__objectNames[60] = "uzzle6";
global.__objectNames[61] = "object54";
global.__objectNames[62] = "object67";
global.__objectNames[63] = "object51";
global.__objectNames[64] = "object55";
global.__objectNames[65] = "puzzle8_1";
global.__objectNames[66] = "o_error";
global.__objectNames[67] = "object20";
global.__objectNames[68] = "object17";
global.__objectNames[69] = "uzzle9";
global.__objectNames[70] = "catara";
global.__objectNames[71] = "object26";
global.__objectNames[72] = "puzzle11_2";
global.__objectNames[73] = "object108";
global.__objectNames[74] = "object94";
global.__objectNames[75] = "uzzle11";
global.__objectNames[76] = "uzzle13";
global.__objectNames[77] = "object93";
global.__objectNames[78] = "object58";
global.__objectNames[79] = "object102";
global.__objectNames[80] = "object95";
global.__objectNames[81] = "object112";
global.__objectNames[82] = "object103";
global.__objectNames[83] = "object98";
global.__objectNames[84] = "object100";
global.__objectNames[85] = "object109";
global.__objectNames[86] = "object110";
global.__objectNames[87] = "puzzle_10_1";
global.__objectNames[88] = "object69";
global.__objectNames[89] = "object111";
global.__objectNames[90] = "object105";
global.__objectNames[91] = "object114";
global.__objectNames[92] = "object97";
global.__objectNames[93] = "uzzle12";
global.__objectNames[94] = "object117";
global.__objectNames[95] = "object123";
global.__objectNames[96] = "uzzle14";
global.__objectNames[97] = "object116";
global.__objectNames[98] = "object120";
global.__objectNames[99] = "object126";
global.__objectNames[100] = "object113";
global.__objectNames[101] = "object121";
global.__objectNames[102] = "object128";
global.__objectNames[103] = "object122";
global.__objectNames[104] = "object124";
global.__objectNames[105] = "object115";
global.__objectNames[106] = "object77";
global.__objectNames[107] = "uzzle15";
global.__objectNames[108] = "object137";
global.__objectNames[109] = "object130";
global.__objectNames[110] = "object127";
global.__objectNames[111] = "object76";
global.__objectNames[112] = "object107";
global.__objectNames[113] = "object136";
global.__objectNames[114] = "object129";
global.__objectNames[115] = "object131";
global.__objectNames[116] = "object132";
global.__objectNames[117] = "object135";
global.__objectNames[118] = "object134";
global.__objectNames[119] = "object138";
global.__objectNames[120] = "puzzle15_1";


// create another array that has the correct entries
var len = array_length_1d(global.__objectDepths);
global.__objectID2Depth = [];
for( var i=0; i<len; ++i ) {
var objID = asset_get_index( global.__objectNames );
global.__objectID2Depth[ objID ] = global.__objectDepths; <----- HERE
} // end for
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
HI there!

It is a project imported from 1.4, however, I could run it other times, this error just appears now for no reason.
So, you've imported it previously and it worked, or you've imported it AND edited it and it was working? If you've edited it then it could be that somewhere you've mucked up the way the compatibility scripts work... in which case you should look at a previous saved versions of the project and compare them with the current versions and try and undo the edit that caused this.

However, if this has started happening on a clean import of a 1.4 project you should file a bug report. You will need to supply a download link to the GMZ file being imported and include it in the report (you can request that the report be flagged as private so the project is not shared publicly).

PS: If it's an edited project you can still file a bug if you are sure that it is not related to something you have changed and rather it is related to the latest IDE or Runtime update.
 
I

izark

Guest
I have imported it from 1.4, edited it and worked. After more editing I started getting this error. However it seems to work again after:
- I deleted that whole compatibility script about depths.
- I deleted many objects from 1.4 that were unused since this is kind of a fresh project, however I didn´t delete them all so I guess this had no effect. But the little objects that are left I can recreate them in the new Gamemaker, they are not that many.
- I ran the game. It worked.
- It crashed after I called the old function 'Instance_create'
- I changed all 'instance_create' calls for 'instance_create_at_depth'
- It works now with no problem, but I don´t know when it will fail again. I guess things that have something to do with depths should be replaced to be adapted to the new layer system. For now, only 'instance_create' was in my project
 
Last edited by a moderator:

gnysek

Member
If you add a new object, you need to add it to "global.__objectDepths" and "global.__objectNames" table, or cannot use instace_create() function for it (as it's not built-in function, but a compatibility script).

Instance_Create() is removed from GMS2, as it have layers instead of depths, so instance_create_layer() is a proper function. You can use instance_create_depth() also, but when you add new layers to your room, you cannot be sure the depth you given will be good, as layer depths will be reordered. They can be changed to manually set, but still - there is a big field for errors.

I have a big project converted from GM 1.4 (which is in fact converted from GM8 too), and it still works after 4 months with GMS2, being aware of what compatibility scripts do.


PS: for future, can you "cut" unneded data from you error log (as we already see it's a table, so middle of it can be replaced with ...) or wrap it into [ code ] tags ?
 
I

izark

Guest
If you add a new object, you need to add it to "global.__objectDepths" and "global.__objectNames" table, or cannot use instace_create() function for it (as it's not built-in function, but a compatibility script).

Instance_Create() is removed from GMS2, as it have layers instead of depths, so instance_create_layer() is a proper function. You can use instance_create_depth() also, but when you add new layers to your room, you cannot be sure the depth you given will be good, as layer depths will be reordered. They can be changed to manually set, but still - there is a big field for errors.

I have a big project converted from GM 1.4 (which is in fact converted from GM8 too), and it still works after 4 months with GMS2, being aware of what compatibility scripts do.


PS: for future, can you "cut" unneded data from you error log (as we already see it's a table, so middle of it can be replaced with ...) or wrap it into [ code ] tags ?
Ok, it is much clearer now, thanks.
PS: Won´t happen again :)
 
Top