user3629714
user3629714

Reputation:

Finding a room through it's name

Let us suppose i save in memory the name of a room - "1-1". How would i go around to access that room object without having access to any creep/structure in that room? Something like:

function(roomName){
  var room = Game.rooms.roomName; //what would the simplest and quickest code be?
}

Thanks in advance.

Upvotes: 4

Views: 4098

Answers (1)

artch
artch

Reputation: 4545

You can't access a room if you have no objects inside it. It is like the fog of war. In order to see what is inside a room (in other words, to get access to the room object instance) you have to send some of your creeps there.

UPDATE: Game.rooms property has been added to the API.

Upvotes: 6

Related Questions