I have an issue with the creeps crossing a E0 to W0 line



  • Code:

    module.exports.loop = function () {
    
    console.log(Game.time)
    console.log(Game.creeps["ranger-Spawn12-W6S22-7933113"]);
    console.log(Game.creeps["ranger-Spawn12-W6S22-7933113"].pos);
    
    return;
    

    result: [12:58:28] [shard1] [room E0S20 pos 13,30]

    [12:58:29] [shard2] 7933879

    [12:58:29] [shard2] undefined

    [12:58:29] [shard2] TypeError: Cannot read property 'pos' of undefined at Object.module.exports.loop (main:27:61) at __mainLoop:1:52 at __mainLoop:2:3 at Object.exports.evalCode (:15727:76) at Object.exports.run (:30153:24)

    [12:58:31] [shard1] 10180203

    [12:58:31] [shard1] [creep ranger-Spawn12-W6S22-7933113]

    [12:58:31] [shard1] [room E0S20 pos 13,30]

    [12:58:32] [shard2] 7933880

    [12:58:32] [shard2] undefined

    [12:58:32] [shard2] TypeError: Cannot read property 'pos' of undefined at Object.module.exports.loop (main:27:61) at __mainLoop:1:52 at __mainLoop:2:3 at Object.exports.evalCode (:15727:76) at Object.exports.run (:30153:24)

    [12:58:34] [shard1] 10180204

    [12:58:34] [shard1] [creep ranger-Spawn12-W6S22-7933113]

    [12:58:34] [shard1] [room E0S20 pos 13,30]



  • so where exactly is the issue? the creep lives on shard1 and stands on position 13,30,E0S20 you should clear the shard2 logs if you want to show something on shard1. "Crossing" includes a move-intend or standing on the room edge. Both are not apparent.



  • What do you mean? I send a creep from one room to another and at some piont it got bugged. One of the results of it is that

     console.log(Game.creeps["ranger-Spawn12-W6S22-7933113"]);
    

    shows creep one tick and the next tick it is undefined. I play on shard2, don't know how shard1 got involved.



  • [12:58:31] [shard1] [creep ranger-Spawn12-W6S22-7933113]
    [12:58:29] [shard2] undefined
    

    look at your logs carefully. First row is from shard1 and returns your creep. So your creep is on shard1 and not on shard2 anymore. So it seems your creep just entered an intershard portal.



  • Thanks! That was indeed the issue.