# Need Help With A Code

**URL:** <https://discourse.cataclysmdda.org/t/need-help-with-a-code/20000>\
**Category:** The Toolbox\
**Tags:** mod\
**Created:** [May 8, 2019, 6:31am UTC](https://discourse.cataclysmdda.org/t/need-help-with-a-code/20000 "2019-05-08T06:31:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cool\_Dude](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/cool_dude/32/5766_2.png) [@Cool\_Dude](https://discourse.cataclysmdda.org/u/Cool_Dude)\
**Post date:** [May 8, 2019, 6:31am UTC](https://discourse.cataclysmdda.org/t/need-help-with-a-code/20000/1 "2019-05-08T06:31:25Z")

</div>

What’s Wrong With…

[  
{  
“id”: “ray\_gun”,  
“type”: “GUN”,  
“reload\_noise\_volume”: 30,  
“name”: “Ray Gun”,  
“name\_plural”: “Ray Gun”,  
“description”: “This Contraption is supremely deadly it has a note on its barrel saying US MILITARY ARMS.”,  
“weight”: 1000,  
“volume”: 4,  
“price”: 12500,  
“to\_hit”: 1,  
“bashing”: 6,  
“material”: [“steel”, “plastic”]  
“ammo”: “batteries”,  
“dispersion”: 300,  
“sight\_dispersion”: 100,  
“aim\_speed” : 5,  
“recoil”: 125,  
“durability”: 10,  
“reload”: 100,  
“loudness” : 150,  
“symbol”: “(”,  
“color”: “dark\_gray”,  
“skill”: “rifle”,  
}

]

Please tell me

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [May 8, 2019, 6:37am UTC](https://discourse.cataclysmdda.org/t/need-help-with-a-code/20000/2 "2019-05-08T06:37:27Z")

</div>

What’s wrong with it? Is it not working when you add it to the game? Any errors during loading or what?

---

<div class="post-metadata">

**Author:** ![ejseto](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@ejseto](https://discourse.cataclysmdda.org/u/ejseto)\
**Post date:** [May 8, 2019, 8:35am UTC](https://discourse.cataclysmdda.org/t/need-help-with-a-code/20000/3 "2019-05-08T08:35:46Z")

</div>

I don’t think you’re supposed to have a comma at the end of

> “skill”: “rifle”,

A comma indicates there’s another entry after it. You’re also missing a comma after

> “material”: [“steel”, “plastic”]

---

<div class="post-metadata">

**Author:** ![Cool\_Dude](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/cool_dude/32/5766_2.png) [@Cool\_Dude](https://discourse.cataclysmdda.org/u/Cool_Dude)\
**Post date:** [May 8, 2019, 8:43am UTC](https://discourse.cataclysmdda.org/t/need-help-with-a-code/20000/4 "2019-05-08T08:43:21Z")

</div>

Thank You For Your Replies!  
(i fixed it by placing  
“ammo”: “batteries”,  
“dispersion”: 300,  
“sight\_dispersion”: 100,  
“aim\_speed” : 5,  
“recoil”: 125,  
“durability”: 10,  
“reload”: 100,  
“loudness” : 150,  
“symbol”: “(”,  
“color”: “dark\_gray”,  
“skill”: “rifle”,  
before materials all fixed!)

---

<div class="post-metadata">

**Author:** ![Cool\_Dude](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/cool_dude/32/5766_2.png) [@Cool\_Dude](https://discourse.cataclysmdda.org/u/Cool_Dude)\
**Post date:** [May 8, 2019, 8:44am UTC](https://discourse.cataclysmdda.org/t/need-help-with-a-code/20000/5 "2019-05-08T08:44:18Z")

</div>

how to use ammunition (i cant seem to do it?)

---

<div class="post-metadata">

**Author:** ![Cool\_Dude](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/cool_dude/32/5766_2.png) [@Cool\_Dude](https://discourse.cataclysmdda.org/u/Cool_Dude)\
**Post date:** [May 8, 2019, 9:30am UTC](https://discourse.cataclysmdda.org/t/need-help-with-a-code/20000/6 "2019-05-08T09:30:23Z")

</div>

Also Somethings Wrong With…  
[  
{  
“id”: “ray\_gun”,  
“type”: “GUN”,  
“reload\_noise\_volume”: 30,  
“name”: “Ray Gun”,  
“name\_plural”: “Ray Gun”,  
“description”: “This Contraption is supremely deadly it has a note on its barrel saying US MILITARY ARMS.”,  
“weight”: 1000,  
“volume”: 4,  
“price”: 12500,  
“to\_hit”: 1,  
“bashing”: 6,  
“range”: 10,  
“ammo”: “batteries”,  
“ammo\_effects”: [“LASER”, “DRAW\_AS\_LINE”],  
“ranged\_damage”: -10,  
“dispersion”: 300,  
“sight\_dispersion”: 100,  
“aim\_speed” : 5,  
“recoil”: 125,  
“durability”: 10,  
“reload”: 100,  
“loudness” : 150,  
“symbol”: “(”,  
“color”: “dark\_gray”,  
“skill”: “rifle”,  
“material”: [“steel”, “plastic”],  
“magazines”: [“battery”, [ “light\_battery\_cell”] ]  
}  
]

the game says:  
DEBUG : Error: data/mods//Custom Mod/gun.json: line 30:3: expected JSON value but got ‘}’

```
"material": ["steel", "plastic"],
"magazines": ["battery", ["light_battery_cell"]

```

}  
^

10]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

FUNCTION : bool main\_menu::load\_character\_tab()  
FILE : src/main\_menu.cpp  
LINE : 975

---

<div class="post-metadata">

**Author:** ![ejseto](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@ejseto](https://discourse.cataclysmdda.org/u/ejseto)\
**Post date:** [May 8, 2019, 1:27pm UTC](https://discourse.cataclysmdda.org/t/need-help-with-a-code/20000/8 "2019-05-08T13:27:18Z")

</div>

> “magazines”: [“battery”, [“light\_battery\_cell”]

You’re missing another set of . Copy it from a working item to see what it’s supposed to look like.

---

<div class="post-metadata">

**Author:** ![TheMurderUnicorn](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/themurderunicorn/32/5706_2.png) [@TheMurderUnicorn](https://discourse.cataclysmdda.org/u/TheMurderUnicorn)\
**Post date:** [October 13, 2019, 3:57am UTC](https://discourse.cataclysmdda.org/t/need-help-with-a-code/20000/10 "2019-10-13T03:57:20Z")

</div>

Mm-kay. This is a five month old thread. And your post doesn’t really have anything to do with it.

You were given advice in the other thread. Good advice. Read your error message.

It’s expecting a string, which was explained as anything in a `"`. Instead, it’s finding a `]` which it doesn’t like. As for why it’s expecting a string, I don’t know I can’t really read what you’re posting because it’s all messed up.

I recommend you copy an existing mapgen and then make edits to it, rather than trying to do it yourself. Everything in your “rows” section is all messed up.

Copy an existing location and start over is my recommendation. Also, check the guide to creating content that Mark linked you, the mapgen stuff is [here](https://github.com/CleverRaven/Cataclysm-DDA/wiki/Guide-to-adding-new-content-to-CDDA-for-first-time-modders:-New-Locations).
