Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.gml

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

[Fixed in 1.0.29+] 2.3 Constructors not working?

A topic by Evoleo created Aug 15, 2020 Views: 273 Replies: 5
Viewing posts 1 to 5
(1 edit)

It's weird, but apparently GMLive doesn't like constructors.

it doesn't allow to update:

[live][15.08.2020 12:33:28] Error in foo:
[live][15.08.2020 12:33:28] foo[L1,c16]: Expected a statement, got ident

And it causes some weirdness when trying to use keyword `new`:

1)

[live][15.08.2020 12:39:27] Runtime error: [error] `instance#100000(oNotMain)` (oNotMain) does not have a variable `bar`
 called from oNotMain:KeyPress_32[L8,c20]

2)

[live][15.08.2020 12:37:00] Runtime error: [error] Unable to find instance for object index 101032
 called from vm:field_on_field_set (line 13253)
 called from game:anon_gml_thread_gml_GlobalScript_GMLive_402424_gml_thread_gml_GlobalScript_GMLive (line 11433) -                     var l_ar1 = vm_v2_gml_thread_v2_handlers[l_act.__enumIndex__](l__gthis, l_act);
 called from game:anon_gml_program_gml_GlobalScript_GMLive_122919_gml_program_gml_GlobalScript_GMLive (line 2901) -             l_th.i_exec();
 called from game:live_call (line 10368) -                 var l_th = l_pg.i_call_v(l_scriptName, l_vals, false);
 called from game:oNotMain_KeyPress_32 (line 3) - if live_call()
 called from oNotMain:KeyPress_32[L20,c5]
Pause event has been registered for this frame


The first one it crashes on Line 8. Here's the code:

...
7| bar = new foo()
8| show_debug_message(bar.a)
...


The second one may be related to my specific Array() class though

And here's the code for foo():

function foo() constructor {
    // uncommenting leads to runtime error
    //live_name = "foo"
    //if live_call()
    //    return live_result
    
    a = "qq"
}

@YellowAfterLife, I sent the project on email

Developer

As was outlined in the opening post, you cannot livecode the constructor itself - only the functions within.

The last email I have from you is from 16 hours ago.

nvm, i forgot this [post] was a thing :d

the email should now be there, I forgot to actually send the link, my bad

Developer

This is now fixed in 1.0.29