I'll just leave this here, it is a helper function that deals with the room position issue without needing to use the Game.getObjectById function:
/**
* @param {number|object} x
* @param {number} [y]
* @param {string} [roomName]
* @returns {RoomPosition|boolean}
*/
var getRoomPosition = function (x, y, roomName) {
if (!x) return false;
if (typeof x == 'object') {
var object = x;
x = object.x;
y = object.y;
roomName = object.roomName || object.room;
}
return new RoomPosition(x, y, roomName);
};
global.pos = getRoomPosition;
// Usage:
creep.memory.target = creep.room.find(FIND_SOURCES)[0];
creep.moveTo(pos(creep.memory.target));