Hey I start programing but i don´t understand the consol crash output. I wrote this code:
var roleRep = {
/** @param {Creep} creep **/
run: function(creep) {
if(creep.memory.fullcheck && creep.carry.energy == 0) {
creep.memory.fullcheck = false;
}
if(!creep.memory.fullcheck && creep.carry.energy == creep.carryCapacity) {
creep.memory.fullcheck = true;
}
if(creep.memory.fullcheck) {
var targets = creep.room.find(FIND_STRUCTURES, {
filter: object => object.hits < object.hitsMax
});
targets.sort((a,b) => a.hits - b.hits);
if(targets.length > 0) {
if(creep.repair(targets[0]) == ERR_NOT_IN_RANGE) {
creep.moveTo(targets[0]);
}
}
}
else {
var spwn = creep.pos.findClosest(FIND_MY_SPAWNS);
creep.moveTo(spwn);
if((spwn) > [199]) {
spwn.transferEnergy(creep);
}}
}
};
module.exports = roleRep;
I think i miss somethink but i cant finde the mistake any help?