How to upgrade room controller to level 2?



  • I am very new to JS. Give please a code, that i can use to upgrade controller. This code from docs does not work 😞

    if(creep.room.controller) {
    creep.moveTo(creep.room.controller);
    creep.upgradeController(creep.room.controller);
    }



  • Does the creep have energy? It costs energy to upgrade a controller.



  • Is your creep using the script above ALSO doing other tasks afterwards? You dont 'break' out of that logic block so if you have an alternate task below that 2nd task will take priority. Fix this by:

    if(creep.room.controller) {
    creep.moveTo(creep.room.controller);
    creep.upgradeController(creep.room.controller);
    return;
    }
    


  • Thank you everyone 🙂



  • Hi, I have used this code in the Script tab
    if(creep.room.controller) {
    var creep1 = Game.creeps.Worker1;
    creep1.moveTo(creep1.room.controller);
    creep1.upgradeController(creep1.room.controller);
    return;
    }
    But it does not work
    I tried to use this code in the console
    Game.creeps.Worker1.moveTo(Game.creeps.Worker1.room.controller);
    But it is an error -7