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.
I'm my game I have the tipical cellphone where the player can get some info about what he needs to do, his/her stats, his/her achievemnts and outside links. I would like that once you click on the quit button to go back to the previous label used outside the cellphone functions
I now what I am asking is possible because I already saw it in two games but for everything I search before asking here I know is not always so easy, in the worst case I already have a location value setted to each place/room the user can be and I could do a gigantic if location == placeone: jump placeonelabel, but I already have more than 20 places and I'm not done yet adding places so I really don't want to do that gigantic if that I will have to update every single time I add a room.
Not sure what part of the code I should add to make it easier, so here is the basic cellphone, I can always add something else if needed
PS: the f_cellshow is unused at the moment, I had an idea but it didn't worked as planned
screen cellphone():
modal True
vbox:
textbutton "X" alt _("Close cell menu") xalign 1.0 action Hide("cellphone")
hbox:
# Add buttons to go to your various tabs
textbutton _("Chars") action SetVariable("celltab", 1)
textbutton _("Stats") action SetVariable("celltab", 2)
# ... etc.
if celltab == 1:
use cell_chars
elif celltab == 2:
use cell_stats
# etc.
That will show your cellphone screens as a modal, basically on top of your story screen. As soon as you close it, the cellphone is hidden and you're right back to where you were.
That's just one way of setting up the screen, but basically the answer is to do it all within screen statements, rather than labels.
It worked and now I can hide the cellphone, the only problem I have now is that the celltab value was used to remember what screen the user was watching last time and open that tab the next time the user opens the cellphone and now that isn't working anymore and everytime I open the cellphone it always opens the cell_chars tab
Edit: I solved it, the problem was that the unused f_cellshow in the label celphone where I was calling each tab wasn't working because the default value was False and there wasn't anything to set it True and make it work as it should.
Now I have a new problem, after closing it, the buttons of the imagemap behind the cellphone doesn't work, now I have to go to the main map and then go back to that place to make then work