You are not logged in.
Pages: 1
After using this a lot, and learning something from torigara over at the GMC, here's an optimization of the script.
/*
** Usage:
** map_rooms(ds_map)
**
** Arguments:
** ds_map map to which all rooms are loaded.
**
** Notes:
** Fills the map with {key=name, val=index} pairs.
** To find the maximum number of rooms, it creates an extra
** room. The name of this room will be added to the map
** unless a room with the same name already exists.
**
** Returns:
** the index of the created room
**
** GMLscripts.com
*/
{
var i,ds_map;
ds_map = argument0
for (i=room_first;i>=0;i=room_next(i)) {
if (room_exists(i)) {
ds_map_add(ds_map,room_get_name(i),i);
}
}
}
Does the same thing as the original script, it just doesn't need to create an extra room to accomplish it.
Offline
This actually already came up once:
http://www.gmlscripts.com/forums/viewtopic.php?id=52
Abusing forum power since 1986.
Offline
Pages: 1