GithubHelp home page GithubHelp logo

screeps-nooby-guide's People

Contributors

akuukis avatar davv1 avatar faithfuldev avatar tim-pohlmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

screeps-nooby-guide's Issues

typescript conversion

Would it be possible to do a typescript conversion of your latest refactored code as another tutorial step?

syntax error from the screeps console

so I was starting out your nooby guide part 2. When I ran the code I kept getting this in the console.

[6:31:02 PM][shard3]SyntaxError: Unexpected token && [main:4:36]
[6:31:05 PM][shard3]SyntaxError: Unexpected token && [main:4:36]
[6:31:08 PM][shard3]SyntaxError: Unexpected token && [main:4:36]
[6:31:11 PM][shard3]SyntaxError: Unexpected token && [main:4:36]
[6:31:14 PM][shard3]SyntaxError: Unexpected token && [main:4:36]

I don't know if its my code that I used from your tutorial so I will copy the code and put it here.

module.exports.loop = function () {
	var creep = Game.creeps.Alaina;
	
	if (creep.memory.working == true, &&_creep.carry.energy == 0) {
		creep.memory.working = false;
	}
	else (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_ENERGY) == ERR_NOT_IN_RANGE) {
			creep.moveTo(Game.spawns.Spawn1);
		}
	}
	else {
		var source = creep.pos.findClosesetByPath (FIND_SOURCES);
		if (creep.harvest(source) == ERR_NOT_IN_RANGE) {
			creep.moveTo(source);
		}
	}
}

I do think its probably these && in the code.

I use sublime text 3

version 3.2.1
build 3207

Structures not returning as objects

When I run code to search for structures through Game and Rooms I'm not able to access their methods as I would expect.

To use your tower script as an example:

var towers = _.filter(Game.structures, (t) => t.structureType == STRUCTURE_TOWER);
console.log(towers) // array of objects as expected
console.log(towers[0]) // an object as expected
for (const tower in towers) {
console.log(tower); // Returns "0". What is this data type? It should be the object but isn't?
var target = tower.pos.findClosestByRange(FIND_HOSTILE_CREEPS);
// if one is found...
if (target != undefined) {
// ...FIRE!
tower.attack(target);
}
}

tower.pos and tower.attack both return as undefined.

You can view my screeps repository for another example in the StructureManager.js script.

error with new spawn

TypeError: Cannot read property 'harvester' of undefined at StructureSpawn.spawnCreepsIfNecessary (prototype.spawn:75:70) at Object.module.exports.loop (main:33:32) at __mainLoop:1:52

Starting a new spawn with your code. A harvester is spawned and begins collecting energy, but nothing else happens.

error code

TypeError: Cannot read property 'harvester' of undefined
at StructureSpawn.spawnCreepsIfNecessary (prototype.spawn:75:70)
at Object.module.exports.loop (main:33:32)
at __mainLoop:1:52

spawn setup

Hey thPion,

I has seen the video's on the script, however, could you add a setup for the spawn that sets their memory based on certain variables?
This and building logic would would make it a good step closer to automation...

getting this when using your code

TypeError: Cannot read property 'find' of undefined
at Object.module.exports.loop (main:46:33)
at __mainLoop:1:52
at ContextifyScript.Script.runInContext (vm.js:35:29)

control spam console.log

if(Game.spawns.Spawn1.energy >= 300){
//Game.spawns.Spawn1.createCreep's

if (!(name < 0)) {
console.log("Spawned new creep: " + name);
console.log("Spawned new builder: " + numberOfBuilders);
console.log("Spawned new upgrader: " + numberOfUpgraders);
console.log("Spawned new harvester: " + numberOfHarvesters);
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.