Displaying elements of a list as menu options.

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
Zeroized
Regular
Posts: 33
Joined: Sat Mar 23, 2013 12:33 am
Contact:

Displaying elements of a list as menu options.

#1 Post by Zeroized » Sat Oct 24, 2015 11:41 pm

Greetings.
I'm making a selling menu for a RPG, and I need to iterate through whole inventory and display it as a menu option to let the player pick what does it want to sell.
Do I need to create another screen for that? Can I do something like this?

Code: Select all

menu:
    for i in inventory:
        "Sell [i.name] for [i.cost]":
            $ gold += i.cost
            $ inventory.remove(i)
Thanks in advance for the answer.

philat
Eileen-Class Veteran
Posts: 1704
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Displaying elements of a list as menu options.

#2 Post by philat » Sun Oct 25, 2015 7:48 am

It would probably make more sense to use a screen to do that. You can use the python equivalent of menu if you really want to though. http://www.renpy.org/doc/html/statement ... oice-menus

Post Reply

Who is online

Users browsing this forum: Google [Bot]