Navigation

    forum

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

    Harcole

    @Harcole

    2
    Posts
    806
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Harcole Follow

    Posts made by Harcole

    • RE: Repair Containers?

      Thank you, you were correct I was missing brackets which was causing some confusion. 🙂

      For reference to someone in the future looking at this, I should have brackets after the return up till && as below:

       

      {filter: function(object){ return (object.structureType === STRUCTURE_ROAD || object.structureType === STRUCTURE_CONTAINER) && (object.hits < object.hitsMax); }

      posted in Help
      Harcole
    • Repair Containers?

      Hi noob to the game but loving it so far!

      Maybe a silly question but when ever I attempt to repair a container I get error code -7 (Invalid Target) are you not able to repair them or am I doing something stupid?

       

      var repTarget = creep.room.find(FIND_STRUCTURES, {filter: function(object){ return object.structureType === STRUCTURE_ROAD || object.structureType === STRUCTURE_CONTAINER && (object.hits < object.hitsMax); } });

      if (repTarget.length > 0)
      {
      if(creep.repair(repTarget[0]) == ERR_NOT_IN_RANGE)
      {
      creep.moveTo(repTarget[0]);
      }
      }

      posted in Help
      Harcole