[SOLVED]Codex help: hide textbutton

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
rusicaria
Regular
Posts: 67
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

[SOLVED]Codex help: hide textbutton

#1 Post by rusicaria » Sun May 15, 2022 12:30 pm

Hello!

I'm working on a codex for my VN, and what I'm aiming for is for new 'topics' to only be visible after new information has been learned by the player. I'm aware that you can make the topic unclickable, but I don't want most of the topics to be visible to read until they have come across the information, as it would spoil a lot of the game.

What I currently have is this:

Code: Select all

screen codexmain:
    tag menu
    frame:
        xmaximum 1600
        ymaximum 900
        xalign .5
        yalign .5
        textbutton _("Back") action Return() xalign 1.0
        fixed:
            hbox:
                xsize 300
                ysize 838
                ypos 50
                frame:
                    xsize 300
                    ysize 838
                    vbox:
                        text "{size=60}{b}{color=9A0AF5}TOPICS{/color}{/b}{/size}"
                        viewport:
                            scrollbars "vertical"
                            mousewheel True
                            vbox:
                                textbutton _("You"):
                                    action If(you_codex<>0, [ShowMenu('codexmain'), SetVariable('you_codex', 1), ShowMenu('you_desc')], None)
                                textbutton _("Home"):
                                    action If(home_codex<>0, [ShowMenu('codexmain'), SetVariable('home_codex', 1), ShowMenu('home_desc')], None)
                frame:
                    xsize 1288
                    ysize 838
                    vbox:
                        xsize 1276
                        ysize 826
                        text _("{color=9A0AF5}DESCRIPTION{/color}")
                        viewport:
                            scrollbars "vertical"
                            mousewheel True
                            vbox:
                                transclude

style codexmain_label is gui_label
style codexmain_label_text is gui_label_text
style codexmain_text is gui_text
style codexmain_textbutton:
    font "hurtm.ttf"
style codexmain_label_text:
    size gui.label_text_size

screen you_desc:
    tag menu
    use codexmain:
        if you_codex == 0:
            text ""
        elif you_codex == 1:
            text "blablabla"

screen home_desc:
    tag menu
    use codexmain:
        if home_codex == 0:
            text ""
        elif home_codex == 1:
            text "blablabla"
Any suggestions are much appreciated!

User avatar
rusicaria
Regular
Posts: 67
Joined: Sat Mar 28, 2020 12:26 am
Projects: VivaCity (VN)
Tumblr: rusicariaGAMES
itch: rusicariaGAMES
Contact:

Re: [SOLVED]Codex help: hide textbutton

#2 Post by rusicaria » Sun May 15, 2022 3:35 pm

Solved it pretty quickly, just changed the 'action IF' to 'if you_codex =0:'

Post Reply

Who is online

Users browsing this forum: No registered users