Calling a list value using a key

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
User avatar
richycapy
Regular
Posts: 51
Joined: Mon May 27, 2019 8:53 pm
Organization: EN Productions
Location: Mexico
Contact:

Calling a list value using a key

#1 Post by richycapy » Tue Aug 23, 2022 12:14 am

Hi!

I have a long list of values set up on a list, like this:

Code: Select all

default lugarestxt = [
["mapa_principal", _("Main map")],
["casa_alberca", _("Home pool")],
["casa_alberca_lejos", _("Home pool")],
["casa_andy_room", _("My room")],
["casa_bathroom", _("Home bathroom")],
["escuela_2p_pasillo_cerca", _("School second floor")],
]
So to call the value, I would do something like this:

Code: Select all

text lugarestxt["escuela_2p_pasillo_cerca"] style "celular_agenda_lugar" 
But I get this error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/text/text.py", line 1556, in __init__
    raise Exception("Cannot display {0!r} as text.".format(i))
Exception: Cannot display RevertableSet([u'School second floor']) as text.

Windows-10-10.0.19041
Ren'Py 7.4.9.2142
What am I doing wrong? :'(

User avatar
enaielei
Regular
Posts: 114
Joined: Fri Sep 17, 2021 2:09 am
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: Calling a list value using a key

#2 Post by enaielei » Tue Aug 23, 2022 2:41 am


Post Reply

Who is online

Users browsing this forum: No registered users