Skip to main content

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

Multiline macros not working with live_constant_add()

A topic by Ocram Ratte created 89 days ago Views: 160 Replies: 4
Viewing posts 1 to 3
(3 edits)

I’m not sure if I’m doing this right, but I store a lot of things in multiline macros to keep my project clean, I came across that I needed to set some of these with the live_constant_add() function because when updating them, I’d get a GMLive error or a straight up crash.

The game just doesn’t compile when a multiline macro is referenced in live_constant_add().

Script: MACRO_TEST at line 1 : got ':' expected ',' or ')'

Not sure if this is an oversight, impossible to implement or I just didn’t read the documentation enough.

Edit: This served me as a leason to not use multiline macros this way so I switched to a different method, I’ll just leave this post here in case you’re interested on checking it out.

Edit edit: Okay I just realized what the fuck I was doing, sorry, lol.

Developer

Multi-line macros should be supported so I could use an example that causes an error

Oh really? I thought I was just doing it wrong, still, I think the problem resides in the way the macro is formatted and can’t be taken as an argument in the live_constant_add() function

#macro TEXT_FOREST_VESTIGES						\
case("example"):								\
    scrText("example_A_01");					\
    scrText("example_A_02");					\
    scrText("example_A_03");					\
    scrText("example_A_04");					\
    scrText("example_A_05");					\
    break;                                      \
case("example2"):								\
    scrText("example_B_01");					\
    scrText("example_B_02");					\
    scrText("example_B_03");					\
    scrText("example_B_04");					\
    scrText("example_B_05");					\
    break;                                      \
Developer

If you mean that you tried to do live_constant_add("name", TEXT_FOREST_VESTIGES), GM won’t let you do that as it’s not an expression.

TEXT_FOREST_VESTIGES should be usable without any additional effort in “live” code though - so long as it’s defined in a script in the project somewhere.

Ahhh, it might be that then, that macro was only referenced inside a script, gotcha, thanks!