Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.gml

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

[Fixed] GMLive interprets macro as a variable?

A topic by jmdeejay created Feb 06, 2018 Views: 569 Replies: 4
Viewing posts 1 to 5
(1 edit)

Hi!

I just bought GMLive (amazing & having lots of fun with it, btw) and got this error.
[live][9:26:59 PM] Runtime error: obj_MainLevelController:Draw:0[L18,c35] `100557` (obj_MainLevelController) does not have a variable `G`

I use this trick everywhere in my project which is:
I create a macro called G and assign global as the value.
So when I want to create/access a global variable, I just have to type G.myVariable.
It seems like GMLive interprets G as a variable instead of recognizing it as a macro. 
I'm using Game Maker 1.4, btw.

Thank you for your time.

Ohno!
Just saw the section "Unusual expressions in macros" of the documentation... :/

Developer (2 edits)

As per limitations section, GMLive treats macros as expressions instead of tokens.

In current versions of GameMaker, "global" is no longer a "value" - for example, you can't do

var q = global;
trace(q.test);

so that's why that doesn't work in GMLive either (because "G.test" would evaluate "G" first, and only then try "(global).test").

I can potentially make it treat "global" specifically as an intermediate value (so long as .field access is done on it in the end) but it'll be a few days before I can properly look into that.

(1 edit)

Alright, thank you!
I wasn't expecting anything after I read the doc.

Ho! Also, I just realised some constants are missing.
Ex: bm_inv_dest_color - not ok
bm_inv_dest_colour - ok
:)

Developer

An update with this feature is now out.

About constants, I'll look into those at a later time (didn't see the edit till coming here to notify of) - the file that I use to generate "API" data ("fnames" in GMS directory) only has British spelling versions of all names for GMS1.4 so nothing takes US spelling unless I specifically add an entry (or replacement rule) for that constant/function/variable.