Navigation

    forum

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

    Posts made by Dias_Negros

    • RE: Problems with finding containers

      just make Ctrl+C Ctrl+V and change creep. for Game.creeps('nameOfACreep').

      posted in Help
      Dias_Negros
    • RE: Problems with finding containers

      But when i make

      var storePlaces = creep.room.find(FIND_STRUCTURES, {
                  filter: (i) => {return
                      (i.structureType == STRUCTURE_CONTAINER &&
                      i.store[RESOURCE_ENERGY] == 2000)}}).length;

      I'm storing just a number, exactly, the lenght of the .find array; not an object.

      posted in Help
      Dias_Negros
    • RE: Problems with finding containers

      So, that explains why I get 0 in the memory, but not why my code isn't working as expected. I only use that variables to seek the values while executing.

      Now I tried to execute most of the code line by line in the console and works exactly as expected, but I have found something interesting.

      once storePlaces.lenght returns 3, for example, I use this to change the value of the var targets with this code:

      if (targets == null && storePlaces > 1) {
                 targets = creep.room.storage;
              }

      This code makes creeps to do nothing, but this one starts working as expected.

      if (targets == null /*&& storePlaces > 1*/) {
                 targets = creep.room.storage;
              }

      Also if I make :

      if (targets == null && storePlaces > -1) {
                 targets = creep.room.storage;
              }

      creep works again, so I can guess that the problem is that

      var storePlaces = creep.room.find(FIND_STRUCTURES, {
                  filter: (i) => {return
                      (i.structureType == STRUCTURE_CONTAINER &&
                      i.store[RESOURCE_ENERGY] == 2000)}}).length;

      Always return 0 in the script, but the correct value if use in the console

      posted in Help
      Dias_Negros
    • Problems with finding containers

      Hi, I'm having some problems to get some code work. I need to make an array, and get the lenght of how many full containers do I have on the creep's room, so I use this code:

      var storePlaces = creep.room.find(FIND_STRUCTURES, {
                  filter: (i) => {return
                      (i.structureType == STRUCTURE_CONTAINER &&
                      i.store[RESOURCE_ENERGY] == 2000)}}).length;

       

      using that code in the console results as expected, using Game.creeps['creepname'].room...,

       

      But when I also make: creep.memory.places = storePlaces , it always gets 0 on the creeps memory, so I can't use that code. Any ideas?

      posted in Help
      Dias_Negros