I think I'll need a sample project/larger code snippet for this since I'm trying
var v = instance_create_depth(0,0,0,obj_blank); v.friendly = 1; show_message(v.friendly);
via live_execute_string and this does not fail no matter the configuration.
I'm using live snippets
The context:
Card game.
I'm loading all the cards from JSON files. Each card has a bunch of characteristics, including "effect" (which is a string of GML code, containing what the card actually does)
Then, the oCardLoader, when loading a card, assigns it a live snippet, containing the effect string.
live_snippet_create()
is called inside oCardLoader
effect()
is called inside the card struct
With this setup, I'm having these errors. Pretty sure it's not too specific to the project (although I may be wrong)
I wouldn't be asking for a sample project if it was as easy to reproduce
oSmallSlime Create event:
friendly = 4;
Test code:
var s = live_snippet_create(@' var slime = instance_create_layer(0, 0, "Instances", oSmallSlime); show_debug_message(["slime", slime, slime.object_index, object_get_name(slime.object_index)]); show_debug_message(["friendly", slime.friendly]); show_message(slime.friendly); slime.friendly = false; return slime; '); if (live_snippet_call(s)) { var slime = live_result; show_debug_message(["slime", slime, slime.object_index, object_get_name(slime.object_index)]); show_debug_message(["friendly", slime.friendly]); } else show_debug_message(live_result);
Output:
[ "slime",100003,3,"oSmallSlime" ] [ "friendly",4 ] [ "slime",100003,3,"oSmallSlime" ] [ "friendly",0 ]
(unless I fixed this in 1.0.27 without noticing)