GMS 2.3+ Issues with DS Map and window resizing

Alyxx

Member
After a recent update, Game Maker Studio has given me errors I never received before, and acting strangely.

Now when I exit out of fullscreen mode and run my script for resizing the window, it gets stuck in some kind of loop of resizing the window, causing it to get really big and constantly flash.

My script for resizing the window:

GML:
function scr_ScreenMode() {
    if (global.display_mode = 0)
        {
        window_set_fullscreen(false);
        if global.dos_aspect_ratio = 0
            {
            window_set_size(320,200);
            surface_resize(application_surface,320,200); 
            }
        if global.dos_aspect_ratio = 1
            {
            window_set_size(320,240);
            surface_resize(application_surface,320,240);
            }
        }
    if (global.display_mode = 1)
        {
        window_set_fullscreen(false);
        if global.dos_aspect_ratio = 0
            {
            window_set_size(640,400);         
            surface_resize(application_surface,640,400);
            }
        if global.dos_aspect_ratio = 1
            {
            window_set_size(640,480);
            surface_resize(application_surface,640,480);         
            } 
        }
    if (global.display_mode = 2)
        {
        window_set_fullscreen(false);
        if global.dos_aspect_ratio = 0
            {
            window_set_size(1280,800);
            surface_resize(application_surface,1280,800);         
            }
        if global.dos_aspect_ratio = 1
            {
            window_set_size(1280,960);
            surface_resize(application_surface,1280,960);
            } 
        }
    if (global.display_mode = 3)
        {
        if global.dos_aspect_ratio = 0
            {
            window_set_fullscreen(true);
            surface_resize(application_surface,1280,800);
            gpu_set_tex_filter(true);
            }
        if global.dos_aspect_ratio = 1
            {
            window_set_fullscreen(true);
            surface_resize(application_surface,1280,960);
            gpu_set_tex_filter(true);
            }
        } 
    }
Also, it keeps giving me errors when I try to load my game and run a DS Map check for my objects since I'm storing their state in the save file. The specific error for pretty much every object is:

ds_map_find_value argument 1 incorrect type (undefined) expecting a Number (YYGI32)

I have the following code in the creation event of each object that I want to change the state of:

GML:
key = scr_GameStateGetKey();
var _game_state = ds_map_find_value(ctrl_GameState.game_state,key);
if(!is_undefined(_game_state) && _game_state==false)
    instance_destroy();
else
;
ctrl_GameState Create event:
GML:
/// @description Create DS Map
game_state = ds_map_create();
The scr_GameStateGetKey script:

GML:
function scr_GameStateGetKey() {
    return room_get_name(room)+object_get_name(object_index)+string(x)+string(y);
}
I have no idea why this isn't working as it used to work perfectly before the update...
 
Last edited:

Alyxx

Member
I read the patch notes and came across this:

There are a few functions which previously returned 0 to indicate a success even when the manual says they didn't return anything. These have now all been changed to return "undefined", as 0 was causing issues where some users had code incorrectly checking the return of these functions and then trying to perfom an action, so they were usually accidentally calling the function at index 0 - which is typically camera stuff. If you suddenly find your game is now erroring due to trying to run an "undefined" function, see if this change applies to your code and refactor accordingly.
I guess I will have to try and refactor my code to make it work.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
I read the patch notes and came across this:



I guess I will have to try and refactor my code to make it work.
I have just pushed a beta release for my external code editor that makes the linter warn about attempts of using return values from built-in functions that allegedly don't have any:
1607303174857.png
This might help with figuring out problematic spots in code.

Looking where you are re-assigning your game_state variable might also prove useful (in GMEdit, can right-click the variable and pick "find references"; in base GMS2 just Ctrl+Shift+F the name)
 
Hey! Did you find a fix? I have the exact same problem. Similar coding and same bug. I've tried everything to be honest. I really don't know why this is happening.

I'm not sure if 2.3.1 is stable enough to keep using it. Have been having random bug like this which I can't solve. Really annoying. Please keep updating this post if you find a solution! Many thanks!
 
Hey mate. Found the issue. Seems like 2.3 + update make the window_set_fullscreen() function have a delay compared to the previous version. So my guess is when toggling full screen off and doing the code for resizing the window size directly after, there's a conflict in the code between those two.

My fix was to use a alarm after toggling the window_set_fullscreen(false) for the window resizing. Seems to have been working well and my INI save files for the fullscreen setting work well also if the saving is put in the alarm.
I really don't know why this was changed. Yoyo seems to know the issue has it's been reported but why?
 
Top