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
Primoz56
@Primoz56
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