Skip to content

syntax error from the screeps console #13

@SHADOWELITE7

Description

@SHADOWELITE7

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions