Modding Help "(TraversalException) Could not find "0" to remove"

Discussion in 'Starbound Modding' started by Littleman9Mew2, Sep 19, 2016.

  1. Littleman9Mew2

    Littleman9Mew2 Zero Gravity Genie

    THIS IS DRIVING ME CRAZY!
    Ok, now I'm trying to add a new tab into the inventory and the game is being an absolute pain in the [butt], every time I load up the game I keep getting the error above.

    I've tried to make it so the "path" went to "/inventoryFilters/-" then it gave me the error above (with a "-" instead) then a "/inventoryFilters/0" and gave me the SAME error, I then go without any hope left in the "patching" system and tried "/inventoryFilters/" and yeah, no luck.



    The code here:

    This is the game inventory unmodified:
    Code:
      "inventoryFilters" : {
    
        "mainBag" : {
          "typeBlacklist" : [ "material", "liquid", "object" ],
          "tagBlacklist" : [ "reagent" ],
          "categoryBlacklist" : [ "cookingIngredient", "preparedFood", "food", "drink", "seed", "foodJunk" ]
        },
        "materialBag" : {
          "typeWhitelist" : [ "material", "liquid" ]
        },
        "objectBag" : {
          "typeWhitelist" : [ "object" ],
          "categoryBlacklist" : [ "seed" ]
        },
        "reagentBag" : {
          "tagWhitelist" : [ "reagent" ]
        },
        "foodBag" : {
          "categoryWhitelist" : [ "cookingIngredient", "preparedFood", "food", "drink", "seed", "foodJunk" ]
        },
        "autoAddToCustomBar" : {
          "typeWhitelist" : [ "liquid", "material", "object", "miningtool", "flashlight", "harvestingtool", "tillingtool", "consumable", "blueprint", "codex", "instrument", "thrownitem", "unlockitem", "activeitem" ],
          "categoryBlacklist" : [ "food" ]
        }
      }
    This is my patch to add a filter to my inventory:
    Code:
    {
    
        "op":"replace",
        "path":"/inventoryFilters/-",
        "value":
                {
                "mainBag" :
                    {
                    "typeBlacklist" : [ "material", "liquid", "object" ],
                    "tagBlacklist" : [ "reagent" ],
                    "categoryBlacklist" : [ "cookingIngredient", "preparedFood", "food", "drink", "seed", "foodJunk" ]
                    },
                "materialBag" :
                    {
                    "typeWhitelist" : [ "material", "liquid" ]
                    },
                "objectBag" :
                    {
                    "typeWhitelist" : [ "object" ],
                    "categoryBlacklist" : [ "seed" ]
                    },
                "reagentBag" :
                    {
                    "tagWhitelist" : [ "reagent" ]
                    },
                "foodBag" :
                    {
                    "categoryWhitelist" : [ "cookingIngredient", "preparedFood", "food", "drink", "seed", "foodJunk" ]
                    },
                "autoAddToCustomBar" :
                    {
                    "typeWhitelist" : [ "liquid", "material", "object", "miningtool", "flashlight", "harvestingtool", "tillingtool", "consumable", "blueprint", "codex", "instrument", "thrownitem", "unlockitem", "activeitem" ],
                    "categoryBlacklist" : [ "food" ]
                    },
                "l9m2Bag" :
                    {
                    "tagWhitelist" : [ "l9m2" ]
                    }
                }
        }





    Now another thing:
    How in the [world] can I add something like
    Code:
                "l9m2Bag" :
                    {
                    "tagWhitelist" : [ "l9m2" ]
                    }


    Inside the "inventoryFilters" without replacing the entire thing? It gives me an error stating that the argument needs '{' to work, but it wont work if I do that anyway since it will look like the stuff inside the spoiler and wont work due to it being in brackets. and NO, the (lol insanely) old patching tutorial doesn't cover this situation.

    Wth, the spoiler system on this is broken, "oh you put spoiler here, lets add three just to be sure!"

    asdf
    Code:
    "inventoryFilters" : {
    {
              "l9m2Bag" :
                    {
                    "tagWhitelist" : [ "l9m2" ]
                    }
    },[/SIZE]
    "mainBag" : {
          "typeBlacklist" : [ "material", "liquid", "object" ],
          "tagBlacklist" : [ "reagent" ],
          "categoryBlacklist" : [ "cookingIngredient", "preparedFood", "food", "drink", "seed", "foodJunk" ]
        },
        "materialBag" : {
          "typeWhitelist" : [ "material", "liquid" ]
        },
        "objectBag" : {
          "typeWhitelist" : [ "object" ],
          "categoryBlacklist" : [ "seed" ]
        },
        "reagentBag" : {
          "tagWhitelist" : [ "reagent" ]
        },
        "foodBag" : {
          "categoryWhitelist" : [ "cookingIngredient", "preparedFood", "food", "drink", "seed", "foodJunk" ]
        },
        "autoAddToCustomBar" : {
          "typeWhitelist" : [ "liquid", "material", "object", "miningtool", "flashlight", "harvestingtool", "tillingtool", "consumable", "blueprint", "codex", "instrument", "thrownitem", "unlockitem", "activeitem" ],
          "categoryBlacklist" : [ "food" ]
        }
      }
    
    
     
  2. MCantus

    MCantus Void-Bound Voyager

    JSON patch is not something that changes with age afaik. It's a concept built into json files, not starbound specific.
    I don't know what tutorial you're following, but all you really need is http://jsonpatch.com/ for basics.

    You're doing something extremely confusing to me right now:

    "op":"replace",
    Why replace when you can do "op":"add"?

    "path":"/inventoryFilters/-",
    This doesn't work with dictionaries, this is meant for arrays.

    To answer your question, to add what you want to here, all you need is:

    {
    "op":"add",
    "path":"/inventoryFilters/l9m2Bag",
    "value":
    {
    "tagWhitelist" : [ "l9m2" ]
    }
    }

    But I would suggest getting a better grasp on syntax before continuing.
     
  3. Littleman9Mew2

    Littleman9Mew2 Zero Gravity Genie

    This is quite new for me in the JSON format as I used it and never had to used .patch ever. Honestly I didn't know that .patch was a JSON thing, I thought it was a "Starbound" thing. Thanks for the tip! I got that section all done and dusted (i hope) but now I hit a snag with "playerinventory.config".

    So I have this here patch section:
    Code:
        {
        "op": "add",
        "path": "/paneLayout/gridModeSelector/buttons/-",
        "value":
            {
            "baseImage" : "/interface/inventory/bigl9m2.png:base",
            "baseImageChecked" : "/interface/inventory/bigl9m2.png:baseChecked",
            "pressedImage" : "/interface/inventory/bigl9m2.png:pressed",
            "pressedImageChecked" : "/interface/inventory/bigl9m2.png:pressedChecked",
            "position" : [112, 2],"data" : "showl9m2Grid",
            "pressedOffset" : [0,0]
            }       
        }
    
    
    And I'm trying to now put it inside this array:

    Code:
    "paneLayout":{
        "gridModeSelector" : {
          "type" : "radioGroup",
          "position" : [5, 109],
    
          "buttons" : [
            {
              "id" : 0,
              "baseImage" : "/interface/inventory/bigbag.png:base",
              "baseImageChecked" : "/interface/inventory/bigbag.png:baseChecked",
              "pressedImage" : "/interface/inventory/bigbag.png:pressed",
              "pressedImageChecked" : "/interface/inventory/bigbag.png:pressedChecked",
              "position" : [4, 2],
              "data" : "showMainGrid",
              "selected" : true,
              "pressedOffset" : [0,0]
            },
            {
              "baseImage" : "/interface/inventory/bigcart.png:base",
              "baseImageChecked" : "/interface/inventory/bigcart.png:baseChecked",
              "pressedImage" : "/interface/inventory/bigcart.png:pressed",
              "pressedImageChecked" : "/interface/inventory/bigcart.png:pressedChecked",
              "position" : [31, 2],
              "data" : "showTileGrid",
              "pressedOffset" : [0,0]
            },
            {
              "baseImage" : "/interface/inventory/bigobj.png:base",
              "baseImageChecked" : "/interface/inventory/bigobj.png:baseChecked",
              "pressedImage" : "/interface/inventory/bigobj.png:pressed",
              "pressedImageChecked" : "/interface/inventory/bigobj.png:pressedChecked",
              "position" : [58, 2],
              "data" : "showObjectGrid",
              "pressedOffset" : [0,0]
            },
            {
              "baseImage" : "/interface/inventory/bigrea.png:base",
              "baseImageChecked" : "/interface/inventory/bigrea.png:baseChecked",
              "pressedImage" : "/interface/inventory/bigrea.png:pressed",
              "pressedImageChecked" : "/interface/inventory/bigrea.png:pressedChecked",
              "position" : [85, 2],
              "data" : "showReagentGrid",
              "pressedOffset" : [0,0]
            },
            {
              "baseImage" : "/interface/inventory/bigfood.png:base",
              "baseImageChecked" : "/interface/inventory/bigfood.png:baseChecked",
              "pressedImage" : "/interface/inventory/bigfood.png:pressed",
              "pressedImageChecked" : "/interface/inventory/bigfood.png:pressedChecked",
              "position" : [112, 2],
              "data" : "showFoodGrid",
              "pressedOffset" : [0,0]
            }
          ]
    }
    
    The good news is that the game doesn't crash, so that's a plus? Bad news is that the game throws this one error and in turn, makes the graphics not able to load:
    Code:
    [03:29:58.128] [Error] Could not apply patch from source: ..\mods\l9m2mod.  Caused by: (JsonPatchException) Could not apply patch to base. (JsonPatchException) Could not apply operation to base. (TraversalException) No such key 'gridModeSelector' in pathApply("/gridModeSelector/buttons/-")
    
    I'm trying to add that code into an existing array, so I feel like I'm close to getting it right. I know that the destinations match (to an extent of my knowledge).

    I just want a new tab in my Inventory so I can put mod crap in it. ;-;
     
  4. MCantus

    MCantus Void-Bound Voyager

    The syntax seems correct, other than you're missing a few fields. Some of the non-accessible script files might demand that all of the fields be present since it generates things dynamically, I don't know why here it won't let you access that key though.
     
  5. Littleman9Mew2

    Littleman9Mew2 Zero Gravity Genie

    Does the order at which the different segments of the patch file apply? I have it at the bottom, so I'll move it around if it does anything (I don't have any test operations)

    Ok so messing with the order didn't get me anywhere, so I restored the file back to the stable ordered state and now the game is crashing with same BS error I had after I messed with the order. Failed to find itemgrid callback named: 'l9m2ItemGrid'

    WTF, how can the file, which was UNMODIFIED AND DIDN'T CRASH MY GAME
    NOW crashes the game AFTER I made changes and RESET IT BACK TO STABLE STATE?

    A=works somewhat, ok now go to b
    B=Doesn't work, ok back to a
    A=doesn't work anymore

    The inventory file is F'd up.
     
    Last edited: Sep 22, 2016

Share This Page