You cannot add function to Memory. If you want to add logging ability to your creep please extend Creep prototype   Creep.prototype.log = function(msg) {     console.log(this.name + ' ' + msg); }; // Then you can use this in your code Game.creeps['Dylan'].log('something');