Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.gml

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

[Request] A macro for live-loading?

A topic by Yokin created Nov 15, 2022 Views: 282 Replies: 3
Viewing posts 1 to 4
(4 edits)

I tried adding one myself, but it seems like it only works for object events and not functions (I get this error when it tries to reload a function using the macro: Couldn't find functionName in 'C:\...\scrName.gml').

Anything akin to #macro LIVE if(live_call()) return live_result;, for quick and explicit convenience like this:

function cool_script(){
    LIVE
    
    draw_set_color(c_yellow);
    draw_sprite(sprite, 0, 50, 50);
}

(Making this a request cause I assume it manually parses the script file for the live_call() or something like that, and supporting custom macros for that might be difficult).

Developer

This is likely a resource order issue - if a script/object defining the macro is below the ones using it inside the YYP, the server will not realize that the resources contain “live” code because going over everything again when you find a macro alias is kind of expensive.

You can either manually move a script to the top of YYP or simply add the macro to a resource that’s already at the top.

I can perhaps make it so that some specific script name is always indexed first…

Developer

I have now (1.0.67+) added a macro called live_auto_call (which does the same thing as yours but in a generic way) and also made it so that the server will first index scripts that have “macros” in their name.

(2 edits)

live_auto_call seems to cause a compile error when compiled with YYC, and more specifically that seems to be related to the macro’s argument_count and argument parts

I guess that’s related to why GameMaker used to not allow it? Oh well

Oh also, setting the live_enabled macro to 0 causes the live_auto_call macro to not get initialized I think (making it cause an error in the VM)