Room is not defind



  • if i want to use the room.energyAvaible function it says room is not defined i tierd many things but nothing worked.
    It should look like this :
    var mainRoomEnergy = room[myRoomName].energyAvaible;
    to see how much energy is in extractors and spawns.
    I want that a number comes out of it like the support article said.

    looking forward

    Stegosaurus



  • Try this: 

    var mainRoomEnergy = Game.rooms[myRoomName].energyAvailable; 

    You will also need SIGHT on the room. That means there must be some creep or structure of yours inside the room or you must use the observer...