Ren'Py preview and menus

JhOon

Member
Jul 7, 2018
228
67
Hello, my name is jhoon and honestly I'm in need of help,some develop can help me with my game?
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,576
2,204
[...] and honestly I'm in need of help [...]

Yes, yes you are.

You've pretty much said "help", "preview" and "menu".

Erm... what?

The main game menu? Or in-game choice menus?
Preview? Preview of what?

If we're going to help, we need a bit more idea of what the problems are and what exactly you need help with.
 
  • Like
Reactions: JhOon

JhOon

Member
Jul 7, 2018
228
67
Yes, yes you are.

You've pretty much said "help", "preview" and "menu".

Erm... what?

The main game menu? Or in-game choice menus?
Preview? Preview of what?

If we're going to help, we need a bit more idea of what the problems are and what exactly you need help with.
in game choice menus
and i need help with the size of images too.
is too big...

Visit and you'll see
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,576
2,204

Visit and you'll see
The download links on zippyshare don't work. I'm getting "403 Forbidden". You might need to make the files public or something, or create separate public shared links.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,576
2,204
Okay... a few things...

You're using show when you should really be using scene.

show adds an image to the current scene.​
scene clears the scene, then shows the specified image.​
If you only use show, eventually the game will crash because RenPy is trying to keep track of hundreds of pictures all being shown at the same time (even if the player can't see them, because they're hidden by other pictures).​


You've defined some characters, but then not used them.

When you character's "speak", you're using their full names most of the time.​
You have lines like:​
Python:
define h = Character('Hermione', color="#c8ffc8")

label start:

    "Hermione" "Hi Daddy! How was you day today?"
What it should be is:​
Python:
define h = Character('Hermione', color="#c8ffc8")

label start:

    h "Hi Daddy! How was you day today?"
Each time Hermione speaks, you use h. Each time the main character speaks, you use m. If you add more characters, use their character code when they speak too.​
If you need to display some dialogue, but no specific character is speaking - then you don't need to put a character identifier in front of the text. (You're already doing this some of the time, I'm just covering everything).​


Your images are the wrong size.

You've clearly borrowed a lot of images from the internet and because they come from lots of different places, they are lots of different sizes.​
You've told RenPy that your game should run at 1280x720. That's probably the right choice. But even so, some of your images are smaller and some are bigger.​
While you can do things in RenPy to mess with images, that's probably the wrong choice here. What you really need to do is resize the images outside of RenPy, so each image is 1280x720... or at least, the ones used as background images (main pictures with a 16:9 aspect ratio).​
If you have access to Photoshop or another graphics editor you are familiar with... use that.​
If you don't, download and use that.​
Where the image is the wrong size, you'll want to load it into GIMP, resize the image to be 1280x720 and then save it as it's new size. That will sort things out for most images.​
However, you also have some images that were not designed to be backgrounds. Some are portraits, some are just random sizes. Main background images in RenPy are supposed to be 16:9 aspect ratio (like 1280x720 or 1920x1080). It's difficult to say what you should do with these odd sized images. You could put them into a 1280x720 black background and resize the image to be 720 pixels tall and center it, then save it as a normal background. Or you could get more creative and do things like the news channels do with cellphone video and duplicate the image onto the left and right, then blur the sides. Maybe something like:​
bison_logo_720.jpg
You'll need to be creative and it will really come down to what you prefer as a graphics style.​


You also mentioned menus (and therefore choices)...

By far the simplest way to use menus is to jump to a label.​
Something like:​

Python:
define h = Character('Hermione', color="#c8ffc8")
define m = Character('Jhoon', color="#c8c8ff")


label start:

    scene black with fade

    menu:
        "Go to Bathroom":
            jump ch01_bathroom

        "Go to Hallway":
            jump ch01_hallway

        "Go to Kitchen":
            jump ch01_kitchen


label ch01_bathroom:

    scene bathroom_img_01 with dissolve

    "I met [h] in the bathroom."

    m "Hello [h]."
    h "Oh, hi [m]."

    jump ch01_continue


label ch01_hallway:

    scene hallway_img_01 with dissolve

    "I wandered around the hallways for about half an hour. Nothing interesting happened."
    jump ch01_continue


label ch01_kitchen:

    scene kitchen_img_42 with dissolve

    "I went to the kitchens. Nobody was there."
    "So I made myself a cup of coffee and pinched some chocolate from the fridge."
    jump ch01_continue


label ch01_continue:

    "With that out of the way, I returned to my bedroom."

    scene bedroom_img_09 with dissolve

    "... and went to sleep."

    scene black with fade

    "*** THE END ***"

    return

The menu: statement ends in a colon, which means it continues on the line below, but all lines below the "menu" are indented by 4 spaces.​
Reminder:​
Python:
    menu:
        "Go to Bathroom":
            jump ch01_bathroom

        "Go to Hallway":
            jump ch01_hallway

        "Go to Kitchen":
            jump ch01_kitchen
