Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

GMRoomPack

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

[Solved] An issue when using "room_pack_load_file"

A topic by srbbw created Nov 26, 2020 Views: 201 Replies: 2
Viewing posts 1 to 3

Hello. I’m using GameMaker Studio 2.3.1 and GMRoomPackForGMS2.3.yymps on Windows. I have an issue when using “room_pack_load_file”.

I created and ran the following batch file located in “…/<project_name>/datafiles/pack.bat” to pack each room with name starts with “rm_chunk_”:

for /D %%i in (..\rooms\rm_chunk_*) do (
    type nul > chunk\%%~ni.cnk
    GMRoomPack\GMRoomPack.exe %%i\%%~ni.yy chunk\%%~ni.cnk
)

Then I tried to load a packed room by the following script:

var _filename = "chunk\\rm_chunk_00.cnk";
var _result = room_pack_load_file(_filename, 0, 0, room_pack_flag_all);
show_debug_message(_result);

However, “show_debug_message” shows “0”, and nothing is displayed on the game screen.

I inspected the packed file “chunk\rm_chunk_00.cnk” and found that the packed file has the following form:

function rm_chunk_00() {
	{"name":"rm_chunk_00","layers": ... }
}

I think the first line (“function rm_chunk_00() {”) and the last line (”}”) cause the issue. In fact, when I remove these two lines, “room_pack_load_file” works fine.

Is this intentional behavior or a bug?

Developer

Uploaded a new version that fixes this.

Thank you for the quick fix. Now everything is working fine.

This extension helps me a lot when creating randomly generated levels. Keep up the good work.