Screen inside a viewport shows error. [Solved(should use 'use' statement)]

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
Yuvan raj
Regular
Posts: 38
Joined: Wed Feb 17, 2021 11:24 am
Contact:

Screen inside a viewport shows error. [Solved(should use 'use' statement)]

#1 Post by Yuvan raj »

Hello, I want to show a screen inside a viewport. But I get an error saying 'show' is not a valid keyword argument. Below is the code and below that are my images of what I want to accomplish.

Code: Select all

screen Green_button():
	imagebutton auto "greenbutton_%s" xpos 20 ypos 20 action Show("Yellow_viewport")
	
screen Yellow_viewport():
    modal True

    frame:
        background Solid("#5a5c5c")
        xpos 20 ypos 18
        xmaximum 1468
        xminimum 1468
        ymaximum 1045
        yminimum 1045
        viewport:
            scrollbars "vertical"
            mousewheel True
            draggable True
            show screen Player_affinity    #      <-----------------------------------------------------------------------------------This is the error causing line

screen Player_affinity():
	hbox:
		imagebutton auto "Good_%s" xpos 20 ypos 20 action [Show("Good_screen"). Hide("Player_affinity")]
	
		imagebutton auto "Evil_%s" xpos 20 ypos 20 action [Show("Evil_screen"). Hide("Player_affinity")]		            
            
            
screen Good_screen():
    hbox:
        imagebutton auto "close_%s" xpos 1150 ypos 8 action Hide("charactersbutton"):
            at transform:
                zoom 0.2
    vbox:
        xpos 50
        ypos 130
        xmaximum 1468
        xminimum 1468
        spacing 30

        hbox:
       		text "js;lfffffffffffffffffffffffffff"
       		
  


Below are the images of what I want to accomplish. I have also written my question on the images.
If I click the square green imagebutton which is shown by a screen, another screen opens which has a viewport(the big yellow box). In this viewport I have two imagebuttons(Evil and Good and Evil. I plan to add more hence the scrollable viewport) which when clicked disappears and shows another screen which has text some texts and images inside the viewport ITSELF!

Image

Below is what appears when I click the ‘Evil’ imagebutton. It contains several pics, texts, and other things. . This should appears within the already showing viewport. These images and texts are inside screens. And I want these to appear when I click the Evil or Good imagebuttons. Basically what I’m asking is, how to show a screen inside a viewport? or if it can’t how do I go about accomplishing what I want?

Image

Thanks in advance!
Last edited by Yuvan raj on Thu May 20, 2021 12:10 pm, edited 1 time in total.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Screen inside a viewport shows error.

#2 Post by Ocelot »

Notice how "show" is not in the list of valid statements for screens: https://www.renpy.org/doc/html/screens.html

You want use statement instead: https://www.renpy.org/doc/html/screens.html#use
< < insert Rick Cook quote here > >

Post Reply

Who is online

Users browsing this forum: AWizardWithWords, Ocelot