screeps 里会时不时的给你一个提示,平时也没怎么看过,今天特地点了一遍,把常见的 tip 都记录一下供大家参考。
Walking over swamps is 5 times slower compared to plain land.
在沼泽地上行走比平原慢5倍。
Ramparts and walls initially have 1 hit point. Repair them after construction.
城墙和城墙最初有1点hit
。要记得施工后进行维修。
If you want to play from scratch, you can always Respawn in a new room.
如果你想从头开始玩,你可以在一个新房间里重生。
You can output HTML content to the console, like links to rooms.
您可以将HTML内容输出到控制台,例如一个跳转到指定房间的超文本链接。
The
RANGED_ATTACK
body part is 2 times weaker thanATTACK
and 2 times costlier at that.
RANGED_ATTACK
身体部件的相对伤害只有ATTACK
部件的 1/2,成本却高2倍。
Observers allow to get the Room object for the rooms that have no objects of yours.
Observers
可以获取那些没有你单位存在的房间对象。
Respawning in a chosen room would automatically destroy all structures except walls and roads
在选定的房间重生会自动破坏房间内除墙和道路以外的所有建筑。
You can build and repair roads in any rooms, even neutral ones.
你可以在任何房间修建和维修道路,甚至是中立房间。(容器container
也可以)
A creep can execute some commands simultaneously in one tick, for example move+build+dropEnergy.
creep
可以在一个tick
内同时执行多个命令,例如 move
+ build
+ dropEnergy
。
Use storage to not lose surplus of mined resources.
使用storage
来存储开采出来的过量资源。
There is a keyword
debugger
in the simulator that stops your script in the browser.
模拟器中有一个关键字debugger
,可以用于在浏览器中暂停脚本。
The console.log function of the simulator displays a live expandable object in the browser console.
模拟器的console.log
函数可以在浏览器的控制台中同步显示(可以对object
进行展开操作)。
If
CPU
limit raises, your script will execute only partially.
如果运算量超过CPU限制,脚本将只执行部分代码。
To output an object content into the console, use
JSON.stringify
.
要将对象内容输出到控制台,请使用JSON.stringify
。
Sources in neutral rooms have reduced capacity. Reserve or claim the room to restore it to full capacity.
中立房间矿的能量上限只有1500
。预订或占领房间可以使其恢复到最大容量。
Send emails to yourself with the function
Game.notify
to be aware of everything happening in the game.
使用Game.notify
函数向自己发送电子邮件来了解游戏中发生的一切。
You can apply transfer and heal to another player’s creep, and transfer, build and repair to others’ structures.
你可以transfer
和heal
另一个玩家的creep
,以及transfer
,build
和repair
到其他玩家的建筑。
Walls and roads don’t belong to any player, so they should be searched with the help of
FIND_STRUCTURES
, notFIND_MY_STRUCTURES
.
墙壁和道路不属于任何玩家,因此应该使用FIND_STRUCTURES
进行搜索,而不是FIND_MY_STRUCTURES
。
A creep with an
ATTACK
part automatically strikes back at every attacker byATTACK
.
一个带有ATTACK
部分的creep
会自动反击任何带有ATTACK
的攻击者。
To save your
CPU
, use less creeps of a larger size.
生成数量更少、身体部件更多的creep
来节省你的CPU
。
Use Room.energyAvailable and Room.energyCapacityAvailable to determine how much energy all the spawns and extensions in the room contain.
使用Room.energyAvailable
和Room.energyCapacityAvailable
来确定房间中所有spawn
和extensions
包含多少能量及能量上限是多少。
You can use more
CPU
than yourCPU
limit allows in short bursts.
你的CPU
使用量可以在短时间内使用超过你CPU
上限。(“短时间”取决于你的cpu
桶中的余额)
Roads wear out as they are used, so don’t forget to repair them.
道路在使用过程中会逐渐磨损,所以别忘了修理它们。
Build roads to save on
MOVE
body parts of your creeps.
建造道路可以让你的creep
使用更少的MOVE
部件。
Use
try/catch
blocks in right places to avoid a complete halt of your script due to errors.
在适当的位置使用try/catch
代码块,以避免由于异常而导致脚本退出。
A tower’s effectiveness depends on the distance to the target.
tower
的工作效率取决于tower
到目标的距离。
Energy in a storage can not be used to spawn creeps. Transfer it to a spawn or extensions instead.
storage
里储存的能量不能用来产生creep
,要先将能转移到一个spawn
或extension
。
Spawn extensions capacity increases on room levels 7 and 8.
RCL7 和 RCL8 将提升 extension 的容量。
Use towers to set up automatic defense of your room.
使用tower
来建立你房间的自动防御。
Dead body parts have weight and generate fatigue as well.
一个坏掉的身体部件也会产生疲劳。
The game is fully recorded, so you can see replay of any room for the past several days.
游戏已经被完整录制,所以你可以随时回放过去几天发生的事情。
Unless you use up your CPU limit each tick, it is stored for future use.
除非你每tick
都用光了你的CPU
,不然没有用掉的会被存起来以备以后使用。
The more spawn extensions in a room, the more energy you can spend on building one creep.
一个房间中的spawn
和extension
越多,你就可以用更多的能量来构建一个creep
。
Modular architecture of a script will allow easy testing of individual functions in the simulator.
脚本的模块化架构使得你可以在模拟器中轻松测试单个函数。