Which file can i send with all my keymappings?

Discussion in 'Mod Discussions' started by Schulti, December 27, 2013.

  1. Schulti

    Schulti Active Member

    Messages:
    226
    Likes Received:
    56
    Hello, is there a single file in the PA folder which contains all the keymapping (especially the hotbuild mod). i want to send them to a friend.
    thx
  2. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    %LOCALAPPDATA%\Uber Entertainment\Planetary Annihilation\localstore\

    that folder contains all settings of PA, copy it. It should work. Never tried it so far though.

    Ofc you also need to install hotbuild(2?) in addition to that.
  3. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    That should work
  4. SXX

    SXX Post Master General

    Messages:
    6,896
    Likes Received:
    1,812
    Only if you actually send it to friend. Contents of "localstore" contain some private sensitive information as well, so don't make it public.
  5. Schulti

    Schulti Active Member

    Messages:
    226
    Likes Received:
    56
    Yes, sounds good. Thank you all!
  6. ORFJackal

    ORFJackal Active Member

    Messages:
    287
    Likes Received:
    248
    It should be possible to write a script that you could run in the debugger to export and import stuff in the local storage. Or maybe there is an existing tool to open a web browser's local storage outside the browser (PA's UI is technically a web browser). Time to use google...
  7. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Or maybe using ajax to submit that data in a mod to some server.
    But don't plan to set up a server but if anybody is willing to I will put a share button in hotbuild that sends your mapping trough ajax to somewhere.
  8. ORFJackal

    ORFJackal Active Member

    Messages:
    287
    Likes Received:
    248
    You can see the local storage contents in the UI debugger's Resources tab under "Local Storage".

    Run the following script in the debugger's console to export the keybindings:

    Code:
    (function () {
      var exported = {};
      for (var key in localStorage) {
        if (localStorage.hasOwnProperty(key) && key.indexOf('keybinding') === 0) {
          exported[key] = localStorage[key];
        }
      }
      console.log(JSON.stringify(exported, null, 2));
    })();
    
    Send the resulting JSON to the other user and tell him to run the following script in the debugger's console, of course with the dummy data replaced with the data from the export:

    Code:
    (function () {
      var imported = {'foo': 'bar'}; // replace with data from export
      for (var key in imported) {
        if (imported.hasOwnProperty(key)) {
          localStorage[key] = imported[key];
        }
      }
    })();
    
    Use at your own risk.

    P.S. Would somebody like to write a plugin for importing and exporting settings inside PA's settings screens?
    stormingkiwi likes this.
  9. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    I think it could become handy as more and more mods will be storing stuff in settings.
  10. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    What is the advantage over simply copying the localstorage files?
  11. ORFJackal

    ORFJackal Active Member

    Messages:
    287
    Likes Received:
    248
    That way you don't need to replace all settings. For example systems you have created are also saved in local storage - which brings to my mind that an UI for copying individual systems would be nice as well. Currently you can copy systems by editing the local storage's systems entry directly in the debugger.
  12. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Ah I just realized you only copy "keybinding" things. Yeah makes sense in that case.

Share This Page