Hey guys. I have a problem that has me stumped, and no matter where I look or what I try I can't seem to solve it hahaha. And so I wanted to know if you guys knew the solution.
Alright, so I have a dictionary. And I want to show one of the variables in the dictionary inside of a menu option. Now, the code I wrote works perfectly if instead of the variable I use a number. But if I try to use a variable, I think it reads it as text, and so it freaks out. So I wanna know what should I write if I want to use a variable.
I'll love you forever if you help me lel.
menu: "Whatever the option is [dict[key][variable]]":
The dictionary goes something like this.
default dict= {
'key':
['lal', 'lel', 'lil'],
What is the correct syntax to show dict variables on a menu?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- m_from_space
- Miko-Class Veteran
- Posts: 975
- Joined: Sun Feb 21, 2021 3:36 am
- Contact:
Re: What is the correct syntax to show dict variables on a menu?
Interpolating variables and especially dictionaries that have multiple levels can be a challenge. Just do it like this, it's also way easier to adapt if you change your dict later on in the game:
Code: Select all
$ option = dict['key'][variable]
menu:
"Whatever the option is [option]":
Who is online
Users browsing this forum: No registered users