• 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 Debugger issue

quattj

Member
I'm trying to debug my program. At a specific point, I keep getting this error, but ONLY when running the debugger, which is making it incredibly difficult to... debug.

GML:
___________________________________________
############################################################################################
ERROR in
action number 1
of Create Event
for object ctrl_main:

Variable Index [-1] out of range [129]
 at gml_Script_import_names_XG (line 163) -                                                  global.percussion_names_XG_SFX[set_num, 128] = new_name;
############################################################################################
gml_Script_import_names_XG (line 163)
gml_Script_init_instrument_names (line 23) -        import_names_XG();
gml_Object_ctrl_main_Create_0 (line 57) - init_instrument_names();
global.percussion_names_XG_SFX[128, 128] is a 2D array that has been previously initialized using a nested for loop. Each cell contains a null string "".
set_num = 0 when I get the error.
new_name = SG SFX 1 when I get the error (it is a string)

If I am not in the debugger, or I do not step through this section, the name SG SFX 1 gets assigned to cell [0, 128] with no issue.

What gives?
 
Put a breakpoint somewhere it makes sense before that line, and use step-by-step debugging to track down what's really going on.
Still not convinced the bug is related to debug mode, honestly. The other way around could make sense with a YYC export, but debug runs with VM, so there shouldn't be MORE bugs than VM play mode or YYC. Who knows, it's maybe a legit bug, but it's still much too soon to assume.
If step-by-step debug doesn't give you any results, we gonna need more code to help.
 

quattj

Member
My breakpoint is maybe 20-30 lines before this line in the same script. The error only happens when I get to that line. If I F10 step to that line, error. If I F10 step to just before that line, then F5, no error. If I step and get the error, it stops the game because of the error. If I F5 over it, the game runs and the values are filled as expected. Makes no sense.

I've previously submitted a debugger bug where importing a specific file into a buffer would immediately nullify all debugging, and it was confirmed by YoYo staff. It seems that since v2.3, there have been more issues with debugging than in the past (or at least, I've run in to issues way more frequently).
 

quattj

Member
Stepping from line 139, and not pushing F10 on line 163. If I push F10, error. If I push F5, no error. The only items referenced in that line are highlighted in the watch window.

debug_error.jpg
 

quattj

Member
Also interesting to note is that the global.percussion_names_XG_SFX[] is defined and inititalized in a script, and none of the 2D arrays defined this way show up in the auto-complete list when typing a variable name, which I have also submitted as a bug. I'm curious if that might be what is causing the problem with this (but it could just be a red herring).
 
Top