Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

[Fixed] Issues with functions/macros after upgrading to 2.3

A topic by SnoutUp created Sep 25, 2020 Views: 785 Replies: 5
Viewing posts 1 to 4
(1 edit)

Hey there,

So far 2.3 has been a lot of headache to me and what's worst it's breaking my favorite GM tools.  After upgrading project to 2.3, GMLive started having issues with functions from other extensions (example from Quality Structures below).

[live][2020-09-25 17:52:54] Runtime error: [error] `instance#100062(Card)` (Card) does not have a variable `qs_get`
 called from CardSetup[L15,c10]
[live][2020-09-25 17:52:54] Runtime error: [error] `instance#100005(Game)` (Game) does not have a variable `qs_list_size`
 called from GridsAlign[L20,c20]
[live][2020-09-25 17:52:54] Runtime error: [error] `instance#100005(Game)` (Game) does not have a variable `qs_map_find_value`
 called from Game:Draw_73[L212,c16]

At first it looked that maybe this issue is related to my "ugly" macros, which brought up a warning during live reloading

[live][2020-09-25 17:56:53] Warning in Game:Draw_73:
[live][2020-09-25 17:56:53] macro:view_test[L1,c91]: Expected a statement, got bin_op
#macro view_test camera_get_view_y(Camera.camera) + camera_get_view_height(Camera.camera) * 0.5

But issue persisted after I moved all similar offenders to their functions and now I'm lost. It's quite a big project and I can't seem to reproduce the same error in a freshly created one, so not sure where to even look for possible problems.

By the way, if I put in back that "ugly" macro and try to call view_test in a live function, I'd get the same error, maybe that's a hint of what can be wrong.  Other macros are fine.

[live][2020-09-25 18:01:46] Runtime error: [error] `instance#100005(Game)` (Game) does not have a variable `view_test` called from Game:Draw_73[L10,c5]

What can I do about this? 

I just got this and tried it out. When I put the gmlive line in the actual event it works, but when I put it in a script (both inside or outside the function) it doesn't reload upon save. What am I doing wrong? I'm assuming I can call it within scripts and not limited to the root event?

Developer

You should be putting it inside the function. See Troubleshooting.

It's definitely working ok with a function. I just did it with one I use to reset a score table.

I just added the: 

if (live_call()) return live_result;

directly under the function creation line.

(2 edits)

So, my issue was never about live_call() line placement, rather than about something failing to load functions from other extensions. I was able to reproduce the issue in an empty project with only extensions being GMLive and Quality Structures, so maybe latter is the culprit here. Edit: tried it with other extension (file_ini) and same error happens.

if (live_call()) return live_result;
ini = file_ini_open("test.ini");
/// results in
[live][2020-09-28 10:27:23] Runtime error: [error] `instance#100002(Test)` (Test) does not have a variable `file_ini_open`
 called from Test:Step_0[L3,c7]


Here's that test project: <snip>


Is there any way I could fix it on my own? Please, I'm addicted to live development now.

Developer (2 edits)

Adding this to GMLive's create event should work:

for (var i = 100001; script_exists(i); i++) {
    var s = script_get_name(i);
    if (gml_func_sig.h_exists(s)) continue;
    gml_func_add(":::" + s + "(...):", i);
}

this will also add a lot of usually inaccessible functions (like struct methods) but I'll see about figuring out the right way to index extension scripts later. Only extension scripts that are still in 2.2.5 style (an extension instead of a big script) are affected.