Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics


Package GameMaker rooms and load them as you please · By YellowAfterlife

Custom variables / creation code for instances?

A topic by moppin created Jun 01, 2020 Views: 229 Replies: 7
Viewing posts 1 to 8

Hi, I noticed that a simple unpacking of a room doesn't load custom variables / creation code for the instances set in the room editor.

I read up on the cheat sheet and got as far as finding the "room_pack_eval_script", but couldn't understand what exactly I should do with it to enable loading custom variables for instances. Could you please explain what exactly I need to do?

Never mind! After some fiddling around without much understanding of how anything works, I seem to have got it working. 
Just for anyone who comes across the same problem with no clue as to what they should do, here's what I did:

Since I was already using GMLive (which if you don't already, this will be another reason you should), all I needed to do was to paste the following code in the creation event of the object I wanted the custom variables / creation code to be applied to.

room_pack_eval_script = live_execute_string;

I'm having the same problem, trying to have an unpacked room load custom variables. I'd appreciate help sorting this out.

I tried setting up gmlLive and putting 

room_pack_eval_script = live_execute_string;

into the create event for the object but  I get the following error-
"Can't execute code for inst_70184F7E:Properties - please assign an evaluator script to room_pack_eval_script (see doc)"

I'm using 2.3 Latest Stable Version.

  Also probably unrelated but GMLive.gml floods the Syntax Error checker of GML to the point it gives up and stops checking other scripts. 

most of them say- variable this referenced only once

Also, I'm trying to build this project for html5 which GMLive seems to not compile to. Is there an alternative?

Hey sorry, as I checked my code now I realized my solution wasn't exactly correct and now I don't know what fixed it.  It seems the code I posted doesn't exactly have to be called from every instance. It might be best to await Vadim's response.

Thanks for checking  moppin! 

I noticed after positing this that
Kehler is also having problems with this issue. 

Are you using 2.3?

No I'm still on 2.2!

(1 edit) (+1)

Using instance variables with live_execute_string has been broken since 2.3. I don't know if the problem is with GMRoomPack or GMLive, and I don't think Yal has fixed it yet.

I managed to get it working with another one of the recommended solutions found in the documentation, but that has since stopped working again. Though I think the problem in on my end since I haven't updated either of the extensions.
This was the one I tried with:
See if you can get it working for you :]

Correction: It never really stopped working. I just found that I had commented some code for testing, then forgot about it. Another note though, my current solution only works with YYC, not VM.