Oooooh, there's a Memory object outside of the creeps.memory. Didn't know that. TY guys!
Posts made by Yulgalminakf
-
RE: Storing a variable callable from several different creeps.
-
RE: Storing a variable callable from several different creeps.
MyrddinE, the problem I have with that is it seems that the variables stored in the modules, don't save from frame to frame. They're initialized each and every tick with their default value.
//dispatcher.constructionSites
var currConstSite = "invalid";
var dispatcherConstructionSites = {
GetConstructionSite: function(room){currConstSite = //code to evaluate construction site here.
}
}
module.exports = dispatcherConstructionSites;//role.builder
var dispatcherConstructionSites = require('dispatcher.constructionSites');
var roleBuilder = {
run: function(creep) {var constSite = dispatcherConstructionSites.GetConstructionSite();
}
}
This function gives back "invalid" each and every single time I call it. It's as if the variable is never even being set at all.
The problem is, I'm fluent in C++, but for some reason, I'm lost in Java a lot.
-
Storing a variable callable from several different creeps.
How can I store a variable so that multiple creeps (even of different roles in different modules) can all see it? So far, the only things I can do, I have to re-calc every single tick, and that's incredibly in-efficient.