Each menu choice is just a string of characters. Choices too end with a colon.​
So finally, again indented by 4 spaces, are all the commands you want to be executed when the player picks that menu choice. In this case, there is only a single line with jump. Though you can put any RenPy commands here and as many as you like.​
I've called my labels "ch01_something", because I'm assuming this is "chapter 1" and I want to make sure my label names are all unique. Which helps when you want to go to the kitchen again in chapter 3 or something. It's purely a personal habit of mine, you can name them whatever you like.​
I also use their Character() objects when mentioning character names in dialogue. Personal preference. I do it because it means I can rename characters any time I please... or let the player pick names. It's also quicker to type. All you need to do is put the name of a variable within square brackets. So [m] just means swap "[m]" for the value of the character m's name.​
The single line containing a jump is by far the simplest answer, but you could do this as an alternative:​

Python:
define h = Character('Hermione', color="#c8ffc8")
define m = Character('Jhoon', color="#c8c8ff")


label start:

    scene black with fade

    menu:
        "Go to Bathroom":
            scene bathroom_img_01 with dissolve
            "I met [h] in the bathroom."
            m "Hello [h]."
            h "Oh, hi [m]."

        "Go to Hallway":
            scene hallway_img_01 with dissolve
            "I wandered around the hallways for about half an hour. Nothing interesting happened."

        "Go to Kitchen":
            scene kitchen_img_42 with dissolve
            "I went to the kitchens. Nobody was there."
            "So I made myself a cup of coffee and pinched some chocolate from the fridge."


    "With that out of the way, I returned to my bedroom."

    scene bedroom_img_09 with dissolve

    "... and went to sleep."

    scene black with fade

    "*** THE END ***"

    return
When all the commands for the selected menu choice have all been executed, RenPy will go back up through each indentation level until it finds the next commands at the same level of indentation as the original menu: command.​
Sometimes, you want the game to remember what choices the player has made. At that point, you are going to want variables. Variables are just a name of an area of memory where things are stored. You can store numbers (integers), text (strings) or Yes/No, True/False (boolean) variable types. There are more types, but those are the "starter" ones.​
I wrote an introduction to basic variables a while ago, maybe it will help, if you're going to want to start remembering choices or storing player stats or something.​
So maybe you want to remember you met Hermione or maybe you want to count how many times the player fell asleep...​

Python:
define h = Character('Hermione', color="#c8ffc8")
define m = Character('Jhoon', color="#c8c8ff")

default met_hermione = False
default player_slept = 0

label start:

    scene black with fade

    menu:
        "Go to Bathroom":
            scene bathroom_img_01 with dissolve
            "I met [h] in the bathroom."
            m "Hello [h]."
            h "Oh, hi [m]."
            $ met_hermione = True

        "Go to Hallway":
            scene hallway_img_01 with dissolve
            "I wandered around the hallways for about half an hour. Nothing interesting happened."

        "Go to Kitchen":
            scene kitchen_img_42 with dissolve
            "I went to the kitchens. Nobody was there."
            "So I made myself a cup of coffee and pinched some chocolate from the fridge."


    "With that out of the way, I returned to my bedroom."

    scene bedroom_img_09 with dissolve

    if met_hermione == False:
        "... and went to sleep."
    else:
        "... and went to sleep, thinking of [h]."

    $ player_slept += 1

    scene black with fade

    "*** THE END ***"

    return

Finally, maybe you want to let the player pick their own character name...

Python:
define h = Character('Hermione', color="#c8ffc8")
define m = Character('[player_name]', color="#c8c8ff")

default player_name = "Unnamed"
default met_hermione = False
default player_slept = 0

label start:

    scene black with fade

    $ player_name = renpy.input("What is your name?", length=20)
    $ player_name = player_name.strip() or "Jhoon"

    "Welcome [m]."

    menu:
        # blah, blah, more code.

In this case, I'm asking the player what they want to name themselves and storing it in the player_name variable. Which means I can get away with swapping the name in the main character's Character() to "[player_name]". But I can still use [m] to show the name too.​
 
Last edited:

JhOon

Member
Jul 7, 2018
228
67
Tᕼ᙭ ᗷᖇO,I'ᒪᒪ ᗰᗩᑎᗩᘜᗴ IT ՏOOᑎ Tᕼᗴᑎ I'ᒪᒪ ՏᕼOᗯᗷTO YOᑌ,YOᑌ'ᒪᒪ ᗩᗷᒪᗴ TO Kᗴᗴᑭ ᕼᗴᒪᑭIᑎᘜ ᗰᗴ,ᑕᗩᑌՏᗴᗷI ᗪOᑎT ᗯᗩᑎT TO ᗪIՏTᑌᖇᗷ YOᑌ!
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,576
2,204
Your game gives me the impression that you're still at the "learning" early stages.

