Creating ds_map on android freezes the game?

N

NoFontNL

Guest
In my room creation code I have this line:
Code:
global.levelMap=ds_map_create();
Then in par_couele I have this code:
Code:
/// Add to map if not exists in map
if(room==rm_editor&&global.mode=="edit" && !ds_map_exists(global.levelMap,string(id))){
    var instancePlace=instance_place_list(x,y,par_couele);
    var ok = true;
    if(instancePlace!=noone){
        for(var i =0; i<ds_list_size(instancePlace); i++){
            if(ds_list_find_value(instancePlace,i).transparent) {
                continue;
            }
            if(collision_point(ds_list_find_value(instancePlace,i).x,ds_list_find_value(instancePlace,i).y,obGroundSpecial,-1,1)){
                continue;
            }
            ok=false;
            break;
        }
    }
    if(ok){
        var map = ds_map_create();
        ds_map_add(map,"o",object_get_name(object_index)); 
        ds_map_add(map,"x",x);
        ds_map_add(map,"y",y);
        if(object_index==obj_itemblockEditor||object_index==obBrick){
            ds_map_add(map,"i",object_get_name(item));
        }
        if(object_index==obSlope){
            ds_map_add(map,"iin",image_index);
        }
        ds_map_add_map(global.levelMap,string(id),map);
        //ds_map_destroy(map);
    }
}
Now, on windows it works, no frreezing.
But on android the game freezes.

Thanks in advance for your help!
 
N

NoFontNL

Guest
What do you mean by that? Is that related to the problem?
 

samspade

Member
I don't see any obvious errors, but I might have missed one.

What makes you think it is this portion of code?
 
N

NoFontNL

Guest
I don't see any obvious errors, but I might have missed one.

What makes you think it is this portion of code?
Because when I remove both pieces of code (shown above), the game functions properly, but I can't save levels then.
The second part shown above only works when there is a ds_map called levelMap, so I had to cut that out too.
 

FrostyCat

Redemption Seeker
There is now a built-in function called instance_place_list(), which isn't exactly compatible with a widely circulated script often known by the same name. Rename that script to something else and change the calls in your code.

Also, try stepping through this particular piece using the debugger and see which exact line the crash comes from. The output window may also contain useful hints.
 
N

NoFontNL

Guest
There is now a built-in function called instance_place_list(), which isn't exactly compatible with a widely circulated script often known by the same name. Rename that script to something else and change the calls in your code.

Also, try stepping through this particular piece using the debugger and see which exact line the crash comes from. The output window may also contain useful hints.
I can't use the debugger, since it works on windows, but it only doesn't work on android.
Further I do not know any built in function called instance place list in GMS1.4.
Please correct me if I'm wrong.
 
N

NoFontNL

Guest
So, it only happens when I export the game to apk, then the game freezes. However, when I play it (as yoyo runner), then the game doesn't freeze.
So when it freezes it logs this in the cmd window that sort of debugs:
Code:
03-06 19:44:21.441 14699 14699 I yoyo    : onPause
03-06 19:44:21.471 14699 14699 I yoyo    : Pausing the Runner
03-06 19:44:24.021 14699 14722 I yoyo    : ShowMessage("
03-06 19:44:24.021 14699 14722 I yoyo    : ___________________________________________
03-06 19:44:24.021 14699 14722 I yoyo    : ############################################################################################
03-06 19:44:24.021 14699 14722 I yoyo    : ERROR in
03-06 19:44:24.021 14699 14722 I yoyo    : action number 1
03-06 19:44:24.021 14699 14722 I yoyo    : of Alarm Event for alarm 0
03-06 19:44:24.021 14699 14722 I yoyo    : for object obj_fade:
03-06 19:44:24.021 14699 14722 I yoyo    :
03-06 19:44:24.021 14699 14722 I yoyo    : Data structure with index does not exist.
03-06 19:44:24.021 14699 14722 I yoyo    : at gml_Script_scOpenLevelEdit
03-06 19:44:24.021 14699 14722 I yoyo    : ############################################################################################
03-06 19:44:24.021 14699 14722 I yoyo    : --------------------------------------------------------------------------------------------
03-06 19:44:24.021 14699 14722 I yoyo    : stack frame is
03-06 19:44:24.021 14699 14722 I yoyo    : gml_Script_scOpenLevelEdit (line -1)
03-06 19:44:24.021 14699 14722 I yoyo    : gml_Object_obj_fade_Alarm_0
03-06 19:44:24.021 14699 14722 I yoyo    : ")
03-06 19:44:32.481 15739 15739 I AndroidRuntime: VM exiting with result code 0, cleanup skipped.
03-06 19:44:42.611 16611 16611 D MoPub   : Call initWithSaveGDPRState
03-06 19:44:43.451 16611 16611 D MoPub   : Initializing MoPub with ad unit: 9f5e17e042c7x3f4f5d46d94d2da0eeb
03-06 19:44:43.521 16611 16705 D MoPub   : MoPubIdentifier initialized.
03-06 19:44:44.271 16611 16611 D MoPub   : Successfully hit tracking endpoint: https://ads.mopub.com/m/open
03-06 19:44:44.301 16611 16611 D MoPub   : Consent status is already EXPLICIT_YES. Not doing a state transition.
03-06 19:45:00.731 17372 17372 D MoPub   : Call initWithSaveGDPRState
I fixed it, BUT I still hope someone will clear this up for me.
I checked in scLevelOpenEdit if the ds_map existed with
Code:
if(!ds_exists(lvlMap,ds_type_map)) continue;
But someone please tell me why there are no errors/freezing on windows, but why does it on android only when exported? (Not when just testing it with the yoyorunner)
 
Top