Akuukis / screeps-bot-brave

In cooperation with its kind it will strive to unite the server into a brave new world. Community! Identity! Stability!
GNU General Public License v2.0
49 stars 37 forks source link

dtask #5

Closed Pontuzz closed 8 years ago

Pontuzz commented 8 years ago

Hey, first of all. I'm very new to js but trying.

running the scripts as is returns:

[7:18:40 AM]E43N18 : overlayNetwork
[7:18:40 AM]dtask:50
        if(!Memory.rooms[roomName].clean){
                                  ^
TypeError: Cannot read property 'clean' of undefined
    at module.exports.overlayNetwork (dtask:50:29)
    at eval (eval at <anonymous> (dtask:10:35), <anonymous>:1:1)
    at Object.module.exports.doNext (dtask:10:12)
    at Object.module.exports.loop (main:53:9)
    at __mainLoop:1:52

I can't really understand why it's not working. I

Akuukis commented 8 years ago

Hi, thanks for reporting! Problem is that Memory.rooms[roomName] is undefined for some reason. A quick fix would be to edit

if(!Memory.rooms[roomName].clean){

into

if(Memory.rooms[roomName] && !Memory.rooms[roomName].clean){

but eventually we should understand how undefined room got into dtasks. Maybe you scouted a room and lost vision of that room before delayed task started to execute. Hard to say now, I haven't worked on screeps for a while.