Navigation

    forum

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

    ako301

    @ako301

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

    ako301 Follow

    Posts made by ako301

    • RE: Use of RawMemory prevents use of Memory

      I had similar problems with RawMemory - looks like it's not supported as well as Memory object which is very easy to use:

      http://screeps.com/forum/topic/944/Working-with-raw-memory-changing-memory-via-console-UI

      posted in Technical Issues and Bugs
      ako301
    • Working with raw memory & changing memory via console/UI

      Is it possible to execute custom memory parsing in the same moment it happens for default one?

      Right now, I can only call it in main(), but there are things that access/change memory before/after main (such as console commands). 

       

      Context:

      I want to use slightly different parsing for objects in memory. It boils down to calling JSON.parse(serialized, reviver), but there is no way I can provide those functions to default serializer.

      So instead, I changed main to look like this:

      module.exports.loop = function () {
        var result = JSON.parse(RawMemory.get(), reviver);

        Object.assign(Memory, result); // this will overwrite values from Memory

        // do actual work...

        RawMemory.set(JSON.stringify(Memory, replacer)); // write changes to memory 

      }

       

      However, when I run commands in console/change memory via UI, it doesn't work. It's because those commands are appended after the loop and there isn't another RawMemory.set() call afterwards. And I need to always call RawMemory.set at the end

      posted in Technical Issues and Bugs
      ako301