Get reference to selected entity in console

  • Quite often I am in the situation of wanting to call some method of the selected object (spawn, creep, ...) in the console.

    Currently I have to copy the objectId of the selected object, then call Game.getObjectById('copiedId') to get the reference to the selected object.

    In most browsers debug tools you can get a reference to the currently selected DOM element by just accessing $0 and I'd love to have this feature in the screeps console so I can just call something like $0.spawnCreep() or $0.moveTo() etc.


  • This. I like that idea a lot. ive gone so far as to do stuff like global.goid = Game.getObjectId; just to make it easier to access stuff, but yes. this would make life so much easier.