textbutton click to close screen advances game dialogue but shouldn't

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
vf1sveritech
Newbie
Posts: 3
Joined: Sun Aug 13, 2017 7:38 am
Contact:

textbutton click to close screen advances game dialogue but shouldn't

#1 Post by vf1sveritech »

Sorry if the title is a little confusing, but I have a textbutton that is always displayed that opens a screen to display some information. To close the screen i have another textbutton that returns. The problem is whenever I click the 'close' button, my game is at a different spot than when i opened the window. I want to close the screen and be at the same spot I was when I opened it, but instead it seems to jump a head.

Code: Select all

screen hud: ##displays stuff for the player during normal gameplay
    vbox:
        ypos 0
        xpos 0
        text "[day_name] [time_name]"
        textbutton "[PC0.name]'s stats" action Jump("pc_stats")
        textbutton "[SIS0.name]'s stats" action Jump("sis_stats")

label pc_stats:
    call screen pc_stats_screen
    return
label sis_stats:
    call screen sis_stats_screen
    return

screen pc_stats_screen:
    frame:
        xalign 0.5
        yalign 0.15

        vbox:
	    text "Concetration [PC0.concentration]"
	    text "Alchemy [PC0.alchemy]"
            textbutton "Close" action Return()

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

Re: textbutton click to close screen advances game dialogue but shouldn't

#2 Post by Imperf3kt »

Are you using modal in the screen?
modal = True
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

User avatar
Scribbles
Miko-Class Veteran
Posts: 636
Joined: Wed Sep 21, 2016 4:15 pm
Completed: Pinewood Island, As We Know It
Projects: In Blood
Organization: Jaime Scribbles Games
Deviantart: breakfastdoodles
itch: scribbles
Location: Ohio
Contact:

Re: textbutton click to close screen advances game dialogue but shouldn't

#3 Post by Scribbles »

why don't you have the textbutton call the screen instead of jumping to a label that calls the screen? then the textbutton that returns would just need the Hide() action. I have a similar button in a VN i'm working on and it works fine.

Eta:

Code: Select all


action Hide(screen, transition=None)
action Show(screen, transition=None, *args, **kwargs) ##I believe the screen needs to be in ""'s)

https://www.renpy.org/doc/html/screen_a ... %20actions
Image - Image -Image

vf1sveritech
Newbie
Posts: 3
Joined: Sun Aug 13, 2017 7:38 am
Contact:

Re: textbutton click to close screen advances game dialogue but shouldn't

#4 Post by vf1sveritech »

I was following another game's code as an example and couldn't replicate it's results.

Thanks. using modal worked and show hide. it still doesn't look perfect but it works.

can a text button do more than one action?

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

Re: textbutton click to close screen advances game dialogue but shouldn't

#5 Post by Imperf3kt »

Yes, just add a comma between the two actions.
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

Post Reply

Who is online

Users browsing this forum: voluorem