Ren'Py RENPY Navigation tutorial??

Sander87

Newbie
Dec 14, 2021
33
36
why is there NO renpy proper navigation tutorial online??

whoa. don't rush to click respond on this post so quickly now. Yes there are some tutorials online for renpy navigation... but do they work? all I see is half assed attempts to show a "sort of" navigation system that is pretty broken.
I want the ACTUAL real deal you see in these games. a bar at the bottom of the screen with buttons to go in different places in the game.

now that part is actually pretty easy to code in renpy. just create a new "screen", with buttons. make it and overlay and stick it on bottom of screen. then, add a bunch of screens that you can move to! bam tutorial over!
right?

WRONG!
try it out, play the game. then scroll back and forth between the screens. what happens? you cant scroll? the game is broken! yea, thats what I thought!

so how does one do a proper screen in renpy, that you can go to other screens, click and interact with characters, then go backwards through the game to change some choices AND go forward also?

why do NONE of these tutorials actually work? they are just half assed attempts to stick some screens on screen and move fake show stuff but not actually register with the renpy system properly? How do the real games do it? and why is there NO documentation on this?!...
 
Mar 16, 2023
18
4
I tend to write out flowcharts when dealing with screens before I even begin to code anything. Once I've got the basic logic in place, I can then create the screens for interactions using image buttons.

Never had an issue with scrolling back. Care to share your code so we can debug?
 

Sander87

Newbie
Dec 14, 2021
33
36
sure:

in screens.rpy:
#screens#######################################
screen entrance():
add "Areas/entrance.png"
modal True

screen fireplace():
add "Areas/fireplace.png"
modal True

screen kitchen():
add "Areas/kitchen.png"
modal True

#overlay#######################################
#note: you will need to place the xpos/ypos, I removed the design elements just to show the code functionality#

screen quick_map():
zorder 100
if quick_map:

imagebutton:
idle "Areas/ic_entrance.png"
action Show("entrance")
imagebutton:
idle "Areas/ic_fireplace.png"
action Show("fireplace")
imagebutton:
idle "Areas/ic_kitchen.png"
action Show("kitchen")

init python:
config.overlay_screens.append('quick_map')

default quick_map = False


------------------------------------------------

in script.rpy

we put this line when we want the navigation to become available:
$ quick_map = True

--------

so the player sees the navigation buttons, pushes them and goes to the corresponding screen.
when they try to rollback, it wont work.

also, you need to add "hide screen" to hide the previous screen, otherwise you can only go to a screen once. I removed this part of the code too. with it implemented, you can return to places you been before numerous times, but rollback still wont wont.

I managed to add a label and get you to put the button, go to the label which THEN sends you to the screen. this make rollback possible, but suddenly, rollforward wont work. so yea...

not sure how other games do it to move around and also be able to rollback and forward in the game!
 
Mar 16, 2023
18
4
sure:

in screens.rpy:
#screens#######################################
screen entrance():
add "Areas/entrance.png"
modal True

screen fireplace():
add "Areas/fireplace.png"
modal True

screen kitchen():
add "Areas/kitchen.png"
modal True

#overlay#######################################
#note: you will need to place the xpos/ypos, I removed the design elements just to show the code functionality#

screen quick_map():
zorder 100
if quick_map:

imagebutton:
idle "Areas/ic_entrance.png"
action Show("entrance")
imagebutton:
idle "Areas/ic_fireplace.png"
action Show("fireplace")
imagebutton:
idle "Areas/ic_kitchen.png"
action Show("kitchen")

init python:
config.overlay_screens.append('quick_map')

default quick_map = False


------------------------------------------------

in script.rpy

we put this line when we want the navigation to become available:
$ quick_map = True

--------

so the player sees the navigation buttons, pushes them and goes to the corresponding screen.
when they try to rollback, it wont work.

also, you need to add "hide screen" to hide the previous screen, otherwise you can only go to a screen once. I removed this part of the code too. with it implemented, you can return to places you been before numerous times, but rollback still wont wont.

I managed to add a label and get you to put the button, go to the label which THEN sends you to the screen. this make rollback possible, but suddenly, rollforward wont work. so yea...

not sure how other games do it to move around and also be able to rollback and forward in the game!
Still a bit confused on what you're looking for, but this is how I set up basic screens when I'm making them, which allows for rollbacks.

In screens.rpy:
Python:
screen mapBackground():
    imagemap:
        xalign 0.5
        yalign 0.5
        ground "map.png"

