How to Start Ren'Py For Beginners!

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
cuitlauchan
Newbie
Posts: 3
Joined: Sat May 23, 2015 4:46 am
Contact:

How to Start Ren'Py For Beginners!

#1 Post by cuitlauchan »

How to start Ren'Py for Beginners


Creating A New Project
1. Launch Ren ‘Py.
2. Click on Create New Project.
3. Follow the steps asked in the program.

Getting Basic Resources
1. Start by finding a background, two sprites (two character images with a transparent background), two different music files (download an mp3 file). Make sure to name them with easy to remember and type names (eg. school, girl, sad_music).
2. Transfer them into your Game folder (it’s in your projects directory). Click on Game Name > Game and drag the files there.

Writing the Code
1. Click on script.rpy under Edit File.
2. I recommend using Editra for beginners. :D

Images
3. Declare (basically just type) images into its “memory” by typing image file alias = “filename.
image girl happy = “girl_happy.jpg”
4. Do the same with the other images. In this portion, you will come back everytime you want to add an image to its “memory” to declare the image. Without doing this, your images won’t show up.

Characters
5. Declare characters to be used in the game by typing define alias = Character('Name', color="hex code”).
define g = Character(‘Girl', color="#000")
Setting the Visuals
6. Type label start: in another line after your images declaration part.
7. Start another line for each command.
8. Type play music “filename.mp3” fadein 1 (second for music to fade in).
9. Type scene image alias to show the background image.
10. Type show image alias at position (center, left, right) to show your sprite (character) and just repeat if you want to add another sprite.

Basic Script
11. Input the alias for your character “girl” (g) and the speech like this.
g "You've created a new Ren'Py game."
12. Input another alias and speech to make conversation happen.
b "Once you add a story, pictures, and music, you can release it to the world!"
Choices
13. Type menu: on another line to state choices to be shown.
14. Type the speech.
menu:
"How does it work?":
15. Now, type jump label name. You’ll understand later. For now type something like girlboyexplains. Basically, something that titles the reaction of your characters.
16. Type another speech choice.

Code: Select all

 menu:
        "How does it work?":
            jump girlboyexplains
        "Psh... I already know how to use it, idiots.":
            jump girlboygetsmad
   
17. Now onto what jump does. It means that it will show the label (these are group of speeches) that it states if the previous choice is clicked.
18. Type label label name:
19. Input the character alias and speech you want the character to respond to the choice (eg. You: “How does it work?” Girl: “Search up tutorials in the internet.”) and type return.
20. It should now look like this.

Code: Select all

 menu:
        "How does it work?":
            jump girlboyexplains
        "Psh... I already know how to use it, idiots.":
            jump girlboygetsmad
    label girlboyexplains:
        g "Search up tutorials in the internet."
        b "And you will find out!"
21. Make another label for the second choice/menu, but, before the speech line, we’re going to spice things up by changing the music. Type stop music to stop the previous music playing. Then, on another line, type play music “filename.mp3” fadein 3.
22. To put something like good end or bad end, add image black = "#000" to the image declaration part to represent the background color. Then, at the very end of each of your label code, before return, put:

Code: Select all

show black
centered "{size=+10}Good End{/size}"
23. To help you navigate the code, add comments. Anything after a hashtag (#) is considered a comment that won't be identified as a command.
Annnnd… That’s a wrap! :D You’ve now learned the basics! If your code looks something like this:

Code: Select all

#here are where images are declared
image girl = "girl.jpg"
image boy = "boy.jpg"
image school = "school.jpg"

# Declare characters used by this game.
define g = Character('Girl', color="#000")
define b = Character('Boy', color="#000")

# The game starts here.
label start:
    play music "Happy.mp3" fadein 1
    scene school
    show girl at center

    g "You've created a new Ren'Py game."
    
    b "Once you add a story, pictures, and music, you can release it to the world!"
    
    menu:
        "How does it work?":
            jump girlboyexplains
        "Psh... I already know how to use it, idiots.":
            jump girlboygetsmad
label girlboyexplains:
     g "Search up tutorials in the internet."
     b "And you will find out!"
        
     show black
     centered "{size=+10}Good End{/size}"
        
     return
        
label girlboygetsmad:
     stop music
     play music "Suspicion.mp3" fadein 3
     g "Oh my..."
     "Girl rolls her eyes."
      b "Show us then."
     "Boy crosses his arms."
        
      show black
      centered "{size=+10}Bad End{/size}"
    
       return
Then… CONGRATULATIONS! YOU DID IT!*grins* Just mix and match all the basic functions, and you’ll have a good Visual Novel in no time.

But if you didn’t get it right…. Don’t worry! Just read the instructions again and revise the mistakes. If you’re too lazy to find out your mistakes manually, try launching the game from Ren ‘Py. A prompt will show the lines you did wrong. Don’t give up!

For those of you who got it, spice your game up by adding advanced functions :lol: I will update the original post in accordance to your suggestions *salutes everyone* 8)

I'd really appreciate it if I was credited for the tutorial in your very first game, since I did spent two good hours on typing this up :wink: And do send your games to me! I'm excited to try them out :D

I love y'all <3

Byeeeeee! *flys away* :wink:
Last edited by cuitlauchan on Sun May 24, 2015 3:11 am, edited 8 times in total.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How to Start Ren'Py For Beginners!

#2 Post by trooper6 »

Your example of the code is all center justified, which means it has none of the proper indentation. Code needs to have the proper indentation and that is something new folks often have trouble with. I'd recommend fixing that.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
cuitlauchan
Newbie
Posts: 3
Joined: Sat May 23, 2015 4:46 am
Contact:

Re: How to Start Ren'Py For Beginners!

#3 Post by cuitlauchan »

@trooper6

Woopsie, I better change that. Thanks for the reminder! :)

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How to Start Ren'Py For Beginners!

#4 Post by trooper6 »

The code is no longer center justified, but the indentation is all messed up and needs to be fixed. Also the first menu code block is missing colons, which will cause errors.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
cuitlauchan
Newbie
Posts: 3
Joined: Sat May 23, 2015 4:46 am
Contact:

Re: How to Start Ren'Py For Beginners!

#5 Post by cuitlauchan »

trooper6 wrote:The code is no longer center justified, but the indentation is all messed up and needs to be fixed. Also the first menu code block is missing colons, which will cause errors.
Fixed :)

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How to Start Ren'Py For Beginners!

