Navigation

    forum

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

    Posts made by brento73

    • RE: roleFixer not defined

      Thanks, yeah, I was missing that 'require' at the beginning of the main. 

      posted in Help
      brento73
    • roleFixer not defined

      I'm trying to make a creep to go around repairing structures, and I'm having this issue:

       

      I create a module

      role.fixer

      which has this:

      var roleFixer = {

      /** @param {Creep} creep **/
      run: function(creep) {

      //code to fix things
      }
      };

      module.exports = roleFixer;

       

      When I put the following in my main:

       

      if(creep.memory.role == 'fixer') {
      roleFixer.run(creep);
      }

      I get this error:

       

      ReferenceError: roleFixer is not defined
      at Object.module.exports.loop (main:59:13)
      at __mainLoop:1:52

       

      What am I doing wrong? The role.fixer module looks the same as my other roles, so I can't figure out why it's not 'defined'.

      posted in Help
      brento73