Rather than asking questions here, it might be worth just spending a bit of time checking out a few tutorials first.

I would recommend:

Official RenPy Quickstart guide and Language basics:


Elaine's Tutorial (YouTube):


Thundorn's Tutorial (YouTube):



Elaine's guide is easier to follow, but Thundorn's is more comprehensive. I suggest watching both.
 
  • Red Heart
Reactions: JhOon

JhOon

Member
Jul 7, 2018
228
67
thank you now what i really dont understand is,what are all these menus for, what should i do with them?
 

moskyx

Engaged Member
Jun 17, 2019
3,969
12,778
thank you now what i really dont understand is,what are all these menus for, what should i do with them?
You are telling a story, and then at some point you let players decide how to continue that story. Will they enter the bathroom, or maybe they'd prefer to go to the kitchen? You give them those options with menus, as in 79flavors examples. After each menu option, you write that piece of story or you use jump to go to another part of the script (another label) where that story is written.

Really, if you need to have this explained, you should first take a look at guides and tutorials, maybe in your own language if possible (youtube would be a nice place to search, I'm almost sure you'll find something in Portuguese)
 

EmiBaio

New Member
Mar 14, 2022
5
2
Okay... a few things...

You're using show when you should really be using scene.

show adds an image to the current scene.​
scene clears the scene, then shows the specified image.​
If you only use show, eventually the game will crash because RenPy is trying to keep track of hundreds of pictures all being shown at the same time (even if the player can't see them, because they're hidden by other pictures).​


You've defined some characters, but then not used them.

When you character's "speak", you're using their full names most of the time.​
You have lines like:​
Python:
define h = Character('Hermione', color="#c8ffc8")

label start:

    "Hermione" "Hi Daddy! How was you day today?"
What it should be is:​
Python:
define h = Character('Hermione', color="#c8ffc8")

label start:

    h "Hi Daddy! How was you day today?"
Each time Hermione speaks, you use h. Each time the main character speaks, you use m. If you add more characters, use their character code when they speak too.​
If you need to display some dialogue, but no specific character is speaking - then you don't need to put a character identifier in front of the text. (You're already doing this some of the time, I'm just covering everything).​


Your images are the wrong size.

You've clearly borrowed a lot of images from the internet and because they come from lots of different places, they are lots of different sizes.​
You've told RenPy that your game should run at 1280x720. That's probably the right choice. But even so, some of your images are smaller and some are bigger.​
While you can do things in RenPy to mess with images, that's probably the wrong choice here. What you really need to do is resize the images outside of RenPy, so each image is 1280x720... or at least, the ones used as background images (main pictures with a 16:9 aspect ratio).​
If you have access to Photoshop or another graphics editor you are familiar with... use that.​
If you don't, download and use that.​
Where the image is the wrong size, you'll want to load it into GIMP, resize the image to be 1280x720 and then save it as it's new size. That will sort things out for most images.​
However, you also have some images that were not designed to be backgrounds. Some are portraits, some are just random sizes. Main background images in RenPy are supposed to be 16:9 aspect ratio (like 1280x720 or 1920x1080). It's difficult to say what you should do with these odd sized images. You could put them into a 1280x720 black background and resize the image to be 720 pixels tall and center it, then save it as a normal background. Or you could get more creative and do things like the news channels do with cellphone video and duplicate the image onto the left and right, then blur the sides. Maybe something like:​
You'll need to be creative and it will really come down to what you prefer as a graphics style.​


You also mentioned menus (and therefore choices)...

By far the simplest way to use menus is to jump to a label.​
Something like:​

Python:
define h = Character('Hermione', color="#c8ffc8")
define m = Character('Jhoon', color="#c8c8ff")


label start:

    scene black with fade

    menu:
        "Go to Bathroom":
            jump ch01_bathroom

        "Go to Hallway":
            jump ch01_hallway

        "Go to Kitchen":
            jump ch01_kitchen


label ch01_bathroom:

    scene bathroom_img_01 with dissolve

    "I met [h] in the bathroom."

    m "Hello [h]."
    h "Oh, hi [m]."

    jump ch01_continue


label ch01_hallway:

    scene hallway_img_01 with dissolve

    "I wandered around the hallways for about half an hour. Nothing interesting happened."
    jump ch01_continue


label ch01_kitchen:

    scene kitchen_img_42 with dissolve

    "I went to the kitchens. Nobody was there."
    "So I made myself a cup of coffee and pinched some chocolate from the fridge."
    jump ch01_continue


label ch01_continue:

    "With that out of the way, I returned to my bedroom."

    scene bedroom_img_09 with dissolve

    "... and went to sleep."

    scene black with fade

    "*** THE END ***"

    return

