Thanks Dissi. I saw that issue in another post and made sure that I was deleting creeps from memory before creating/assigning roles. This doesn't seem to be related to that. I assume this is a PEBKAC issue, but I can't figure it out if it is.
vt
Thanks Dissi. I saw that issue in another post and made sure that I was deleting creeps from memory before creating/assigning roles. This doesn't seem to be related to that. I assume this is a PEBKAC issue, but I can't figure it out if it is.
vt
I'm not sure if this has been addressed elsewhere, but I'm unable to find it if it is.
I'm having a problem where my screeps aren't getting roles assigned when they are spawned from code. Not sure how well the code will format here, but here are some snippets...
if(!as_myspawn.spawning && as_myspawn.canCreateCreep([WORK, CARRY, MOVE], ls_creepname, {role: as_creeptype}) == OK)
{
var lb_success = as_myspawn.createCreep([WORK, CARRY, MOVE], ls_creepname, {role: 'harvester'});
console.log('Creating...')
}
I'm not sure if the role is not getting assigned because, well, I'm just not sure. This is, more or less, the same code in the tutorials. So, I thought would attempt to look at the role of the creep to see if it was undefined. If so, I'll assign it. However, I'm getting strange errors that seem to prevent me from assigning roles after the fact.
// Check for unassigned roles
for(var name in lobj_creeps)
{
var creepname = name;
console.log(creepname);
// I've tried various forms of this, with no luck
if(lobj_creeps[name].memory.role === undefined)
{
console.log(creepname);
Game.creeps.creepname.memory.role = 'harvester';
}
}
This gives me an error:
main:46
Game.creeps.creepname.memory.role = 'harvester';
^
TypeError: Cannot read property 'memory' of undefined
at Object.module.exports.loop (main:46:34)
at __mainLoop:1:52
It doesn't appear to matter whether I use just the name in a variable or the whole object, I still get this error, or one very similar.
However, if I use this...
Game.creeps.HarvesterA6.memory.role = 'harvester';
A role is assigned.
What am I missing here?
Thanks,
vt
Excellent! Thanks for your help! Not sure I can reconcile the error I'm getting with what the code is, but maybe I missed that name in memory...
Thanks again,
vt
Apologies if there has been answered somewhere else, but I can't find a list anywhere.
Is there a list of error codes and meanings somewhere? When I spawn a creep, I know that -6 means there are not enough resources to spawn it. However, I get a -3 quite frequently and I'm not sure what that is. For a while, I thought it meant that the spawn was busy, but I attempted to manually spawn a harvester (2 x work, 2 x carry, 2 x move) while the spawn was idle and got -3.
Is there a list? If not, does anyone know what -3 is?
Thanks,
vt