Skip to main content

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

Constructor inheriting shows error

A topic by IvaskiyGooD created 70 days ago Views: 141 Replies: 4
Viewing posts 1 to 4
(1 edit)

Every time I reload an object with an constructor inheritance, the console gives an error:
Expected a `{`, got colon

Because of this, I can't edit the objects where I'm making local classes without rebuilding

I searched for something similar, but I only found a problem with the constructor itself, which has been fixed. There is nothing about the constructor inheritance

Checked changelogs and saw "Fixed live constructors with : Parent() not working correctly."
I even reinstalled plugin in case I downloaded the wrong version, but I still had the same problem

Developer (1 edit)

Hello, the changelog bit is for function name() : parent() constructor {}, while yours must be name = function() : parent() constructor {}, which are different things both in base GML and GMLive.

I’ll see about it, but generally constructors are a bit of a painful topic as many things can’t be replicated in current GML - e.g. constructor methods should be method(undefined, <script>) but the bound self-value is where I’m storing the metadata so that GMLive knows what we should be executing. It’ll likely be that GMLive will pretend to understand what you wanted there but stuff like

function some() {
    live_auto_call;
    var ctr = function() : parent() constructor { }
    return new ctr();
}

will not work, only

ctr = function() : parent() constructor {
    live_name = "some constructor";
    live_auto_call;
    ...
}

Oh okay! Thanks alot for help with that

Developer

Added a tweak for this in 1.0.79 - shown bits should now work.