This is my code for role.scout, for some reason it doesn't work



  • The creep starts moving the wrong direction and goes into another room. Then it stands still.

    var roleScout = {

    run: function(creep) { 
        creep.memory.target = ('E1S46');
        if(creep.room.name != creep.memory.target){
            var getMeOut = creep.room.findExitTo(creep.memory.target);
            creep.moveTo(creep.pos.findClosestByRange(getMeOut));
            creep.say(':D ?');
        }
        else{
            creep.moveTo(creep.room.controller);
        }
    }
    

    }

    module.exports = roleScout;

    Any idea?



  • The scout stops on the exit tile and blinks between rooms or does it stop in the middle of the wrong room?

    Either way a more robust algorithm for traveling to a destination room:
    Move to 25,25 with range 24 in the destination room; let moveTo handle selecting exits.