Show Screen in Python Function (solved)

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
User avatar
Eileen-Class Veteran
Posts: 1148
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA

Show Screen in Python Function (solved)

#1 Post by noeinan » Sat Oct 06, 2018 8:52 pm

Okay, so I've got an overmap code and I'm trying to add a function that will change the map. To do this outside of a function I would type:

Code: Select all

show screen map_screen(pc_farm)
I've found these threads while I was researching how to do this:

viewtopic.php?t=41793 ... how_screen

And based on those threads I've been trying this:

Code: Select all

    def change_map(denizen):
        #Transports player to new map
        renpy.show_screen(map_screen, pc_farm)
But it tells me that "'map_screen' is not defined", even though it has no problem displaying map_screen in the script. If someone could point me towards what I'm doing wrong I'd super appreciate it!

(I have also tried renpy.show_screen("map_screen(pc_farm)") and renpy.show_screen(map_screen(pc_farm)) but neither of those work either. Also, the forum says you use a screen's "tag" instead of it's name, but like... I have no idea how I'd pass the map name with tags, since it's the same screen just with different maps loaded in.)

After a bit more experimentation, I figured it out. The correct syntax is

Code: Select all

    def change_map(denizen):
        #Transports player to new map
        renpy.show_screen("map_screen", tMap=pc_farm)


Posts: 1
Joined: Fri Mar 08, 2019 7:14 pm

Re: Show Screen in Python Function (solved)

#2 Post by lacy1809 » Fri Mar 08, 2019 7:17 pm

Hey there,

I'm trying practice python at home but getting too many errors. I have very good command on C, but i want to learn python because i want to be a professional web developer. So please get me any best python tutorial, i have searched a lot but nothing helped much. Should i go for paid tutorial?
Please suggest me with the best.

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

Re: Show Screen in Python Function (solved)

#3 Post by Imperf3kt » Fri Mar 08, 2019 8:02 pm

For Web development you don't want python, you want JavaScript.
Also of use is CSS, HTML and php.

But your post has nothing to do with this thread. I'm inclined to believe you don't want what you are asking.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Free Android GUI - Updated occasionally
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Latest Blackjack updates

Post Reply

Who is online

Users browsing this forum: Google [Bot]