code question (menu)

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
TamakiShibo
Newbie
Posts: 6
Joined: Sat Jul 07, 2018 1:24 pm
Contact:

code question (menu)

#1 Post by TamakiShibo » Thu Jul 12, 2018 4:22 am

i want to do something like this: game will allow you to choose 3 or more options, every option will do something and then will return to choosing, but without option that was already chosen. like you should do couple of labels of code and player will decide in what order he should read those. so, how to do that? the simplest way

thanks in advance

(sorry for bad english plz)

User avatar
Per K Grok
Regular
Posts: 53
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot
Projects: Sea of Lost Ships
Deviantart: pekj
itch: per-k-grok
Location: Sverige
Contact:

Re: code question (menu)

#2 Post by Per K Grok » Thu Jul 12, 2018 5:52 am

TamakiShibo wrote:
Thu Jul 12, 2018 4:22 am
i want to do something like this: game will allow you to choose 3 or more options, every option will do something and then will return to choosing, but without option that was already chosen. like you should do couple of labels of code and player will decide in what order he should read those. so, how to do that? the simplest way

thanks in advance

(sorry for bad english plz)
Don't know if it is the simplest way, but it is at least one way :)

Code: Select all

default ch1 = True
default ch2 = True
default ch3 = True

-------------

    menu:
        "choice 1" if ch1:
            $ ch1 = False
            ----- do something----
        "choice 2" if ch2:
            $ ch2 = False
            ----- do something----
        "choice 3" if ch3:
            $ ch3 = False
            ----- do something----


TamakiShibo
Newbie
Posts: 6
Joined: Sat Jul 07, 2018 1:24 pm
Contact:

Re: code question (menu)

#3 Post by TamakiShibo » Thu Jul 12, 2018 6:09 am

Per K Grok wrote:
Thu Jul 12, 2018 5:52 am
TamakiShibo wrote:
Thu Jul 12, 2018 4:22 am
i want to do something like this: game will allow you to choose 3 or more options, every option will do something and then will return to choosing, but without option that was already chosen. like you should do couple of labels of code and player will decide in what order he should read those. so, how to do that? the simplest way

thanks in advance

(sorry for bad english plz)
Don't know if it is the simplest way, but it is at least one way :)

Code: Select all

default ch1 = True
default ch2 = True
default ch3 = True

-------------

    menu:
        "choice 1" if ch1:
            $ ch1 = False
            ----- do something----
        "choice 2" if ch2:
            $ ch2 = False
            ----- do something----
        "choice 3" if ch3:
            $ ch3 = False
            ----- do something----

thanks a lot!

User avatar
Remix
Miko-Class Veteran
Posts: 831
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I cannot draw very well)
Projects: An un-named 3d anime based trainer game
Contact:

Re: code question (menu)

#4 Post by Remix » Thu Jul 12, 2018 3:33 pm

Alternatively, just use a set attribute of the menu

Code: Select all

default some_set_name = []

label menu_test:

    menu:
        set some_set_name
        
        "A":
            "..."
        "B":
            "..."
        "C":
            "..."
    jump menu_test

Post Reply

Who is online

Users browsing this forum: MaydohMaydoh