Windows GMS2 thinks there's a problem with the code but there isn't.

So I followed a tutorial on how to make a parallax system in my game (GML), and it was going well until I tried to run my game and it wouldn't.
Here's the error:

Object: parallaxControl Event: Step at line 9 : got '[?' expected ')'

Here's the code:

var _cx = camera_get_view_x(view_camera[0]);
var _xspd = 3 * (keyboard_check(ord("D")) - keyboard_check(ord("A")));
_cx += _xspd
camera_set_view_pos(view_camera[0], _cx, 0);

var _b = ds_map_find_first(ForestOvershadow);
repeat(ds_map_size(ForestOvershadow))
{
layer_x(_b, ForestOvershadow[? _b] * _cx);
_b = ds_map_find_next(ForestOvershadow, _b);
}

Ripped straight from this tutorial https://www.yoyogames.com/blog/543/coffee-break-tutorials-parallax-scrolling but with minor changes such as A and D to move instead of arrow keys, and the name of the sprite being different. Gamemaker doesn't even display an error icon whatsoever, yet my game won't run. Any help available?
 

TsukaYuriko

☄️
Forum Staff
Moderator
For reference, what is your exact and full GMS2 version number?

Does the issue disappear if you remove this code? The error message is not guaranteed to point towards the correct line.

Is this also considered an issue when you try it in an otherwise empty project?

Does clearing the asset cache change anything about the situation?
 

samspade

Member
How are you compiling? Does the error go away if you re-write this line as: layer_x(_b, (ForestOvershadow[? _b] * _cx));? Have you run the code in the debugger to check the values used at that point?
 
For reference, what is your exact and full GMS2 version number?

Does the issue disappear if you remove this code? The error message is not guaranteed to point towards the correct line.

Is this also considered an issue when you try it in an otherwise empty project?

Does clearing the asset cache change anything about the situation?
The issue does disappear if I remove this code, yes.
Clearing asset cache does nothing, no.
As samspade said, the error does not go away if I rewrite the line like that. I also can't open the debugger because I can't run the game at all (with this code of course)
And my exact and full version number is IDE v2.3.1.536 Runtime v2.3.1.406
 

samspade

Member
The issue does disappear if I remove this code, yes.
Clearing asset cache does nothing, no.
As samspade said, the error does not go away if I rewrite the line like that. I also can't open the debugger because I can't run the game at all (with this code of course)
And my exact and full version number is IDE v2.3.1.536 Runtime v2.3.1.406
That doesn't sound right. No syntactically valid line of code would prevent you from running the game with the debugger. Even endless loops will be fine (sort of). Also, error messages can only occur if the game compiles and runs.

I think I might have misunderstood, do you mean the game doesn't compile, and that it is a compile error? If so, can you make it disappear by deleting just that line of code? Alternatively, what if you replaced that line with layer_x(_b, (ds_map_find_value(ForestOvershadow, _b) * _cx));?
 
Last edited:

Evanski

Raccoon Lord
Forum Staff
Moderator
What is ForestOvershadow?
I get that it is a ds_map but just slapping down ForstOvershadow
are your referencing it through a script? macro? global? is it a variable?
 
Top