Something to note is that the game randomly switches between American English and British English for spelling and grammar, which likely reflects the fact that the game was proofread by players from around the world. With all the inconsistencies in how the language is handled there are some places where if it sort of fits and it isn't clearly wrong then it gets a pass.
Documentation: https://docs.godotengine.org/en/3.3/classes/class_dictionary.html?highlight=dict...
The first format is a Python styled dictionary creation, the advantages being that it is more obvious that the keys are string values and the keys aren't as limited, for instance including a space between words.
The second format is a Lua styled dictionary creation, the advantage is it's simplicity with less quotation marks to type and read. The downsides are that it can sometimes be confusing to read and it's limited in terms of functionality.
var gold = 5 var formatPython1 = { gold : gold } # creates { 5 : 5} var formatPython2 = { 'gold' : gold } # creates { 'gold' : 5} var formatLua = { gold = gold } # creates { 'gold' : 5} var emptyDict = {} emptyDict[gold] = gold # creates { 5 : 5}
Both formats are only relevant when creating the dictionaries, afterwards they have no impact on how the data behaves. This seems to be the source of most of your confusion as you seem to have assumed that the formats used to create the dictionaries impact how they look up keys. Therefore the weirdness you are experiencing is the result of you not properly attributing the data types used as keys and comparisons. For reference, GDScript has the function typeof() that can be used to return the integer that corresponds to https://docs.godotengine.org/en/stable/classes/class_@globalscope.html#enum-glob...
You can use a simple line such as this to learn more about what a referenced value currently contains:
print("value: ", value, " type: ", typeof(value) )
This line probably doesn't work because there is no variable within the context named "costume":
if person.gear[costume] != null:
This should be quite obvious if you were to read the error messages from the Debug mod. The editor will also show the error message, but it can sometimes get lost among the other things it likes to complain about.
Finally, the "gear" data for persons is a simple dictionary with string keys and the values are either null or string typed item IDs. The string values need to be used in the dictionary "globals.state.unstackables" to find the dictionary typed item data for that specific item. The process for checking for items is usually over-complicated by programmers that don't fully understand the gear system nor power of GDScript.
var temp = globals.state.unstackables.get( person.gear.accessory ) var handcuffs = temp && temp.code == 'acchandcuffs'