Show Screen in Python Function (solved)
Posted: 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:
I've found these threads while I was researching how to do this:
viewtopic.php?t=41793
https://www.renpy.org/doc/html/screen_p ... how_screen
And based on those threads I've been trying this:
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
show screen map_screen(pc_farm)
viewtopic.php?t=41793
https://www.renpy.org/doc/html/screen_p ... 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)
(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)