The menu: statement ends in a colon, which means it continues on the line below, but all lines below the "menu" are indented by 4 spaces.​
Reminder:​
Python:
    menu:
        "Go to Bathroom":
            jump ch01_bathroom

        "Go to Hallway":
            jump ch01_hallway

        "Go to Kitchen":
            jump ch01_kitchen
Each menu choice is just a string of characters. Choices too end with a colon.​
So finally, again indented by 4 spaces, are all the commands you want to be executed when the player picks that menu choice. In this case, there is only a single line with jump. Though you can put any RenPy commands here and as many as you like.​
I've called my labels "ch01_something", because I'm assuming this is "chapter 1" and I want to make sure my label names are all unique. Which helps when you want to go to the kitchen again in chapter 3 or something. It's purely a personal habit of mine, you can name them whatever you like.​
I also use their Character() objects when mentioning character names in dialogue. Personal preference. I do it because it means I can rename characters any time I please... or let the player pick names. It's also quicker to type. All you need to do is put the name of a variable within square brackets. So [m] just means swap "[m]" for the value of the character m's name.​
The single line containing a jump is by far the simplest answer, but you could do this as an alternative:​

Python:
define h = Character('Hermione', color="#c8ffc8")
define m = Character('Jhoon', color="#c8c8ff")


label start:

    scene black with fade

    menu:
        "Go to Bathroom":
            scene bathroom_img_01 with dissolve
            "I met [h] in the bathroom."
            m "Hello [h]."
            h "Oh, hi [m]."

        "Go to Hallway":
            scene hallway_img_01 with dissolve
            "I wandered around the hallways for about half an hour. Nothing interesting happened."

        "Go to Kitchen":
            scene kitchen_img_42 with dissolve
            "I went to the kitchens. Nobody was there."
            "So I made myself a cup of coffee and pinched some chocolate from the fridge."


    "With that out of the way, I returned to my bedroom."

    scene bedroom_img_09 with dissolve

    "... and went to sleep."

    scene black with fade

    "*** THE END ***"

    return
When all the commands for the selected menu choice have all been executed, RenPy will go back up through each indentation level until it finds the next commands at the same level of indentation as the original menu: command.​
Sometimes, you want the game to remember what choices the player has made. At that point, you are going to want variables. Variables are just a name of an area of memory where things are stored. You can store numbers (integers), text (strings) or Yes/No, True/False (boolean) variable types. There are more types, but those are the "starter" ones.​
I wrote an introduction to basic variables a while ago, maybe it will help, if you're going to want to start remembering choices or storing player stats or something.​
So maybe you want to remember you met Hermione or maybe you want to count how many times the player fell asleep...​

Python:
define h = Character('Hermione', color="#c8ffc8")
define m = Character('Jhoon', color="#c8c8ff")

default met_hermione = False
default player_slept = 0

label start:

    scene black with fade

    menu:
        "Go to Bathroom":
            scene bathroom_img_01 with dissolve
            "I met [h] in the bathroom."
            m "Hello [h]."
            h "Oh, hi [m]."
            $ met_hermione = True

        "Go to Hallway":
            scene hallway_img_01 with dissolve
            "I wandered around the hallways for about half an hour. Nothing interesting happened."

        "Go to Kitchen":
            scene kitchen_img_42 with dissolve
            "I went to the kitchens. Nobody was there."
            "So I made myself a cup of coffee and pinched some chocolate from the fridge."


    "With that out of the way, I returned to my bedroom."

    scene bedroom_img_09 with dissolve

    if met_hermione == False:
        "... and went to sleep."
    else:
        "... and went to sleep, thinking of [h]."

    $ player_slept += 1

    scene black with fade

    "*** THE END ***"

    return

Finally, maybe you want to let the player pick their own character name...

Python:
define h = Character('Hermione', color="#c8ffc8")
define m = Character('[player_name]', color="#c8c8ff")

default player_name = "Unnamed"
default met_hermione = False
default player_slept = 0

label start:

    scene black with fade

    $ player_name = renpy.input("What is your name?", length=20)
    $ player_name = player_name.strip() or "Jhoon"

    "Welcome [m]."

    menu:
        # blah, blah, more code.

In this case, I'm asking the player what they want to name themselves and storing it in the player_name variable. Which means I can get away with swapping the name in the main character's Character() to "[player_name]". But I can still use [m] to show the name too.​
thanks so much sir, u help me a lot
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,174
79_flavors has the patience of a saint.
He's my counterpart.

More seriously, I guess that, like me when I have the time, when he answer he don't think solely about the poster, but also about the many readers that will come later with an issue similar but yet a bit different. Explaining the details, and covering all the bases, is the best way to have an answer that will also help them despite those differences between their issue and the one he answered to.