Navigation

    forum

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

    quinten1333

    @quinten1333

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

    quinten1333 Follow

    Posts made by quinten1333

    • RE: Is there a way to download scripts

      You can run an private server and login to that server. then your scripts will be at: C:\Users\%USERNAME%\AppData\Local\Screeps\scripts\your steam name___some random number(maby port number?)

      posted in Help
      quinten1333
    • RE: Builder don't upgrade walls and ramparts

      on the english part: you made yourself clear so good job 😛

       

      on the programming part:

      you could much better filter you buildings instead of what your doing right now. il just copy my code for repairing. fully tested and it works.

       

      this code is made out of 3 the same elements:

      is an building going to decay to its destruction? yes? REPAIR NOW (repairnow will be bigger dan 0 so it will do that)

      are there no buildings decaying into destructino? are there buildings with damage? aren't they walls or ramparts? yes? okey good repair them.

      are you done repairing all except walls and rempards? okey good repair the wals and rempards.

      the thing i did with repairwall.lengt - 1 is because the ramparts come last in the list (in my game, you should replace it with 0) and they decay and walls don't. the " - 1" is because list starts with 0 and the length counts from 1.

      && means and

      || means or

      all things bevore or after 'or' must be true so: if (true && false || true) will output trou because after the or it was true. that is why i have 2 times the same checks on each side of the or when checking if the building is an wall or rampart.

       

      var repairitnow = creep.room.find(FIND_STRUCTURES, {
      filter: (structure) => {
      return (structure.hits < 650 && structure.hits > 0)
      }
      });

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

      var repairit = creep.room.find(FIND_STRUCTURES, {
      filter: (structure) => {
      return (structure.hits < structure.hitsMax && structure.hits > 0 && structure.structureType != STRUCTURE_WALL && structure.structureType != STRUCTURE_RAMPART)
      }
      });

      var repairwall = creep.room.find(FIND_STRUCTURES, {
      filter: (structure) => {
      return (structure.structureType == STRUCTURE_RAMPART && structure.hits < structure.hitsMax && structure.hits > 0 || structure.hits < structure.hitsMax && structure.hits > 0 && structure.structureType == STRUCTURE_WALL)
      }
      });

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

      if (repairwall.length > 0){
      if (creep.repair(repairwall[repairwall.length - 1]) == ERR_NOT_IN_RANGE) { //omgekeerde volgorde zodat ramparts eerst gerepaird worden
      creep.moveTo(repairwall[0]);
      }
      } else {
      roleHarvester.run(creep); // so it will alway's will be busy. DO NOT FORGET TO IMPORT(var roleHarvester = require('role.harvester');) IT 
      }
      }
      }

       

      if you have any questions i'l bookmark this post and check it a couple of times next week. 
      Hope i helped Quinten

      posted in Help
      quinten1333