不能用内存产生蠕变

时间:2018-01-15 17:45:18

标签: screeps

首先,我对这个游戏完全不熟悉,但我知道以前的js。我遇到的问题是我在模拟器中玩耍的结果。

我正在尝试产生一个蠕变,我开始修改example in the tutorial

rpc*

但这只会产生一种蠕动,其记忆为Game.spawns['HQ'].spawnCreep( [WORK,CARRY,MOVE], name, {memory: {role: r}});

enter image description here

我在调用undefined后尝试设置内存:

spawnCreep

但它导致相同的“错误”。

我错过了什么?

UPDATE1:

它变得更糟......我决定抛弃我的整个代码库,并用教程中的确切代码替换它。内存仍然是Game.creeps[name].memory = { role: r }; ...

undefined

更新2:
我决定在私有服务器上尝试相同的代码(也就是说,不像我之前那样在模拟中),现在代码可以正常工作。这只留下一个结论,模拟被窃听。

2 个答案:

答案 0 :(得分:1)

您错过了字符串值“ r”的“引号”,这是正确的语法:

$ cat tst.awk
BEGIN {
    OFS = ", "
    print "PATH", "FILENAME", "SIZE", "TIMESTAMP"
}
/^ / {
    file = $1
    size = $3
    sub(/^ ([^[:space:]]+[[:space:]]+){3}/,"")
    print path, file, size, $0
    next
}
{ path = $0 }

$ awk -f tst.awk file
PATH, FILENAME, SIZE, TIMESTAMP
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+05.00B-00-QingL.JPG, 6958377, Fri Jun  8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+05.00B-00-QingLI.JPG, 2794933, Fri Jun  8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+05.00B-00-QingLO.JPG, 1350397, Fri Jun  8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+11.00B-00-QingL.JPG, 6997803, Fri Jun  8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+11.00B-00-QingLI.JPG, 2783151, Fri Jun  8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A+11.00B-00-QingLO.JPG, 1338662, Fri Jun  8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A-00.00B-00-QingL.JPG, 7069740, Fri Jun  8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A-00.00B-00-QingLI.JPG, 2825705, Fri Jun  8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, R0097A-00.00B-00-QingLO.JPG, 1369520, Fri Jun  8 12:53:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0097\Qingl, Jhumbs.db, 20480, Fri Jun  8 13:14:41 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+05.00B-00-QingL.JPG, 6958377, Fri Jun  8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+05.00B-00-QingLI.JPG, 2794933, Fri Jun  8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+05.00B-00-QingLO.JPG, 1350398, Fri Jun  8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+11.00B-00-QingL.JPG, 6998803, Fri Jun  8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+11.00B-00-QingLI.JPG, 2783151, Fri Jun  8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A+11.00B-00-QingLO.JPG, 1338662, Fri Jun  8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A-00.00B-00-QingL.JPG, 7069840, Fri Jun  8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A-00.00B-00-QingLI.JPG, 2825705, Fri Jun  8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, R0098A-00.00B-00-QingLO.JPG, 1369520, Fri Jun  8 12:54:30 2018
\QJ DaJabase EltraJo\DR0151-populated\DaJa\ASAA Images\k0098\Qingl, Jhumbs.db, 20480, Fri Jun  8 13:14:41 2018

尽情享受_

答案 1 :(得分:0)

您是否尝试过确保Memory.creeps存在?您可以通过在出现此问题的服务器上的控制台中运行以下代码来创建密钥:

if (!Memory.creeps) Memory.creeps = {};

每当我遇到这个问题时,这通常会成为解决方案 - 尽管为什么Memory.creeps在某些条件下有时会变成undefined,但我不知道。