screen mapButtons():
    # you can individually align buttons wherever you want on the map
    xalign 0.5
    yalign 0.5
    imagebutton:
            idle "Areas/entrance.png"
            action Jump("entrance")
    imagebutton:
            idle "Areas/fireplace.png"
            action Jump("fireplace")
    imagebutton:
            idle "Areas/kitchen.png"
            action Jump("kitchen")
Then in script.rpy:
Python:
label start:
    "Here's a map."
    jump showMap

label showMap:
    show screen mapBackground
    show screen mapButtons
    $ renpy.pause(delay=None, hard=True) # must click a map button to continue

label entrance:
    hide screen mapBackground
    hide screen mapButtons
    "You're now in the entrance."
    # can jump back to showMap whenever you want

label fireplace:
    hide screen mapBackground
    hide screen mapButtons
    "You're now by the fireplace."
    # can jump back to showMap whenever you want

label kitchen:
    hide screen mapBackground
    hide screen mapButtons
    "You're now in the kitchen."
    # can jump back to showMap whenever you want
Is this what you're looking for to allow you to rollback?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,223
not sure how other games do it to move around and also be able to rollback and forward in the game!
It's relatively easy, they've read the documentation that come with Ren'Py and therefore is on their computer.

:
Saves occur at the start of a Ren'Py statement in the outermost interaction context.

What's important here is to note that saving occurs at the start of a statement. If a load or rollback occurs in the middle of a statement that interacts multiple times, the state will be the state that was active when the statement began.
What mean that they quit the screen, offering a new rollback point (and so a new saving point) to Ren'Py.


Therefore, the easiest way to do is:
Python:
screen entrance():
    tag location
    add "entrance.jpg"

screen fireplace():
    tag location
    add "fireplace.jpg"

screen kitchen():
    tag location
    add "kitchen.jpg"

screen quick_map():
    zorder 100
    if quick_map:
        hbox:
            xalign 0.5
            yalign 1.0
            imagebutton auto "entrance_%s.png" action Jump( "entrance" )
            imagebutton auto "fireplace_%s.png"  action Jump( "fireplace" )
            imagebutton auto "kitchen_%s.png"  action Jump( "kitchen" )

label entrance:
    show screen entrance  # Or /call/ depend on the needs
    [...]

label fireplace:
    show screen fireplace  # Or /call/ depend on the needs
    [...]

label kitchen:
    show screen kitchen  # Or /call/ depend on the needs
    [...]

Python:
label showMap:
    show screen mapBackground
    show screen mapButtons
    $ renpy.pause(delay=None, hard=True) # must click a map button to continue
Why two screens ?
Code:
screen mapBackground():
    add "map.png" xalign 0.5 yalign 0.5
    use mapButtons

screen mapButtons():
    [...]
But in before everything else, please, please, pretty please, that someone make this utter shit disappear once for all ! It's been too many years now that the world suffer from this infamity (should be a fucking word).

If the player is expected to click somewhere on the screen to advance, you fucking the screen ! You don't use this absurd trick that don't works as correctly as everyone imagine it. Especially since none of your screens are modals.
 
  • Like
Reactions: Domiek

Sander87

Newbie
Dec 14, 2021
33
36
It's relatively easy, they've read the documentation that come with Ren'Py and therefore is on their computer.

:


What mean that they quit the screen, offering a new rollback point (and so a new saving point) to Ren'Py.


Therefore, the easiest way to do is:
Python:
screen entrance():
    tag location
    add "entrance.jpg"

screen fireplace():
    tag location
    add "fireplace.jpg"

screen kitchen():
    tag location
    add "kitchen.jpg"

screen quick_map():
    zorder 100
    if quick_map:
        hbox:
            xalign 0.5
            yalign 1.0
            imagebutton auto "entrance_%s.png" action Jump( "entrance" )
            imagebutton auto "fireplace_%s.png"  action Jump( "fireplace" )
            imagebutton auto "kitchen_%s.png"  action Jump( "kitchen" )

label entrance:
    show screen entrance  # Or /call/ depend on the needs
    [...]

label fireplace:
    show screen fireplace  # Or /call/ depend on the needs
    [...]

label kitchen:
    show screen kitchen  # Or /call/ depend on the needs
    [...]



Why two screens ?
Code:
screen mapBackground():
    add "map.png" xalign 0.5 yalign 0.5
    use mapButtons

