Flags no showing in memory



  • Hi there,

    I seem to have a problem with my memory, or rather the memory of screeps. the items flags, rooms and spawns are undefined in memory since i started the game. If i place flags, they don't appear in memory. This is pretty annoying since i want to go to a second room to claim the controller. Anyone have a  tip how to fix my memory? Or how to get the creep to the other room?



  • Well, i did get the creeps to go to the other room by the following code and hardcoding the room name into the memory of the creep. 

    But i would still like to know how to fix the flags problem in memory 🙂

     

    var claimers = _.filter(Game.creeps, (creep) => creep.memory.role == 'claimer');

    if (claimers.length < 2) {
    console.log(Game.spawns['Spawn1'].createCreep([CLAIM, MOVE], undefined, {role: 'claimer', targetRoom: "roomnamehere"}));
    }

    module.exports = {
    run: function(creep){
    if(creep.memory.targetRoom != creep.room.name){
    var exits = Game.map.findExit(creep.room, creep.memory.targetRoom);
    var exit = creep.pos.findClosestByRange(exits);
    creep.moveTo(exit)
    } else {
    if(creep.room.controller) {
    if(creep.reserveController(creep.room.controller) == ERR_NOT_IN_RANGE) {
    creep.moveTo(creep.room.controller);
    }
    }
    }
    }
    }