Ren'Py RENPY Navigation tutorial??

Mar 16, 2023
18
4
I have nothing against you, peachesinpower , you were just the one who once again pointed to this really bad thing, but at the wrong moment.
I'm admittedly quite new to Ren'Py and still learning. Just happened to log back on tonight to see the minefield this thread turned into...

I originally had two screens, one for the map background and one for the map buttons, that way I could easily display other content on the map background (like pages for extending the map, showing more information about locations, etc.). But after reading your code, I realize it makes much more sense to just include all of those elements into one screen. Regarding your statement about calling, I know now the proper way to do so!

Thank you anne O'nymous for your helpful responses and unfathomable patience with the OP. I learned a few things myself, both in terms of logic and in terms of writing cleaner code.

I have MUCH to learn, but I originally responded to OP with the excitement to share what little experience I have, in an attempt to hopefully help out a fellow developer and come to a solution together. I now realize that was a mistake.

Now I go back to my dark corner and wait to post for another 3 months...
 
Mar 16, 2023
18
4
Just for my own edification, I do have one question regarding calling a screen anne O'nymous.

Let's say I wanted to display two separate screens for some random, hypothetical scenario. (Maybe like an interactive notification bar on a phone, and interactable apps on the phone.)

Would it be possible to call multiple screens and return values from each? Or in that scenario, would I have to use modals, then resort to using some kind of global variable to keep track of values? Or would it make sense to call one screen and show the other?

Just trying to wrap my head around the proper times to call.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
I have MUCH to learn, but I originally responded to OP with the excitement to share what little experience I have, in an attempt to hopefully help out a fellow developer and come to a solution together. I now realize that was a mistake.

Now I go back to my dark corner and wait to post for another 3 months...
Don't sell yourself short.

While there's the call versus show issue, the rest was correct. Broken but working, and for someone with only few experience it's not bad.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
[Sorry for the double post]
Would it be possible to call multiple screens and return values from each?
No, alas it's not possible.

But you can one into the other, then rely on or (I tend to always mix the two) to pass the value from one to another.


I'm at works and don't really have the time, so sorry I'll give a quick and really poor example:
Python:
screen one():
    # The return value from the second screen
    default retValue = None

    # Include the second screen
    use two

    # Wait to have the answer from the second screen before you can answer from this one
    if retValue != None:
        textbutton "close":
            action Return( [ "closed", retValue ] )


screen two():
    textbutton "choice 1":
        # Or SetLocalVariable
        action SetScreenVariable( "retValue", "choice 1" )
    textbutton "choice 2":
        action SetScreenVariable( "retValue", "choice 2" )

label whatever:
    call screen one
    if _return[1] == "choice 1":
        [...]
    else:
        [...]
 
Mar 16, 2023
18
4
No, alas it's not possible.

But you can one into the other, then rely on or (I tend to always mix the two) to pass the value from one to another.
Ohhhh that's cool. Just have to call one screen that has a nested screen inside of it. Is there a reason you choose to pass the value back to ? As opposed to just iterating/redefining your from your nested screen. Is it just for better readability? If can only be read from the screen it's being used in, then why not use universally to be able to cache the whole screen at all times?

Appreciate the example, it's very helpful!

Don't sell yourself short.

While there's the call versus show issue, the rest was correct. Broken but working, and for someone with only few experience it's not bad.
Also appreciate the kind words. It's been a bit overwhelming trying to learn screens - just trying to wrap my head around things a step at a time (and plenty of bookmarks and documentation referencing!).
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
Is there a reason you choose to pass the value back to ?
No reason at all. As I said, I tend to always confuse them.
One is local, while the other is... well also local, but more globally since it include used screens. One regard the screen, while the other... well also regard the screen, but more globally since it include used screens. And at my old age it's too much confusion for my poor memory.

So, I used one, but it's perhaps the other that works and, being at works, I can afford to write a quick post time to time, my boss know and don't care as long as I do my job. But starting to test the code and all, well... even if I could since I'm logged to my home computer, it would probably be a bit too much even if my boss is my all time favorite boss and the nicest boss I ever had to works for ; in case he's right behind me ;)
 
  • Like
Reactions: spideredd
Mar 16, 2023
18
4
No reason at all. As I said, I tend to always confuse them.

So, I used one, but it's perhaps the other that works and, being at works, I can afford to write a quick post time to time, my boss know and don't care as long as I do my job. But starting to test the code and all, well... even if I could since I'm logged to my home computer, it would probably be a bit too much even if my boss is my all time favorite boss and the nicest boss I ever had to works for ; in case he's right behind me ;)
Fair enough! :ROFLMAO: Thanks again for all the help, sorry to pull you from your work!
 
  • Like
Reactions: spideredd