Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.gml

Livecoding for GameMaker: Studio / GameMaker Studio 2 · By YellowAfterlife

[A mystery] Strange room behaviour / error

A topic by MathiO created Jan 31, 2021 Views: 506 Replies: 5
Viewing posts 1 to 6
(1 edit)

Hey, I recently upgraded to GMS 2 2.3, downloaded the latest version of GMLive 2.3+, and it works for the most part! However I'm getting some strange behaviour with rooms, like if I move an instance it updates it but a sort of copy image stays in its original location. Here is the error that it's throwing:

Attempting to set gamepadcount to 12
DirectX11: Using hardware device
Collision Event time(microsecs)=4
[live][1/31/2021 4:57:38 PM] Initializing...
[live][1/31/2021 4:57:38 PM] Indexing assets...
[live][1/31/2021 4:57:38 PM] Indexed OK!
Total memory used = 64761010(0x03dc2cb2) bytes
**********************************.
Entering main loop.
**********************************.
[live][1/31/2021 4:57:40 PM] Ready!
[live][1/31/2021 4:57:40 PM] Loading room0...
[live][1/31/2021 4:57:40 PM] [error] { stacktrace : [ "gml_Script_vm_group_field_on_field_set (line 14017)","gml_Script_anon_gml_thread_gml_GlobalScript_GMLive_382568_gml_thread_gml_GlobalScript_GMLive (line 12021) - var l_ar1=l_handler(l__gthis,l_act);
","gml_Script_anon_gml_program_gml_GlobalScript_GMLive_107664_gml_program_gml_GlobalScript_GMLive (line 2779) - l_th.h_exec();
","gml_Script_live_room_loader_run_cc (line 11494) - var l_ccThread=l_ccProgram.h_call_v(l_ccPath,array_create(0));
","gml_Script_live_room_loader_run_yy_inst_cc (line 11525) - if(l_rcc!=undefined&&l_rcc!="")live_room_loader_run_cc(l_rcc,l_rname+":Properties");
","gml_Script_live_room_loader_run_impl2 (line 11725) - live_room_loader_run_yy_inst_cc(live_room_loader_inst_map_gml[?l_id],l_qinst);
","gml_Script_live_room_start (line 11791) - live_room_loader_run_impl2(l_rm2);
","gml_Room_rm_Live_Create (line 1) - live_room_start()" ], script : "gml_Script_vm_group_field_on_field_set", line : 14017, message : "invalid with reference", longMessage : "FATAL ERROR in Room Creation Code for room rm_Live

invalid with reference

 at gml_Script_vm_group_field_on_field_set (line 14017) - variable_instance_set(self,l_s,l_val);
" }
 called from game:gml_std_haxe_Exception_caught:9047
 called from game:anon_gml_thread_gml_GlobalScript_GMLive_382568_gml_thread_gml_GlobalScript_GMLive:12031
 called from game:anon_gml_program_gml_GlobalScript_GMLive_107664_gml_program_gml_GlobalScript_GMLive:2779
 called from game:live_room_loader_run_cc:11494
 called from game:live_room_loader_run_yy_inst_cc:11525
 called from game:live_room_loader_run_impl2:11725
 called from game:live_room_start:11791
 called from gml_Room_rm_Live_Create:1
 called from 0
 called from inst_15DC9C3:Properties[L1,c9]


Any insight into what's happening?

Developer

I think what this “invalid with reference” error (which originates from somewhere in GameMaker runtime) means is that you are trying to implicitly or explicitly assign an instance variable to “self” instance inside a live room’s Creation Code. What is the associated Room Creation Code like?

Hm, ok that is making some gears turn.. The only room creation code I have is for the live room which is live_room_start(), but I am setting variables in each instance of  a certain object, of which there are many

Developer

Upon further testing, I cannot actually reproduce this - even though self is a strange instance (e.g. id is 0) inside Room Start, you can call variable_instance_ functions just fine on it.

If you can email me a sample project that causes the error, I can see if I can do anything about it.

Thanks so much for continuing to look into this. I seem to have narrowed it down to a specific object so I suspect it's from my end, but I will have a deeper look at it this weekend and if I can't figure it out I will email you!

(+1)

I ran into a similar error to this today, though quite a different context, nothing to do with rooms just calling functions and functions of structs. Was at first baffled what the stack trace and "invalid with reference" meant, but your above notes helped narrow it down to 'self' references.

I'm pretty sure it was that I was passing in self variables to functions, and then calling the temporary variable the same thing. So eg:

bean = 1
some_func(bean)

function some_func(bean) {
    something = 1 + bean;   
}

I removed all of the instances I'd done this and just allowed accessing self.bean inside the function. I initially set this workflow up thinking other instances would call the function, but conveniently not the case any longer. I can imagine a case where the above might be not possible and instead renaming the local variables may fix it?

Hope these thoughts help some beans!