Multi keys for dic/array?

Godot Version



I was wondering if there was a way to add multiple unique keys to say a variable which is an’ array , that lead to a response array?


var greetings = [“hi”, “sup”, “hello”, “howdy”]

and then the dictonary have something akin to…

var responses = {
greetings : [“we all give the same reply”]

this way it saves line bloat from copy and pasting for each minor phrasing.

Not sure that is possible without lots of lines for each key value pair. You could make a dictionary builder class that could take the array of keys and point them at the same response array.

sounds like you need JSON file for listing these data

You’re right, it would be drastically more code to make bigger pairs then to just simple make a new key and paste the response array for its synonym.