Navigation

    forum

    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    1. Home
    2. Donatzor
    • Flag Profile
    • block_user
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Groups
    • Blog

    Donatzor

    @Donatzor

    101
    Posts
    1929
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Donatzor Follow

    Posts made by Donatzor

    • RE: Nooby issues trying to get my creeps to move by a path written to memory

      Greetings,

      Even without a generated error, functions in screeps will return an ERR_ code or an OK when run, this assists in the debugging process. So your creep.moveByPath(Memory.sourcePath1) should be returning a code other than OK.

      https://docs.screeps.com/api/#Creep.moveByPath has a table showing all the codes that can return, and what they mean.

      My guess is that you are calling Memory.sourcePath1 instead of creep.memory.sp1 * because from the first code, it looks like you set the paths to the creep's memory, not just the Memory object itself (unless you've done this somewhere not displayed in your post)

      As a side note, if the creep does not start on/adj to a step on your path (depending on how your path was generated) then you will likely get ERR_NOT_FOUND as they moveByPath() fails to find where it is on the path.

      Would recommend checking out Screep's Discord server, its a bit more dynamic and faster to get assistance, normally some one around can help in #world-help.

      If you don't like discord, would recommend checking out:

      https://docs.screeps.com/debugging.html

      https://wiki.screepspl.us/index.php/Basic_debugging

      https://wiki.screepspl.us/index.php/A_brief_guide_to_reading_the_Screeps:World_API_Documentation

      posted in Help
      Donatzor
    • RE: Question attacking hostile creeps

      a .find() will return an array see https://docs.screeps.com/api/#Room.find

      while .attack() requires an object (specificlly, a Creep, Structure, or PowerCreep) to be passed to it https://docs.screeps.com/api/#Creep.attack

      Need to select one-target from the array, I am surprised though that the creep was moving towards it, as moveTo() should also require a specific target.

      Side note, a find call would return an empty array if nothing was found, so your first if would still clear even with no targets. Need to check .length or other methods to determine targets exist.

      Would recommend https://wiki.screepspl.us/index.php/A_brief_guide_to_reading_the_Screeps:World_API_Documentation and also checking out the Discord as its a bit faster / more dynamic to get feedback and answers to questions.

      posted in Help
      Donatzor
    • RE: Memory resets every tick in simulation

      Hm. I am not sure, Sim does react differently then the MMO or private server does, but not quite to that degree I thought, would try this on the MMO or a private server and see if you get the same result

      posted in Help
      Donatzor
    • RE: Memory resets every tick in simulation

      I would presume that Memory.firstSpawnId != Game.spawns['Spawn1'].id is failing you somehow as it shouldn't execute if false. Would instead simply try checking if firstSpawnId exists, then not run your setup code if that's the case. Or alternatively, set a boolean like you have with newgame in Memory and check for that, if its there, return early out of the function (no need to do any further checks)

      Would also highly recommend checking out screep's discord, more dynamic help.

      posted in Help
      Donatzor
    • RE: findClosestByPath returns an object, but can't find the path

      Looks like Marvin was helping you out on the discord, so assume that's the same challange you were having.

      @Tobyers findClosestByPath returns one object from a find constant search or an array of objects, whatever object is closest by all resulting paths searched to all objects. Your likely thinking of room.find() which returns an array, which then you have to pick one object from it.

      posted in Help
      Donatzor
    • RE: New "Prioritize" setting for construction sites?

      Ah. Then the forums are indeed the best resource indeed.

      posted in Feature Requests
      Donatzor
    • RE: New "Prioritize" setting for construction sites?

      Well, as mentioned the #World-Help section of the discord is a pretty dynamic/active place to get assistance with learning the ropes.

      posted in Feature Requests
      Donatzor
    • RE: New "Prioritize" setting for construction sites?

      This is all quite achievable though code, when your creep is searching for / selecting a construction site (or the manager you've created to assign goals to creeps) you can prioritize/filter/arrange the data in any manner that you'd like. I suppose, feature wise UI you 'could' do it where it reassigns the Game.constructionsites object for the selected construction site to be first in the array, but not sure how feasible that is, and that may not work for everyone.

      Some quick examples, is when your builder creep is selecting/getting assigned a construction site, you can first check to see if any towers or specific types of buildings are in the array/object then if they are, use that element and ignore the rest, if not, then proceed with whatever.

      I'd highly recommend checking out the World:Help section of the Screep's Discord, folks are normally very helpful and its a bit more dynamic/faster than the forums.

      posted in Feature Requests
      Donatzor
    • RE: Picking up dropped energy

      As far as I am aware, you can not aggregate find calls in this manner, the parameter for the find accepts ONE OF the find constants, not multiple.

      From the API: One of the FIND_* constants.

      You can look at the engine code for it here as well (for private servers but likely how it operations on the MMO as well) https://github.com/screeps/engine/blob/master/src/game/rooms.js#L584

      If you want to link the results of multiple find calls into one aggerate array you can combine the two arrays or spread the find calls out over one array, then find as you see fit.

      For example you can use the spread operator with two calls to have one array let sources = [ ...creep.room.find(FIND_TOMBSTONES), ...creep.room.find(FIND_DROPPED_RESOURCES)]

      Which should result in one array, with objects from both find calls. You can read about the spread syntax here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax

      To be clear as well, for dropped resources you use pickup to gather the energy so even if it was finding dropped resources, harvest/withdraw would not apply (see API: https://docs.screeps.com/api/#Creep.pickup)

      Hope that helps, elsewise would highly suggest that you check out the Screep's discord. Its a little more dynamic than the forums for finding solutions / requesting code assistance.

      posted in General Discussion
      Donatzor
    • RE: cpu.getUsed() negative result?

      Perhaps I'm missing it, but I don't see where you have this in your code, I don't see it in your main, main ops, utils or other locations on the github you provided.

      Its also unlikely you should be getting over ~500 as a result from any getUsed() I'd presume do to you should be cut off at that point. Is it possible you are storing your cpuUsed/cpuStart over multiple ticks in the heap? For example, if you declare before your main runs cpuStart and use it over multiple ticks and/or also adding/subtracting to it somewhere if the ref is still live?

      posted in Technical Issues and Bugs
      Donatzor