Navigation

    forum

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

    TheCool

    @TheCool

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

    TheCool Follow

    Posts made by TheCool

    • RE: How exactly does {filter:} work?

      Nevermind, I figured it out. Apparently the "=>" is a way to define functions. This is the resource I used if you also want to learn.

      posted in Help
      TheCool
    • How exactly does {filter:} work?

      I'm a beginner, and in the tutorial, there is this part:

      var targets = creep.room.find(FIND_STRUCTURES, {
        filter: (structure) => {
        return (structure.structureType == STRUCTURE_EXTENSION || structure.structureType == STRUCTURE_SPAWN) &&
        structure.store.getFreeCapacity(RESOURCE_ENERGY) > 0;
      }
      

      and it's really confusing me. I don't get what format they want, what the => is for, and why it needs to return a value. If someone could break down the components that'd be greatly appreciated!

      posted in Help
      TheCool