[WIP] Scripted JSON file editor

Discussion in 'Third Party Content' started by Seven Smiles, Jan 5, 2018.

  1. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    [New release V0.6.42. I have split the data files into job files and job description files. The program works though I think the job definition files may be too easy to get wrong (editing raw JSON files is a recipe for problems caused by misplaced commas etc.). The job files are simple enough and those are the only ones you have to edit for how you want to change your rFactor set up. Have a look at the README and see what you think. I have an idea for simplifying the data files but this is it until February.]

    I keep reading posts that say "Open up notepad and edit your player.JSON..." or "Here is a screen grab of the settings to..." and decided I wanted to automate the process. It sounded simple but I struggled a bit. Anyway, the result is the ScriptedJsonEditor. The idea is that next time someone makes one of those posts they can provide a file that makes the changes (or list them so that people can cut and paste for themselves). I've provided a sample based on the recommended settings for Release 1109 (and added those from the VR thread) which you can edit to suit your needs.
    Code:
    "# Jobs provided in this file": [
    "Low end GPU",
    "Mid range GPU",
    "High end GPU",
    "VR universal",
    "VR mid range",
    "VR high end",
    "VR sound",
    "Pro driving aid settings"
    ],
     
     "# These are the ones that are executed": 0,
      "# Edit the list to suit": 0,
      "jobs": [
        "High end GPU",
        "Pro driving aid settings"
      ],
    The "jobs" specify the new settings and the file that will be edited - the old version is backed up in your temp directory with a datestamp appended (in my case, for example, c:\Users\tony\AppData\Local\Temp\ScriptedJsonEditor\player.JSON.20180105-160652). The jobs themselves are straight copies from player.JSON so you're free to edit them for yourself. My hope is that a library of job files will become available over time.

    Now that I've written it I realise it can also be used to switch between configurations - so one config file for VR, another with all the details maxed for recording replays or <shudder> playing on a monitor, another for that mod/track where the AI are so strong they disappear in the distance. Anything in player.JSON can be tweaked.

    The Python source is there but more simply you can download the current release executable.

    By editing the script it is possible to change any JSON file - one of my next tasks is to add a job to configure Controller.JSON differently for VR (e.g. "Look left/right" are no longer needed, replace them with "VR : Re-Center head position" and "Alternate Esc") and a job to switch back.
     
    Last edited: Jan 13, 2018
  2. Pauli Partanen

    Pauli Partanen Registered

    Joined:
    May 15, 2012
    Messages:
    1,091
    Likes Received:
    1,748
    Nice job!
     
  3. Corti

    Corti Registered

    Joined:
    Sep 29, 2014
    Messages:
    1,364
    Likes Received:
    2,533
    hello, download the executable and when I start the program a command window appears and disappears immediately. I do not have any folder to the path that indicates (C:\Users\Andres\AppData\Local\Temp) I guess it's because the Steam installation is on another hard drive (E:\SteamLibrary\steamapps\common\rFactor 2). Any advice, thx
     
  4. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    I think I've spotted an omission in my description, and an improvement I can make. The omission is that ScriptedJsonEditor is a command line tool so you need to open a cmd window and type
    Code:
    ScriptedJsonEditor <name of job file>
    The improvement is not to exit after printing the usage if there's no job file, that would have given you a clue o_O Or indeed, allow you to enter the job file interactively, or through a File Open dialogue like a real program!

    In your case it will have done nothing, hence nothing in your temp directory.
     
    Last edited: Jan 7, 2018
    Corti likes this.
  5. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    I'm still working on this, I revised the file format (with the aim of making it easier to use) and that broke my unit tests, now I'm having a bit of a struggle to get it working again.
     
    Corti likes this.
  6. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    New release in first post.
     

Share This Page