A note on room casing
GMRoomPack » Devlog
If your room names do not match their file names (e.g. rm_some
’s file/directory are called rm_Some
) for some reason, the keys in GMRoomPack maps might also not match the room names.
Here’s a script that you can run after creating the map to fix up the names:
function room_pack_fix_casing(_room_map) {
//
var _room_ids = asset_get_ids(asset_room);
var _room_fixes = ds_map_create();
for (var i = 0, n = array_length(_room_ids); i < n; i++) {
var _room_name = room_get_name(_room_ids[i]);
_room_fixes[?string_lower(_room_name)] = _room_name;
}
//
var _keys = ds_map_keys_to_array(_room_map);
for (var i = 0, n = array_length(_keys); i < n; i++) {
var _key = _keys[i];
var _key_fixed = _room_fixes[?string_lower(_key)];
if (_key_fixed != undefined && _key_fixed != _key) {
_room_map[?_key_fixed] = _room_map[?_key];
ds_map_delete(_room_map, _key);
}
}
//
ds_map_destroy(_room_fixes);
}
Used like so
var json_rooms = scr_rts(); // generated from rooms starting with rt_
json_rooms = room_pack_fix_casing(json_rooms);
Get GMRoomPack
Buy Now$4.95 USD or more
GMRoomPack
Package GameMaker rooms and load them as you please
Status | Released |
Category | Assets |
Author | YellowAfterlife |
Tags | GameMaker, Moddable |
More posts
- 2022.8+ compressed tile map supportOct 29, 2022
- FX layer support and minor fixesMar 21, 2022
- A note on `room_pack_eval_script` in 2.3Oct 08, 2021
- Small updatesMar 18, 2021
- 2.3 minifixNov 28, 2020
- A GMS2.3 versionJul 27, 2020
- A few more fixesFeb 22, 2019
- More small fixesNov 26, 2018
- Small fixesNov 14, 2018
Leave a comment
Log in with itch.io to leave a comment.