screen mapButtons():
    [...]
But in before everything else, please, please, pretty please, that someone make this utter shit disappear once for all ! It's been too many years now that the world suffer from this infamity (should be a fucking word).

If the player is expected to click somewhere on the screen to advance, you fucking the screen ! You don't use this absurd trick that don't works as correctly as everyone imagine it. Especially since none of your screens are modals.

so cocky, yet you providing a script that doesnt do what I asked...
I knew ppl would throw down some code, proudly, without testing it. You didn't read my original post. I told you guys not to rush and to try it. It's always like this. I tried a lot of things before posting my message...

so lemme explain the issue with your code.
if you leave

label entrance:
show screen entrance
[...]

it goes to entrance then quits the game. Ok, no worries. just put "Call" instead of "Show"
but then it "works". you can move around from scene to scene. And if you scroll on mouse wheel, you can rollback the previous scenes, even if you go back and forth between areas.
So far so good! (I managed to do this myself already!)

then, if you roll forward on the mouse to move ahead....
Oh. uh. whats this? It is suddenly blocked.

and HERE, if you read my original post, you see the issue!!

so, I ask once more, does ANYONE know how to navigate between screens PROPERLY? where you can rollback to previous screens AND roll forward?
Ive seen this in games and know it is possible. Please guy. there must be a way.
does ANYONE know how? and why are all the methods I see not accomplishing this? All the documentation and examples are, as you guys have provided, faulty. So, what is the PROPER way to navigate back and forth and have it rollback-rollforaward properly??
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,223
so lemme explain the issue with your code.
To paraphrase you: so cocky, yet unable to see the forest behind the tree.


label entrance:
show screen entrance
[...]

it goes to entrance then quits the game.
Let me explain you, oh great wise man, by convention the [...] mean that you put here whatever you want as code. And in near to six years here, you're only the second I see not having the starts of a clue regarding this.


Ok, no worries. just put "Call" instead of "Show"
Oh, you mean like explicitly said as comment in the code I wrote ?


then, if you roll forward on the mouse to move ahead....
Oh. uh. whats this? It is suddenly blocked.
Yeah, as expected by anyone who took the time to . And they also know why, and why it should stay like that:
Most Ren'Py statements automatically support rollback and roll forward. If you call ui.interact() directly, you'll need to add support for rollback and roll-forward yourself. This can be done using the following structure:
[...]
It's important that your game does not interact with the user after renpy.checkpoint has been called. (If you do, the user may not be able to rollback.)

Ive seen this in games and know it is possible. Please guy. there must be a way.
:FacePalm: I correct what I said on top of this post. It's not the forest behind the tree that you don't see, it's the universe behind the grain of sand.


By the way, this forum should really have a section dedicated to people who want help regarding programming and development. Oh, wait...
 

Sander87

Newbie
Dec 14, 2021
33
36
Dude.... you didnt add anything to this conversation.
I used your code from above and it does not roll forward.

How does my code interact with the user? And I CAN rollback, but not forward.
I do not click anything, just rollback, then try forward and nothing.

try out your code. i did just like you wrote and it wont work.

can you provide a code that ACTUALLY works?
You responded here but didnt provide anything. so I ask again, how can I make a navigation menu where I can scroll back to previous areas then forwards again?
Ive tried adding
renpy.checkpoint(rv)
but it dont do nothing. I dont think this has anything to do with it though. it just seems to me that, whenever renpy calls "show screen" and you click away from that screen, you can rollback but not forward!!
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,223
Dude.... you didnt add anything to this conversation.
If you say so...


it just seems to me that, whenever renpy calls "show screen" and you click away from that screen, you can rollback but not forward!!
Would you have took the time to follow, then read, then try to understand (all steps being mandatory) the link I provided for call, it wouldn't just seem to. And would you've took the time to think about it, you surely would have understood why, and why rolling forward shouldn't happen here.

It's not because some games are broken, and permit to do it because of this, that it's something to do, or that make sense in this context.
 

Sander87

Newbie
Dec 14, 2021
33
36
in script.rpy:
label start:
menu:
"Go to place":
jump place
label place:
"this is a test"

why is it that, when I click on "go to place" and go to the label "place" I can scroll the mouse wheel back and forth, to return to start and then go back to place... BUT when I click on "place" from screen I can go back but not forward any more!! here is the example code from screens.rpy:

screen Map:
button:
xpos 1000
ypos 500
text "go to Place"
action Jump("place")