#6 Post by trooper6 »

Your labels girlboyexplains and girlboygetmad are indented (placing them inside label start block) and they shouldn't be, because they are their own block.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: How to Start Ren'Py For Beginners!

#7 Post by xavimat »

For beginners, I'd suggest the use of the "images" directory instead of the "image" statement. It's easier and very intuitive.
http://renpy.org/doc/html/displaying_im ... ing-images
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Re: How to Start Ren'Py For Beginners!

#8 Post by mitoky »

Hello! I would have 2 questions, they may be a bit weird but i dont know who else to ask xD''
I am a complete beginner, learning about coding right now with the tutorial. I did try it before,years ago, once and even managed a bit.

Anyways, my 2 questions are:

1.) Since i am a beginner, i will use editra but is there anything editra can't do, which jedit can do?

2.) This one might be a bit weird but do tabs/space bars affect the game? (when using it for "sorting")
I am asking this because, i hate it when text is written in a way its hard to find things, and sometimes the text stayed in the beginning so i pressed tab to make them all a bit farther. (A year ago when i tried it the first time)
However, i got an error then and after deleting the tabs and using space bars to "sort" the text instead, it worked and there was no error. Can i make spacebars then whenever i want to make it more readable? (the empty space till the text starts, as example i screenshoted what i mean)

I am sorry if they are unneeded or weird questions, but i rather ask about it then not knowing and being unsure!
Attachments
1111.PNG
1111.PNG (6.25 KiB) Viewed 12118 times

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How to Start Ren'Py For Beginners!

#9 Post by trooper6 »

I've never used Jedit, so I can't answer your first question.

For your second question, tabs and spaces are part of the coding, so you can't just do whatever you like in that respect.
Each tab (or 4 spaces) marks a block of code. This is discussed here: http://www.renpy.org/doc/html/language_ ... and-blocks
Be very careful with your spacing.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Re: How to Start Ren'Py For Beginners!

#10 Post by mitoky »

Thank you ver much! Its really helps a lot (:

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: How to Start Ren'Py For Beginners!

#11 Post by Donmai »

The main differences between the two editors are that jEdit requires java, while Editra doesn't. And jEdit is a better choice for people who are using non-English systems. When I tried to use Editra it frequently "forgot' the encoding of its files and choked with accented characters.
Last edited by Donmai on Fri Aug 28, 2015 2:12 pm, edited 1 time in total.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
bloodyhair
Regular
Posts: 61
Joined: Tue Aug 11, 2015 7:20 am
Deviantart: Takada-Wang
Contact:

Re: How to Start Ren'Py For Beginners!

#12 Post by bloodyhair »

I wonder, if I using JEdit before and change the setting into Editra, would my previous code deleted or crash or it would just automatically adjust?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How to Start Ren'Py For Beginners!

#13 Post by PyTom »

You should be able to switch back and forth at will. (Just close the previous editor beforehand, as having it open twice could be confusing.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
bloodyhair
Regular
Posts: 61
Joined: Tue Aug 11, 2015 7:20 am
Deviantart: Takada-Wang
Contact:

Re: How to Start Ren'Py For Beginners!

#14 Post by bloodyhair »

Thank you :D

Post Reply

Who is online

Users browsing this forum: No registered users