Tips creating menu "checkmark"

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
BigBucket
Regular
Posts: 26
Joined: Wed Aug 21, 2019 9:19 pm
Contact:

Tips creating menu "checkmark"

#1 Post by BigBucket »

Hi,

I just started using Ren'Py and was trying to make a test where the player would be sent back to a previous menu and the options he already selected would have a "(Done)" beside it to show him that he already selected that option.

The one I managed to make has only 2 options and I used a variable that I set to true when the choise was made, but I had to use an "if" check before the menu and create 2 menu code. The problem is that I want to make it on a 5 option menu and it would be way too hard to make every single combination of variable checks to present the correct menu option.

Code: Select all

if horde:
        menu:
        
            "Horda (Done)":
                jump horda
            

            "Aliança":
                jump alianca
    else:
        menu:
            "Horda":
                $ horde = True
                jump horda
            
            "Aliança":
                jump alianca
Is there a easier way to do it? Tried stuff like this but it didn't work

Code: Select all

        menu:
            if horde:              
                "Horda (Done)":
                    jump horda
            else:
            	$ horde = True
                "Horda":
                jump horda
            
            

            "Aliança":
                jump alianca

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Tips creating menu "checkmark"

#2 Post by Imperf3kt »

One way is to place the options in a list and check if it's present in the list.

Code: Select all

default completed_list = [] 

label start:
    menu:
        "Option A" if option_a not in completed_list:
            $ completed_list.append("option_a")
            jump option_a

label option_a:
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

BigBucket
Regular
Posts: 26
Joined: Wed Aug 21, 2019 9:19 pm
Contact:

Re: Tips creating menu "checkmark"

#3 Post by BigBucket »

Hmm, think I got it. Sorry about taking this long to answer, pc died :/

Post Reply

Who is online

Users browsing this forum: No registered users