The error message only says "Index was outside the bounds of the array." I checked the player_score script and it was already like this:
effect_spawn_textpopup(argument0,argument1, ...
I did some more investigations and found a thing in the GMS2 release notes: (this post). Seems to be broken in runtime 2.1.4.218, worked in runtime 2.1.5.246, and it works for me in runtime 2.2.0.258... what's your GMS2 runtime version?
From what I gather there's an issue where valid GML becomes invalid C++/JavaScript code sometimes when a single GML statement becomes multiple instructions when parsed, which sounds like a nightmare to track down :/
(Since 2.0.3.56 there's also an option to carry on and collect all errors that's possible before ending a compilation, it might be helpful in finding the resource that causes this to happen... perhaps?)
The issue mentioned in the GMC topic refers to an issue with for loops whose first statement isn't a variable assignment causing this error, I went through all for loops in the engine and none of them has it... only suspect thing is compatibility script __global_object_depths() having a "var i = 0" assignment, not sure if that would be a candidate with vars behaving different from ordinary variables? (The solution if this is the case would be moving the "var i" part outside the loop and then do a normal "i = 0" inside the for loop).
Geez, GMS2 still kinda feels like it's in beta sometimes :/
I'm using runtime 2.2.0.258 I tried changing "var i = 0" but I think I'm doing it wrong because I'm getting an "unexpected syntax error"
this is how it looked before I changed it:
// 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[i] );
if (objID >= 0) {
global.__objectID2Depth[ objID ] = global.__objectDepths[i];
} // end if
} // end for
and this is after trying to do what you suggested:
// create another array that has the correct entries
var len = array_length_1d(global.__objectDepths);
global.__objectID2Depth = [];
for var i( i=0; i<len; ++i ) {
var objID = asset_get_index( global.__objectNames[i] );
if (objID >= 0) {
global.__objectID2Depth[ objID ] = global.__objectDepths[i];
} // end if
} // end for
sorry for being a pain, new to GMS2 really appreciate you trying to help.
Yeah, that's an actual syntax error... the correct version would be this:
var i; for( i=0; i<len; ++i ) {
But yeah, this is weird... if we're using the exact same runtime to load the exact same file, we should get the same results. (You're using the v1.1 version of the GMS2 source, right?). Maybe it's time to contact Yoyo support about it...
There's one more thing we could try first, though... I'll try importing the GMS1 1.1 source file in the latest version of GMS2 and upload that as a GMS2 1.2 source file, and if there's any issues with the compatibility scripts that should hopefully be resolved by that.