Modding Help Help please with this code

Discussion in 'Starbound Modding' started by matthew57778, Jun 15, 2016.

  1. matthew57778

    matthew57778 Phantasmal Quasar


    {
    "commandName" : "upgradeBeamaxe1",
    "onlyOnce" : true,
    "icon" : "beamaxe.png",
    "actions" : [
    {
    "action" : "UpdatePlayerEssentialItem",
    "itemsRequired" : [ ["manipulatormodule", 1] ],
    "parameters" : {
    "tileDamage" : 1.8,
    "minBeamJitter" : 0.1,
    "maxBeamJitter" : 0.2
    },
    "essentialItem" : "beamaxe"
    },
    {
    "action" : "DisableCommand",
    "command" : "upgradeBeamaxe1"
    },
    {
    "action" : "EnableCommand",
    "command" : "upgradeBeamaxe2"
    }
    ],

    "speciesText" : {
    "default" : {
    "buttonText" : "Upgrade M. M. - Power",
    "selectSpeech" : [
    {
    "animation" : "talk",
    "text" : "^white;With ^orange;1 manipulator module^white;, I can upgrade your matter manipulator to ^green;increase its mining power a bit^white;. You should be able to ^green;find some by exploring!^green;",
    "speedModifier" : 1.0
    }
    ],
    "successSpeech" : [
    {
    "animation" : "talk",
    "text" : "^white;Success! Your matter manipulator has been upgraded with ^green;increased mining power!^green;",
    "speedModifier" : 1.0
    }
    ],
    "failSpeech" : [
    {
    "animation" : "talk",
    "text" : "^white;Failure. We'll need ^orange;a manipulator module ^white;to complete this upgrade.",
    "speedModifier" : 1.0
    }
    ]
    }
    }
    }



    [{"op": "replace","path":"/actions/itemsRequired","value": [ 2 ] } ]


    can i not use patch to replace the required items to be 2 or so or am i doing the code for it wrong? please help me understand json patch more.
     
  2. The | Suit

    The | Suit Agent S. Forum Moderator

    First make sure your patch is even valid, easiest way to do that is this website.
    http://json-schema-validator.herokuapp.com/jsonpatch.jsp

    Data = Original file

    Patch = Patch code.


    But ill give you a basic hint that the way you put path and value are wrong.
    There are 2 values in that original bracket, the program will not know which one you want to replace.
     
  3. matthew57778

    matthew57778 Phantasmal Quasar

    Yea i tried everything and nothing worked how do i do double brackets with json patching?
     
  4. lazarus78

    lazarus78 The Waste of Time

    http://chbrown.github.io/rfc6902

    I like this site. Put in the original code then the code as you want it, then it will generate the patch code for it.

    I. Your case, the patch should look like this:
    Code:
    [
      {
        "op": "replace",
        "path": "/actions/0/itemsRequired/0/1",
        "value": 2
      }
    ]
    
     
  5. matthew57778

    matthew57778 Phantasmal Quasar

    hmm let me try that.
     

Share This Page