Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

[Solved] live_execute_string() does not work for custom scripts

A topic by kgm created Feb 09, 2019 Views: 424 Replies: 2
Viewing posts 1 to 3
(1 edit)

I am working on a built-in editor for my game and whenever I tried to execute GML code that make calls to my custom scripts live_result always return this error even though the script exists on my resource tree:

execute_string[L1,c37] `scr_item_add` is not a function or script

Developer

If you are running with live_enabled=1 but without gmlive-server connected, scripts would not be initialized by default.

You can fix this by initializing like this:

live_init(1.0, "", "");
for (var i = 0; script_exists(i); i++) {
    var s = script_get_name(i);
    gml_func_add(s + "(...)", i);
    global.g_gml_func_script_id[?s]=i
}
global.g_live_request_url = undefined;

I should probably make this default in case it can't connect to server

Also, depending on what you desire, I have recently published a smaller-scale interpreter that can be customized for scripting.

(+1)

Thank you it works now. And thanks for your suggestion! I am capable of writting my own interpreter although I prefer to spend the time to improve my art instead (I am more of an illustrator than a coder) so I just use anything that's already exist in my library and GMLive does the job perfectly.