Unexpected Syntax error
After coming back to Screeps I run my old code and get a repeatable error message that I cannot explain:
const buildPos = RoomPosition.constructor(pos.x + x, pos.y + y, pos.roomName);
SyntaxError: Unexpected number at Function (<anonymous>) at getLocationForStructure (constructManager:98:35)
However the input seems to be correct:
pos.x + x=39(number), pos.y + y=28(number), pos.roomName=W21S34(string)
Coelso last edited by
Create a RoomPosition object like this:
const buildPos = new RoomPosition(pos.x + x, pos.y + y, pos.roomName);
Thanks, that seems to work. Maybe the API docs should be updated to reflect this.
Bazsi1224 last edited by
it is, check the example section of the constructor.
@bazsi1224 Hu?... Guess I suck at reading then.