Hello,
I am in the process of porting a game from GM8.0 to GMS2.3. Against the recommendations of Yellow AfterLife, I am using GMLive to load external code for some of the game logic. In GM8, we used custom objects extensively to load arbitrary external content. The game is treated like a MUGEN of its respective genre, and its users quite like the full GML support, so we need to keep access to full GML.
My issue is that I am unable to access assets in the asset tree from code compiled using live_snippet_create.
For example, I have
object.scr_step = live_snippet_create(stage_scr_load("scr_step"));
Which reads the code form a file into a string to compile and cache into a snippet.
In that code I have
with ( obj_stage_bg ) { // My Code here }
With obj_stage_bg being a GameMaker object. This code does not work however, as it gives me the following error:
[error] 100009 (obj_game_control) does not have a variable `obj_stage_bg` called from execute_string[L56,c8]
Until the need for the with statement I've gotten around this but "installing" scripts and such to variables in the calling objects using asset_get_index(), but that hasn't been working for the with statement.
EDIT: I don't know what I was thinking, asset_get_index is indeed working for it. However, I would still like to know if there is some setup I can do to do this stuff directly. I have thousands of scripts to port, so it would be a huge help!
Thoughts on why I cannot access my assets from GMLive code? And if this is expected behavior, is there anyway I can get with statements to function properly? Thank you.