Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Can't resolve error "It would appear that you've re-bound a GMLive function to a different scope."

A topic by KingDevyn created May 05, 2024 Views: 219 Replies: 7
Viewing posts 1 to 4

Full error message:

___________________________________________

############################################################################################

ERROR in

action number 1

of  Step Event0

for object o_control:

It would appear that you've re-bound a GMLive function to a different scope. Please use live_method() rather than method() to do so.

 at gml_Script_gml_thread_method_script (line 13413) -                             if (l_pg == undefined) show_error("It would appear that you've re-bound a GMLive function to a different scope. Please use live_method() rather than method() to do so.", true);

############################################################################################

gml_Script_gml_thread_method_script (line 13413)

gml_Object_o_control_Step_0 (line 758)

I replaced all lines of code that used method() with live_method(), except for the lines in GMLive's code. Is there anything else I need to find and replace to stop getting this error? I'm using other libraries such as Input, Scribble, and ScribbleJr, of which I replaced all lines using method(). Using the 2022+ version of GMLive and GM Runtime 2024.4.0.168 on Windows.  Let me know if any other information would help. Thanks!

Developer

I’d need a small sample project that reproduces this

You can also run the game in debug mode and see what exactly is stored inside self when it errors - when live_method is used, it should be a little struct with live:self and a few other variables.

(1 edit)

On crash, line 13397>  variable_struct_get(l_meta, "live:self") returned undefined into local variable "l_self1"
I could give you my project file, but I  wouldn't call it small.
I'm down to troubleshoot on my end more if you have any other ideas?

Developer

I can tell that live:self is undefined if it throws that error, but what is in self?

As making GameMaker extensions is not my full-time job, I have limited capacity for debugging issues in large projects - especially when many these turn out to be GameMaker bugs or self-sabotage.

Self returns the variables held in my game's controller object "o_control"

Developer

That does sound like you are re-binding it to your object somewhere. And how does the call and assignments of the variable look like?

What exactly does "re-binding" mean and how can I avoid it is probably the better question I should be asking. Not seeing anything in the manual/cheat sheet about re-binding.

I'm using the live_auto_call macro in both my control object begin step and in scripts that can be run in the begin step as well as other times from the control object. Idk if any of that helps. I'm not too sure what you mean by the "assignments of the variable" 

Developer

The method function binds a function/script to an instance or a struct.

When you have something like

// Create
live_auto_call;
myCoolFunction = function() {}

What executes is roughly equivalent to

live_auto_call;
var context = {};
context[$"live:self"] = self;
context[$"live:function"] = /* a struct with representation of updated code */;
// ... a few more fields
myCoolFunction = method(context, gml_thread_method_script);

This way gml_thread_method_script knows both which instance it should run for, and what code it should run.

If you later do

myCoolFunction = method(..., myCoolFunction);

myCoolFunction would no longer have live:self/live:function attached to it and GMLive wouldn’t know what code to run, hence the error.

Variable assignments are explained in the manual.
You are probably familiar with these if you have 758 lines of code in a Step event and are using Scribble.
Also include the line of code that’s on o_control➜Step➜Line 758.