Using a List as a dict value in dialogue
Posted: Wed Oct 26, 2022 7:56 pm
I'm trying to make a dict that uses lists as the values, and then reference that list within a dialogue string. The closest I've gotten allows me to create the dict and access it using a fixed number in the string, but trying to use a variable to select the position in the list breaks it. I have a few less elegant workarounds, but if I could actually get this to work as intended, it would be much cleaner.
$ Directions = {'up':['up','down'],'left':['left','right']}
$ Invert = 0
"We're going [Directions[up][0]]!" #works, says "We're going up!"
"We're going [Directions[up][1]]!" #works, says "We're going down!"
"We're going [Directions[up][Invert]]!" #fails, regardless of what "Invert" is set to, says "list indecies must be integers, not unicode"
$ Directions = {'up':['up','down'],'left':['left','right']}
$ Invert = 0
"We're going [Directions[up][0]]!" #works, says "We're going up!"
"We're going [Directions[up][1]]!" #works, says "We're going down!"
"We're going [Directions[up][Invert]]!" #fails, regardless of what "Invert" is set to, says "list indecies must be integers, not unicode"