without seeing code its hard to say - most likely your entry point is broken somehow, or the relevant 'creep code' isnt executing since its in a seperate file and function not being called - at this stage just guessing - code helps
Posts made by Primoz56
-
RE: No code changes are accepted
-
RE: Picking Up Dropped Energy
findClosestByPath returns a single value not an array - so dont use dropenergy[0] but just dropenergy
Â
as for the storage finding loop, do the same - use findclosest rather than find
-
Circular references
Hi again,
Just wondering how do you deal with circular references with include files in screeps/javascript (google hasn't helped)
example in file main.workforce:
var creepScout = require('creep.scout');
and in file creep,scout:
var workforce = require('main.workforce');
basically in creep.scout i want to call a function defined in main.workforce but main.workforce already owns (and should own) creep.scout.
Thanks,
Primoz
-
RE: anyone know how to fix this problem?
sorry there is too much code here for me to determine where the problem may lie, especially since you can't really see the line numbers like you do in the editor. I would suggest find the relevant line (likely one of the 3 createCreep lines) and remove/alter them temporarely and see if the problem goes away. If it does keep removing/tweaking it until the problem goes away. There is a good chance some of the special characters like ( or . are some wierd unicode version that looks fine to you but the computer doesn't like. try re-typing the commands or copy/paste into console to see your results.
one quick thing i've spotted off topic:
var tower = Game.getObjectById('136f5028c6fc960974e187ef');
replace with something like
var tower = creep.pos.findClosestByPath(FIND_STRUCTURES, {filter: (structure) => { return (structure.structureType == STRUCTURE_TOWER) } });
hardcoded object ids are bad, especially if you respawn
-
RE: Efficient code for entering a code
Creeps blink when they dont know what to do once they enter a new room. I would suggest review your code and find the broken bits.
As for your request:
if((creep.pos.x == 0) || (creep.pos.y == 0) || (creep.pos.x == 49) || (creep.pos.y == 49))
creep.moveTo(25, 25);
This is super basic and will not work is pos 25/25 is blocked or unreachable. You can replace it with advanced logic like moving towards controller or something but this should stop your creeps blinking long enough to find out whats the actual problem
-
RE: programmable branch switching
As W4rl0ck said, don't use branches, use functions and modules.
I have multiple variations of code all inside one branch and call the relevant modules based on the size of the controller in the room.
Now cleaning up your code and removing any hardcoded assumptions you've made is an entirely different thing
-
RE: is there a non-linear Game.map.getRoomLinearDistance
Thank you, strange how i managed to miss that function even though i was in the right area :s
-
is there a non-linear Game.map.getRoomLinearDistance
Hi all,
Just wondering if there's a function that can tell me how many room crossings are required to go from room A to room B.
A function that sort of works, but ignores walls and diagonals:
Game.map.getRoomLinearDistance("W48N71", "W47N71")
I would be expecting this to be 5 instead of 1, since you have to go S E E N W.
Alternatively if no such function exists can anyone point me to a function that calculates walk distance required between these two rooms.
I am trying to use my scouts to determine if a remote mining source is worth it or if a room is far enough to expand to.
Thanks,
Primoz
-
RE: GCL not moving
go to the overview page to see your gcl level progress. I think at around room level 5-6 is when you get your first upgrade btw
-
RE: Questions on roles
Welcome
Your role (if you even want to have roles) are up to you and your design. The tutorial gives a few ideas but finding the best combination of parts for each creep is up to you.
That being said, common suggestions are diggers which sit at the source and only do mining, they need a lot of work, one carry and not much move other than getting to the source.
You then have movers which travel back and forth between the diggers and your destinations (like a storage or a builder creep) and pick up from the diggers and deliver to the destination, these guys need equal carry and move and nothing else.
Then you would have your builders/upgraders which would again need a lot of work so they can get the job done quick, while the movers ensure their low/semilow carry capacity is always full.
You can always look at my setup at E31S12 for inspiration.
Hope this gets you on your way
Cheers,
Primoz
-
RE: I need help with a few things
for sources you'll probably want to use creep.harvest(sources[1]) somehow, you would need code to segment your workers between the two sources, usually easiest done with creep.memory.target = sources[1] or something similar.
for the towers i'm not sure, if it's repairing correctly it's possibly working correctly now - it could've been out of energy or more likely your code crashed due to a bug somewhere in the code. one thing i will say is that the tower will possibly be repairing instead of attacking because it checks for hostiles after it determines if it needs to repair anything.
-
RE: Need help with Repair Creep Code
if(creep.memory.reparing && creep.carry.energy == 0) { Â Â Â Â <- typo here on repaIring
Â
i suggest use console.log or creep.say to debug the execution path and find issues like this
-
RE: moveTo to NOT leave room
Thanks, though it still doesn't appear to work - am i using it correctly?
Â
creep.moveTo(sourceFlag.pos, [maxRooms = 1])
-
moveTo to NOT leave room
Hi again,
Does anyone know how to force moveTo command work ONLY in the room you're in? At the moment my creeps wish to exit the room (into a walled off area) because they think it's faster than walking through a swamp. I notice room.find has options but unsure of how I would write something for it (if possible)
creep.moveTo(sourceFlag.pos)
http://support.screeps.com/hc/en-us/articles/203079011-Room#find
Thanks,
Primoz
-
calling a failing createcreep causes memory issues
After the latest patch, the standard object cleanup code is saying that creeps are dying every so often. What I'm believing is happening is that when you call createCreep and it fails for whatever reason (namely busy), it creates a blank entry in the memory which needs to be cleaned up.
Â
for(var name in Memory.creeps) {
if(!Game.creeps[name]) {
delete Memory.creeps[name];
console.log(name + ' has died.');
}
} -
Picking up non energy drops from invaders
So i get attacked by invaders which have upgrades. When they die they drop mineral compounds such as HO or UH or whatever they are. My attackers have a single carry slot to pick these up. I'm wondering what code I need to write to have them pick this stuff up before it dissapears (since it only appears for like 10 ticks).
Â
var droppedResource = creep.pos.findInRange(FIND_DROPPED_RESOURCES, 1, {filter: {resourceType: RESOURCES_ALL.filter(function(x) { return x !== RESOURCE_ENERGY; })}})[0];
if(droppedResource)
creep.pickup(droppedResource);Â
This is what I have, but it doesn't appear to work - can anyone help?
-
RE: attacking with CLAIM
Sorry to add to my frustration, not sure if i should make a new post for this but...
Please allow to build and repair neutral structures in enemy rooms (at least roads)
-
attacking with CLAIM
Currently you can only attack an enemy controller with at least 5 CLAIM parts. This means that until you're level 7 (or 8?) you can't attack anyone controller.
Now considering how long it takes to get there, I find that people randomly spawn in my routes and then dissapear never to come back again. Unfortunately it still takes like 3-4 days before they dissapear at the speed the automatic downgrade controller works.
My suggestion would be to be able to downgrade enemy controller with a SINGLE CLAIM part, and for extra effectiveness 5 more claims after that.
If that is considered broken, at least allow low level people to fight each other somehow. For example if there are no structures or creeps of their sort left on the map, then their automatic downgrade happens faster. Or perhaps once a downgrade has happened, the next downgrade comes faster. At the moment a lvl 3 controller takes 120000 ticks.