Modding Help Getting a perfectly generic item...

Discussion in 'Starbound Modding' started by DasRonen, Dec 12, 2013.

  1. DasRonen

    DasRonen Void-Bound Voyager

    Alright, I want to start out by saying I am a mediocre programmer at best. I am trying to make a mod that adds in a "Smelter" which will allow you to smelt multiple ores at a time in it (have no idea if this is even possible yet.) But when I try to add the item in, I get a perfectly generic item instead of my smelter item. Here is the code if you feel you can find the errror:

    .object file:
    Code:
    {
      "objectName" : "smelter",
      "rarity" : "Common",
      "description" : "A smelter, useful for making metal bars.",
      "shortdescription" : "Smelter",
      "race" : "generic",
      "subtitle" : "Advanced smelting.",
      "category" : "crafting",
      "price" : "200",
      "objectType" : "container",
      "printable" : false,
    
      "apexDescription" : "A steel smelter. I can smelt ore here.",
      "avianDescription" : "A smelter perfect for smelting.",
      "floranDescription" : "Smelter hisss, ssspit, burn. Floran brave it.",
      "glitchDescription" : "Craftsmanship. The smelter is the perfect temperature for creating metal bars.",
      "humanDescription" : "A smelter. Hot.",
      "hylotlDescription" : "A hot, imposing smelter.",
    
      "lightColor" : [229, 218, 207],
      "flickerDistance" : 0.5,
      "flickerStrength" : 0.1,
    
      "particleEmitter" : {
        "emissionRate" : 1.0,
        "emissionVariance" : 0.5,
    
        "particle" : {
          "type" : "ember",
          "size" : "1.0",
          "color" : [255, 100, 0, 255],
          "light" : [150, 50, 50],
          "fade" : 0.9,
          "initialVelocity" : [0.0, 5.0],
          "finalVelocity" : [0.0, 3.0],
          "approach" : [0, 20],
          "timeToLive" : 2,
          "layer" : "middle"
        },
    
        "particleVariance" : {
          "initialVelocity" : [0.5, 2.0]
        }
      },
    
      "inventoryIcon" : "smeltericon.png",
      "orientations" : [
        {
          "dualImage" : "smelter.png:<color>.<frame>",
    
          "imagePosition" : [0, 0],
          "frames" : 4,
          "animationCycle" : 0.5,
    
          "spaceScan" : 0.1,
          "anchors" : [ "bottom" ],
    
        }
      ],
    
      "soundEffect" : "/sfx/objects/campfire.wav",
      "soundEffectRadius" : 50,
    
      "statusEffects" : [
        {
          "kind" : "Warmth",
          "amount" : 70,
          "range" : 8
        }
      ],
    
      "recipeGroup" : "stonefurnace",
      "openSounds" : [ "/sfx/objects/campfire_use.wav" ],
      "slotCount" : 2,
      "uiConfig" : "/interface/objectcrafting/smelter.config",
      "frameCooldown" : 67,
      "autoCloseCooldown" : 3600
    }
    


    .frames file:
    Code:
    {
      "frameGrid" : {
        "size" : [24, 20],
        "dimensions" : [4, 1],
        "names" : [
          [ "default.0", "default.1", "default.2", "default.3" ]
    
        ]
      },
    
      "aliases" : {
        "default.default" : "default.0"
      }
    }
    


    .recipe file:
    Code:
    {
      "input" : [
        { "item" : "steelbar", "count" : 1 },
        { "item" : "coalore", "count" : 25 },
        { "item" : "stonefurnace", "count" : 1 },
        { "item" : "money", "count" : 450 }
      ],
      "output" : {
        "item" : "smelter",
        "count" : 1
      },
      "groups" : [ "metalworkstation", "objects", "all", "tools" ]
    }
    


    I put the blueprint in the player.config correctly as well (why it shows up in the crafting menu at all). I tried looking at another mod that adds in items to see what I was doing wrong but I couldn't find anything. I am pretty sure this is all the need information. Also if anyone more experienced with coding wants to take my idea to make it work, I would be okay with it as long as I am told how it is done so I can learn in the process.

    NOTE: This is not a finished product. I had not even started on the other item slots to allow for three ore smelting.
     
  2. Silmaril.SE

    Silmaril.SE Astral Cartographer

    Don't think there should be a comma after "anchors" : [ "bottom" ], in the .object file.
     
  3. Createse

    Createse Big Damn Hero

    He's right. I'd also check your starbound.log in future. It is invaluable and will point out simple syntax errors like that.


    Code:
      "slotCount" : 2,
      "uiConfig" : "/interface/objectcrafting/smelter.config",
    
    If you're trying to smelt multiple ores at once, won't you need a few more input slots on the interface menu?
     
    Last edited: Dec 12, 2013
  4. dangerpeanut

    dangerpeanut Astral Cartographer

    This happened to me..... learning when to use commas is super important.
     
  5. DasRonen

    DasRonen Void-Bound Voyager

    createse, thank you! I forgot I removed a line after the "anchors" part. DUH! Haha. And as far as the slots go yes, I will try to add them now that the item will generate properly. However, I saw you can't change gui currently which means this mod probably isn't possible.
     
  6. srecinto

    srecinto Big Damn Hero

    User Notepad++ and set the language to "javascript" to get nice color coding of the text. The format for these is JSON (JavaScript Object Notation)

    Also you can use a free internet JSON parser to validate its properly formatted with proper data types (boolean, int, float, string) and will catch any syntax errors :)
    Here is a french one (still useable for us since all we need it for is validation)
    http://json.parser.online.fr/

    and here is another heavier one
    http://jsonviewer.stack.hu/
     
  7. spybraker

    spybraker Space Hobo

    Thank you for the logfile tip very very very helpful!!!
     
  8. Kyrosiris

    Kyrosiris Scruffy Nerf-Herder

    First step in "my custom stuff is broken" should always be to run every file through http://jsonlint.com/. ^^

    But yeah, bet you dollars to donuts that stray comma is the culprit.
     
  9. Dr. Toros

    Dr. Toros Existential Complex

    Honestly, as one amateur modder to another almost anything I do doesn't work the first time, so I have to check the log file, tweak the game, check it again, etc.
     
  10. Kyrosiris

    Kyrosiris Scruffy Nerf-Herder

    Haha, yeah, I've found myself going apoplectic at a mod behavior not working and my girlfriend always has to remind me of "did you run it through jsonlint?" or "you're missing a comma, aren't you". :p
     
  11. Dr. Toros

    Dr. Toros Existential Complex

    I'm at the point now where I prefer a simple missing comma as a reason things aren't working.

    I've been doing a lot of work on movement techs, and getting something to work the way I want it is often a coding error. I haven't figured out how to properly code in the parameters and functions I want.
     
    srecinto likes this.
  12. srecinto

    srecinto Big Damn Hero

    It also doesn't help that there is a lack of documentation on the API... not faulting the devs... I know this stuff takes time but for the rest of us, its a bit of a shot i the dark ;)
     
  13. Dr. Toros

    Dr. Toros Existential Complex

    There is a limited API in the scripts folder but it is missing a tech section.
     

Share This Page