Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMRoomPack

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

Error when loading map from script

A topic by Dynamic zero created Jan 04, 2019 Views: 514 Replies: 6
Viewing posts 1 to 4

Hiya,

I seem to be getting this error and not exactly sure why. I have a test room with only one object -_______________________________________

############################################################################################
FATAL ERROR in
action number 1
of Key Press Event for S-key Key
for object obj_generator_2dig:

ds_map_find_value argument 1 incorrect type (string) expecting a Number (YYGI32)
 at gml_Script_room_pack_raw_run_impl2 (line 10) - var l_lrs=l_rm[?"layers"];
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_room_pack_raw_run_impl2 (line 10)
called from - gml_Script_room_pack_load_map (line 18) - room_pack_raw_run_impl2(l_map);
called from - gml_Object_obj_generator_2dig_KeyPress_83 (line 10) - room_pack_load_map(json_rooms[?name],50,50);


I am calling the map load like this -


room_pack_blank_object = obj_blank;

var json_rooms = this_is_a_test(); // generated from rooms starting with rt_
// pick a random room name from the map:
var name = ds_map_find_first(json_rooms);
repeat (irandom_range(0, ds_map_size(json_rooms) - 1)) {
    name = ds_map_find_next(json_rooms, name);
}
// and load that:
room_pack_load_map(json_rooms[?name],50,50);
// and when you're done:
ds_map_destroy(json_rooms);


Thanks,

Developer

If you can get me a sample of room that produces the error, would be nice - I thought I knew what this was but I did push a fix for that before.

Hey I managed to replicate it again at home, here is the room's code -

https://pastebin.com/jurVnu4Z

Sure thing! I actually produced this project at work so will get it to you on Monday. I am doing to simple tests now and not having the same issue! Amazing work by the way dude, I just discovered your work randomly and am seriously impressed!

Developer

Upon further inspection, it would seem like you are somehow passing a string instead of a ds_map to room_pack_load_map? Did you pick to pack multiple rooms into this_is_a_test (in which case it'd hold a map where key is room name and value is room data) as opposed to one room (in which case it'd hold room data directly)?

This is my single room data -

https://pastebin.com/rnNLsB7W

Developer

Yeah, so with a single room exported, you would just feed that to room_pack_load_map, without picking a random value from it.