@donatzor said in Trouble with .find:
If the exact error text is Room.find
let room = _.filter(Game.rooms, function(room){ return room.controller && room.controller.my; })[0];
let towers = _.filter(room.find(FIND_MY_STRUCTURES), function(structure) { return structure.structureType == STRUCTURE_TOWER; });
console.log(room, towers.length);
There's plenty of ways / styles of getting / using the room name, as an example. Gets first (not necessarily in claiming order) room and towers under users control.
@gea said in Trouble with .find:
keeps throwing Room.find is not a function errors and I can't figure out why.
let room = _.filter(Game.rooms, function(room){ return room.controller && room.controller.my; })[0];
var towers = room.find(FIND_MY_STRUCTURES, {filter: {structureType: STRUCTURE_TOWER} });
console.log(room, towers.length);
Could be a solution.