Navigation

    forum

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

    Posts made by Durzo

    • RE: First attempt at logic to automate creep creation

      as an FYI - i kinda got this to work... the script runs but now its just not working... i dont think my increment is appending correctly and im having duplicate creeps.

      var hc = 0;
      var uc = 0;
      var bc = 0;
      
      if(!Game.spawns.Spawn1.spawning) {
      
          if (Game.spawns.Spawn1.room.find(FIND_MY_CREEPS, { filter: function(creep){ return creep.memory.role == 'harvester'; }}).length < 3)
              Game.spawns.Spawn1.createCreep( [WORK, CARRY, MOVE], 'Harvester' + ++hc, { role: 'harvester' } );
      
          else if (Game.spawns.Spawn1.room.find(FIND_MY_CREEPS, { filter: function(creep){ return creep.memory.role == 'upgrade'; }}).length < 3)
              Game.spawns.Spawn1.createCreep( [WORK, CARRY, MOVE], 'Upgrade' + ++uc, { role: 'upgrade' } );
      
          else if (Game.spawns.Spawn1.room.find(FIND_MY_CREEPS, { filter: function(creep){ return creep.memory.role == 'harvester'; }}).length < 6 && 
                   Game.spawns.Spawn1.room.find(FIND_MY_CREEPS, { filter: function(creep){ return creep.memory.role == 'upgrade'; }}).length >= 3)
              Game.spawns.Spawn1.createCreep( [WORK, CARRY, MOVE], 'Harvester' + ++hc, { role: 'harvester' } );
      
          else if (Game.spawns.Spawn1.room.find(FIND_MY_CREEPS, { filter: function(creep){ return creep.memory.role == 'builder'; }}).length > 1)
              Game.spawns.Spawn1.createCreep( [WORK, WORK, CARRY, MOVE], 'Builder' + ++bc, {role: 'builder'} );
      
      }
      

      Still trudging through - i have to admit im really enjoying this process....

      posted in Help
      Durzo
    • First attempt at logic to automate creep creation

      Hey Guys -
      I have been making alot of progress with my game, I now have functions that do all the roles I currently need. But now im trying to automate creep creation and im struggling.

      Heres the code im using:

      var hc = 0;
      var uc = 0;
      var bc = 0;
      
      while ( Games.creeps < 10 ){
          if (Memory.role.'harvester' < 3)
              Game.spawns.Spawn1.createCreep( [WORK, CARRY, MOVE], 'Harvester[hc++]', { role: 'harvester' } );
          else if (Memory.role.'upgrade' < 3)
              Game.spawns.Spawn1.createCreep( [WORK, CARRY, MOVE], 'Upgrade[uc++]', { role: 'upgrade' } );
          else if (Memory.role.'builder' < 1)
              Game.spawns.Spawn1.createCreep( [WORK, WORK, CARRY, MOVE], 'Builder[bc++]', {role: 'builder'} );
          else if (Memory.role.'harvester' < 5 && Memory.role.'upgrade' == 2 && Memory.role.'builder' == 1)
              Game.spawns.Spawn1.createCreep( [WORK, CARRY, MOVE], 'Harvester[hc++]', { role: 'harvester' } );
      }
      

      Not looking for a hand out but if someone could point me in the right direction, it would be greatly appreciated!

      Sorry for all the nooby questions as i struggle through it...

      posted in Help
      Durzo
    • Silly question for you pros

      Hi All - I am new to JS - as indicated from a previous post. I simply decided that I would fumble my way through the same, all the while taking the JS Codeacademy course.

      That said im running into the following issue when trying to commit 'Worker1' to memory, to be used in my role later.

      Game.creeps.Worker1.memory.role = 'harvester';
      harvester
      console.log(Memory.creeps.Worker1.role);
      [3:22:24 PM]harvester
      undefined

      how can it be 'harvester' AND undefined?

      ...again sorry for the seemingly trivial question, any help is very appreciated!

      posted in Help
      Durzo
    • New to everything

      Hi All - I have my CS degree and have been in the field for some time now, but not doing development. Development has always been my weakest point of CS (try not to laugh), so i thought this would be a good way to incentivise me to continue to learn.

      However as i started the tutorial and read some of the comments, tips and tricks...etc. I realized that I'm woefully in-equip to do some of the basics you lot are already doing.

      As someone who starting with essentially HS level coding experience and hasn't coded in oh 10 years or so, where do you suggest I start to be somewhat successful when I begin? Thank you very much in advance!

      posted in Help
      Durzo