Skip to main content

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

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.

(3 edits)

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)

(1 edit)

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)

(1 edit)

Okay, sorry, maybe I'm missing something.


I'll try it again and send a sample project if the issue is still there

Yep, 1.0.27 magically fixed it. In 1.0.26 I had trouble even reproducing the sample snippet on an empty project