1
不知道“Screeps”?访问screeps.com运行screeps时出错脚本
其11线线在主脚本
的错误:
main:11
if (creep.transfer(Game.spawns.Spawn1, RESOURCE_ENGERGY) == ERR_NOT_IN_RANGE {
^
SyntaxError: Unexpected token {
脚本:
module.exports.loop = function() {
var creep = Game.creeps.Grace;
if (creep.memory.working == true && creep.carry.energy == 0) {
creep.memory.working = false;
}
else if (creep.memory.working == false && creep.carry.energy == creep.carryCapacity) {
creep.memory.working = true;
}
if (creep.memory.working == true) {
if (creep.transfer(Game.spawns.Spawn1, RESOURCE_ENGERGY) == ERR_NOT_IN_RANGE {
creep.moveTo(Game.spawns.Spawn1);
}
}
else {
var source = creep.pos.findClosestByPath(FIND_SOURCES);
if creep.harvest(source) == ERR_NOT_IN_RANGE {
creep.move.To(source);
}
}
};
有什么建议?
你”在'ERR_NOT_IN_RANGE'后面至少丢失了一个右括号, –
但是在哪里?我找不到。 – Josqu
确切地说,你的错误告诉你它是。在'{'之前。 –