I am trying to write this item as a weapon I can use in battles along with armor for a text based rpg.
"bronze_sword": {
"name": "Bronze Sword",
"type": "weapon",
"atk": "3",
"examine": "A shiny bronze sword.",
},
"turian_garb": {
"name": "Turian Garb",
"type": "Armour",
"def": "1",
"examine": "Your combat uniform.",
}
######################
inventory = [""]
tutorial_chest1 = ["bronze_sword", "turian_garb"]
"Invalid Syntax" Errors appear when adding a comma (pointing to the comma), and when removed the name of the dictionary shows "Illegal target for annotation". Please consider that I am new to code in general, and this is my first proper project.
CodePudding user response:
Decalre a variable dicts
and initialize a dictionary first with curly braces.
dicts={"bronze_sword": {
"name": "Bronze Sword",
"type": "weapon",
"atk": "3",
"examine": "A shiny bronze sword.",
},
"turian_garb": {
"name": "Turian Garb",
"type": "Armour",
"def": "1",
"examine": "Your combat uniform.",
}}
OR without initialize a variable make dictionary with curly braces like this
{"bronze_sword": {
"name": "Bronze Sword",
"type": "weapon",
"atk": "3",
"examine": "A shiny bronze sword.",
},
"turian_garb": {
"name": "Turian Garb",
"type": "Armour",
"def": "1",
"examine": "Your combat uniform.",
}}