我已经指挥了一些小兵到某些位置但是当我命令这个特定的位置时,它只是保持嗡嗡声。我没有做任何不同于我如何控制其他小兵,但它没有做同样的工作。其他人保持不动。
if(creep == Game.creeps["Transport1"])
{
creep.moveTo(harvesterLoc.x, harvesterLoc.y - 2);
creep.transferEnergy(Game.creeps["Transport2"]);
}
if(creep == Game.creeps["Transport2"])
{
creep.moveTo(harvesterLoc.x, harvesterLoc.y - 3);
creep.transferEnergy(Game.spawns.spawn1);
}
第一个有效,但第二个无效?第二个的位置在城墙内,是否会引起问题?
答案 0 :(得分:3)
你在这一行有一个错字:
DECLARE @MinDate DATE = (SELECT MIN([date]) FROM yourTable);
DECLARE @MaxDate DATE = (SELECT MAX([date]) FROM yourTable);
WITH CTE_dates
AS
(
SELECT @MinDate dates
UNION ALL
SELECT DATEADD(DAY,1,dates)
FROM CTE_dates
WHERE dates < @MaxDate
)
SELECT A.dates,
SUM(ISNULL(B.[column b],0))
FROM CTE_dates A
LEFT JOIN yourTable
ON A.dates = B.dates
GROUP BY A.dates
将if(creep = Game.creeps["Transport1"])
替换为=
,如下所示:
==
if(creep == Game.creeps["Transport1"])
是赋值运算符,=
是相等运算符。有关MDN reference中JS中运算符的更多信息。