what is going on here????????
both are "jump" to a label... but one has rollback and rollforward... but the other only rollback and can no longer roll forward?!
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,223
what is going on here????????
both are "jump" to a label... but one has rollback and rollforward... but the other only rollback and can no longer roll forward?!
I wonder, could it be that one come from a label, therefore a succession of straight forward statements, while the other come from a screen, therefore possibly anything thrown randomly in a big bag with no real order nor priority ?
With, in top of that, the fact that "the call screen statement shows a screen, and then hides it again at the end of the current interaction", as said by the call link I provided before ? I wonder it this could mean that Ren'Py is stopping and waiting for the player to interact with what he have in front of him...



I still have faith in humanity, I still have faith in humanity, [...] I still have faith in humanity...
 

Sander87

Newbie
Dec 14, 2021
33
36
then how do I implement a screen with buttons on them, that can be scroll back and forwards according to button pressed?

I looked at code from other games that do this and they showed me.... same thing! i dont see any checkpoints or anything. just a menu screen with buttons.
what am I missing? can you provide any code that will do what I am looking for?

I also notice that in the label, there is menu options that take user input, yes we can scroll back AND forward according to option chosen.

but not with the screen (map)

how could I implement this? it seems like a simple navigation screen, why so complicated? I tried doing checkpoints but it isnt doing anything or I didnt do right...

Im still waiting for anyone to provide code that could accomplish this....
 

Domiek

In a Scent
Donor
Game Developer
Jun 19, 2018
1,989
10,144
To paraphrase you: so cocky, yet unable to see the forest behind the tree.




Let me explain you, oh great wise man, by convention the [...] mean that you put here whatever you want as code. And in near to six years here, you're only the second I see not having the starts of a clue regarding this.




Oh, you mean like explicitly said as comment in the code I wrote ?




Yeah, as expected by anyone who took the time to . And they also know why, and why it should stay like that:





:FacePalm: I correct what I said on top of this post. It's not the forest behind the tree that you don't see, it's the universe behind the grain of sand.


By the way, this forum should really have a section dedicated to people who want help regarding programming and development. Oh, wait...

I used to work with an engineer that everyone hated because he was perpetually grumpy and talked down to people like they were idiots when he explained things.

Since I was aware that I'm an idiot, I loved interacting with him. He would break things down into the most simplest terms as a way to insult me yet there I was taking notes because it was amazingly useful.

What I'm trying to say is, anne O'nymous , if I ever need help with coding I'm seeking you out. As long as you don't mention my mother, you can unload all of your frustration on me. I'll diligently take notes and appreciate all of the wisdom you're willing to share, you grumpy bastard :LUL:
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,223
Since I was aware that I'm an idiot, I loved interacting with him. He would break things down into the most simplest terms as a way to insult me yet there I was taking notes because it was amazingly useful.
To be fair, if effectively I something think that I'm talking to an idiot, it rarely happen. It's more that I have the (bad ?) habit to speak frankly. I don't believe in sugar coated speeches. There's no shame in not knowing, nor in being bad at something, only in not trying to improve (because we can all improve). And sugar coated speeches tend to prevent you to try improving your knowledge.
Then, on top of this, sometimes it happen that I answer after (or during, lucky me) a hard day at works and have even less patience than usual. The two together rarely mix well... Hence my rant regarding the use of show/pause in place of call ; 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.

This said, one thing is sure, as rude as I can be, it need really more than an exchange like this one for me to insult someone. In fact, I don't remember having done it in a thread where someone was asking for help ; in other threads it's something else... I guess that having to ask my daughter how to use this fucking smartphone and its wtf interface, despite my years in computer field, is part of the reason. Me too something there's things that are probably relatively obvious and that I totally not understand.


What I'm trying to say is, anne O'nymous , if I ever need help with coding I'm seeking you out. As long as you don't mention my mother, you can unload all of your frustration on me. I'll diligently take notes and appreciate all of the wisdom you're willing to share, you grumpy bastard :LUL:
People are supposed to temperate me, not encourage me ;)
 

Sander87

Newbie
Dec 14, 2021
33
36
anne O'nymous , you write you answer questions online. Answer what?! you haven't offered ANY solution to my problem.

You act like you know stuff and respond very arrogantly, but youve offered NO solutions. You are going on about years in computer field, but if thats the case its very very sad. You really dont seem like you know what you are talking about.

