So, this is a question about the game screeps. I know that in the simulation, I can create a road by going to the Construct menu on the left, but is there an API reference I can use to create one programmatically? My goal is to have a script that…
When playing the game screeps.com I want to calculate the cost of building the required body. See my attempt below, where cfg.body is the bodypart array, e.g. [Game.ATTACK, Game.MOVE, Game.WORK, Game.CARRY, Game.MOVE]:
var buildCost = 0;
for(var…
While playing screeps I can't figure out how to attack an enemy. Here's what I tried.
I created my attacker creep:
Game.spawns.Spawn1.createCreep(['attack','move'],'Attacker1');
Then when the first enemy came on the screen I tried running this…
In Screeps, each player's usage of CPU is limited, but the documentation for this feature doesn't make the way this is enforced sufficiently clear for writing CPU limit robust code. I've considered the following four possibilities:
1. The player's…
Is it possible to delete created creeps? Either through a script or through the GUI?
I could not easily find a way to do this, but it seems like a simple functionality so I imagine it exists, or someone has thought about it or something.
Fascinating game!
Looking for an example of how to persist a reference to a particular energy source in a creep's memory. Seems that storing the actual source object won't work(?).
I want to store some information about energy sources that I am harvesting. Ideally I would use mySource.memory.taken but Source does not have a memory property.
I could implement something like this:
Source.prototype.memory = function() {
…
I try to use findNearest like that:
var sources = creep.room.findNearest(Game.SOURCES)
creep.moveTo(sources[0]);
creep.harvest(sources[0]);
and this is what i get:
TypeError: undefined is not a function
at module.exports:5:28
at :11:6
How…
I'm trying to figure out how to get every creep with a specific memory or role like harvester in a variable... I can't seem to figure it out.
I already tried:
module.exports = function(){
for(var i in Game.creeps){
if(i.memory ==…
I am having a hard time trying to figure out how to extend the creep class to add my own functions in the new javascript mmo game, Screeps -> www.screeps.com
I'm trying to set my new Screeps (the game) project from scratch using TypeScript (^2.9.2) and Webpack (^4.12.1). How do I properly set up source maps? What I did:
Set "sourceMap": true, in tsconfig.json
Set devtool: 'inline-source-map', in…
In the Programming Game Screeps I spawn creeps by using:
if(transporters.length < 0 && harvesters.length > 2) {
var newName = Game.spawns['SpawnZone'].createCreep([WORK,CARRY,MOVE], undefined, {role: 'transporter'});
console.log('Spawning new…
I've been toying around with Screeps for a while now and last night I decided to work out some of my behaviors into a class hierarchy by deriving two classes, Miner and Transporter from a Creep main class. However, whenever I do…
Is there any way to call a module or function from the console? For example a module that creates worker creeps, called from the console with my_module.add_creep?