Expressing a variable in renpy.show_screen

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
PTGames
Newbie
Posts: 2
Joined: Thu Nov 08, 2018 7:20 pm
Contact:

Expressing a variable in renpy.show_screen

#1 Post by PTGames »

Super new to Ren'Py so sorry if this is a simple question.

I have a variable called "lastroom" that I use to store a label name then jump to using

Code: Select all

 jump expression lastroom
I'd like to do a similar thing with a screen with its name saved in "lastscreen" and show the screen by calling the variable to get the name of the screen.

How would I express that in renpy.show_screen? Or is there another way to do it?

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

Re: Expressing a variable in renpy.show_screen

#2 Post by Imperf3kt »

You shouldn't need to use renpy.show_screen unless you're making a custom function.
If you're inside a label, use

Code: Select all

    show my_screen
If you're inside a screen, using a button of some sort or perhaps a timer, use

Code: Select all

action ShowMenu("my_screen")
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
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Expressing a variable in renpy.show_screen

#3 Post by Remix »

I think I likely answered this on discord, anyway...

$ renpy.show_screen( lastscreen )

Will evaluate the lastscreen variable and show the screen relevant to that
Frameworks & Scriptlets:

PTGames
Newbie
Posts: 2
Joined: Thu Nov 08, 2018 7:20 pm
Contact:

Re: Expressing a variable in renpy.show_screen

#4 Post by PTGames »

Remix wrote: Thu Nov 08, 2018 8:43 pm I think I likely answered this on discord, anyway...

$ renpy.show_screen( lastscreen )

Will evaluate the lastscreen variable and show the screen relevant to that
You did, totally forgot to post it had been answered, it was late. Thanks again :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]