Can you offer a simple code that navigates throught screens and can go forward and backward with scroll wheel?
Look, if you don't know how to just say so. Dont act like you know showing referenced to checkpoints and stuff I tried already...
Im using renpy version 8.0.3
could there be a change that block roll forward past new screens? does anyone know?

still waiting on a solution. its not a long coding I need. anyone can start a new project and in under 15 minutes can make a simple navigation screen and test it out with the features Im trying to do. if they know how...

Ive started 5 new probjects thus far and read PLENTY of documentation and online threads and help forums, but still, I cannot achieve this. Not sure what Im doing wrong.

I've coded php, websites, custom ajax calls from pure javascript, custom libraries, Ive done c#, c++ applications, Ive done mobile apps using Java and Objective C on iphone... Ive even programmed arduinos...
I know there must be some way to achieve this and Im looking for someone who knows and can provide a snipet that actually works.

thanks!
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,223
[...] but still, I cannot achieve this. Not sure what Im doing wrong.
Well, I can help you for this too. You did two things wrong:

Firstly, discarding my first code because you totally failed to understand what [...] mean, and didn't cared to go back to the code once I explained it. With all the experience you have, do I really need to explain you what a template is and how to use it ?

Secondly, discarding my attempts to explain you why, outside of this broken code, it's simply not possible to roll forward through screens.
 

Sander87

Newbie
Dec 14, 2021
33
36
1=> I tried your code. Im not an idiot. I put stuff in the [...]
I understood what you wrote and I tried many variations of this with no avail. I even started a new project just with this. I tried with other ppls code and advice they said. I dunno why you assume I discarded anything. I tried it and many other things...
I responded after and pointed out how it didn't work.

2=> you say its not possible to scroll forward... but wait, then you just admit your previous code doesn't work... that what I want to do is unachievable... completely ruining your first point. If anything I shudda discarded your code since you admit it is not going to achieve what I want....

anyways, at the end of the day, none of this resolves my issue and I am still in the same position. I need a navigation screen that can scroll back and front from, just like the normal menu options from any label...

also, you say its not possible, yet I decompiled other renpy games using un.rpy to look at their code. The achieve what I am asking. The weird part is, in their code, they use jump screen and have buttons to jump to another screen and it works. Not sure why. Is it kuz an older version of renpy? is it something in options that allows them to do this?
its been done and I see it done and it is possible. I am asking how?
you are not really saying how or seem to know how. other than saying "yea it's broken" "yea heres my code that dont do this" "yea its impossible" "yea broken code whatever"

you realize how this is a huge waste and seems, like you dont actually know or have anwsers... You could just say "I dunno how MANY of those other games accomplish this, good luck" instead of "broken code, whatever" and offering stuff that dont work.
Its kind of giving me hope that you know something, but in end wasting lots my time.

if u do know, offer something, if not just be honest, upfront and say it.
thanks.
 

Sander87

Newbie
Dec 14, 2021
33
36
AMAZING!!! I GOT THE ANSWER!!
It was not renpy.checkpoint nor in the Supporting Rollback and Roll Forward section of the documentation. Which is where I had looked even before anne O'nymous mentionned it...
I would indeed seem like this is where one would need to look for rollback codes....

but alas... the answer was in the Screen Statement section of the documentation.

the screen needs to have roll_forward True in it, to allow rolling past it. I have no idea why renpy sets this False by default so as any label can be rolled back and forth, but screens block and once rolled back cannot be rolled forward unless roll_forward is set to true in that screen!
so like this:

screen Map:
roll_forward True
button:
xpos 1000
ypos 500
text "go to Place"
action Jump("place")

Someone online was able to give me this answer. there is so much in the documentation and impossible to know all, this person obvious was experienced in renpy and knew the answer right away! thank you!!

so if anyone else needs to know how to make a navigation screen that doesnt lock the rollback from going forward: roll_forward True
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,223
I dunno why you assume I discarded anything.
Well, because it's the case...


but alas... the answer was in the Screen Statement section of the documentation.
Oh, you mean where the call documentation is ?

Would have I known, I would have provided a link to this page, and insisted on it...


I have no idea why renpy sets this False by default
Hmm, could it be because it's something new (introduced only nine months ago), that rolling forward through screens isn't this necessary (else it would exist since a way longer time) and that its default value is not False but undetermined ?
More precisely it's default value will be the value of config.call_screen_roll_forward ; indeed False by default, but it's a ricochet, not the value of the screen property.