I would like to repeat the found structures, but I do not know which method is the best for this.
I tried this one:
for (var ext in creep.room.find(FIND_MY_STRUCTURES, {filter: { structureType: STRUCTURE_EXTENSION }})){
console.log(ext.energy);
}
but that will not work.
So now I use an approach that works, but looks ugly:
for(var i = 0; i < creep.room.find(FIND_MY_STRUCTURES, {filter: { structureType: STRUCTURE_EXTENSION }}).length; i++) {
var ext = creep.room.find(FIND_MY_STRUCTURES, {filter: { structureType: STRUCTURE_EXTENSION }})[i];
console.log(ext.energy);
}
I'm not sure, maybe this is a js related question. I am completely new to js. Can you give some advice about this?
source
share