New to Renpy and Coding in general, need help :)

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.
Message
Author
Senpai
Newbie
Posts: 18
Joined: Thu Jul 21, 2016 4:54 pm
Contact:

New to Renpy and Coding in general, need help :)

#1 Post by Senpai »

Hi. I've spent the last week reading on Renpy and all that it does, although I kinda didn't understand a lot of it. From what I've understand, I've got the basics down. I'm confident that I could make a traditional VN style game (no interaction other than choices), with menus and flags. But it ends there and it's not the type of game I want to make.

The game I'm thinking of is easily made in RAGs, but I would rather use Renpy, because I find it, for no better words, prettier.

What do I have for now? I have a pseudo start that should take the player into the game, like this:

Code: Select all

# The game starts here.
label start:

    scene bg black
    with fade

    "????" "Hello everyone! You can all call me Senpai!"

    scene bg shark
    with fade
    pause 2
    
    scene bg black
    with fade
    
    s "Not only is this is my very first project, I'm also just starting to learn to code..."    
    s "So please understand that there will be bugs and I would love if you guys could report them to one of my official threads!"
    s "Where is that you ask? It's where you downloaded it dummy!"
    s "Anyhow, please enjoy the game and don't forget to give me feedback!"

    menu:
        
        "Watch Intro":
            
            jump intro

        "Skip Intro":

            jump skip

label intro:

    s "This is where the intro of the game should be, IF I HAD ONE!"
    s "Well, let's jump into the game!"
    jump game

label skip:
    
    s "Seems like you are not a big fan of introes... Let's go for the game then!"
    jump game
        
label game:

    scene bg broom
    with fade
    
    s "Well, still no game, guess this is it, eh?"

    return
So, when the Label Game starts and it scenes into the Bed Room, the "Game" should start and allow the MC to do stuff in a RAGs style of fashion, there should be a little icon on top of the Bed that says "Sleep" and on at the bottom left of the screen that says "Living Room". "Sleep" would only show after 8 PM, and it would force MC to "Sleep" until 6:30 AM. "Living Room" would make MC jump into the next bg, the "Living Room", that would be connected to the "Bathroom" and "Guest Bedroom". The "Living Room" has a Kitchen, that would allow the MC to "Eat", this would restore a portion of his "Energy", that slowly depletes with actions.

From the little I've understood of Renpy (granted, not that much), I seem to need a framework to facilitate said coding? Would appreciate the help!

User avatar
Evildumdum
Regular
Posts: 191
Joined: Sun Jan 18, 2015 8:49 am
Projects: ApoclypseZ
Contact:

Re: New to Renpy and Coding in general, need help :)

#2 Post by Evildumdum »

Ok, if you want buttons and such then you need to look into screens and imagebuttons / textbuttons. There are plenty of guides if you search the forums and google. I would also reccomend you familiarise yourself with the basics of python scrips as this will be a huge help to you.
"If at first you don't succeed, try hitting it with a shoe."

Senpai
Newbie
Posts: 18
Joined: Thu Jul 21, 2016 4:54 pm
Contact:

Re: New to Renpy and Coding in general, need help :)

#3 Post by Senpai »

Evildumdum wrote:Ok, if you want buttons and such then you need to look into screens and imagebuttons / textbuttons. There are plenty of guides if you search the forums and google. I would also reccomend you familiarise yourself with the basics of python scrips as this will be a huge help to you.
Hm... So by putting in these "menus" as jump points, using imagebuttons/textbuttons, I don't really need a framework to work with? Also, that doesn't help much, that is the equivalent of telling someone who is unhealthy and looking to improve that he has to "Eat right and familiarize himself with exercises".

What I need is a good example of this, a topic of someone who asked this kind of help and got it, a link to a guide or tutorial that shows this.

User avatar
andrewngn13
Regular
Posts: 65
Joined: Thu Nov 13, 2014 2:41 pm
Projects: Recast
Skype: andrewngn13
Location: Glued to my desktop
Contact:

Re: New to Renpy and Coding in general, need help :)

#4 Post by andrewngn13 »

1. I have no idea what RAGS is.
2. A framework is just code created and openly distributed to have certain functions, such as adding a rpg battle or time management assets. Understanding and using that code is up to you.
2. It sounds like you just want an imagemap or image button for transition between scenes. Probably some variable if statements to determine if they show or not.
leon/mugen based image button guide: viewtopic.php?f=51&t=22565
Aleema's styling + imagemap guide: viewtopic.php?f=8&t=9812
Last edited by andrewngn13 on Thu Jul 21, 2016 8:44 pm, edited 1 time in total.
"Feel feel to idea-bounce off me."
No, like seriously, just send a pm and I'll respond what I think. I'm open to reading anything.

Senpai
Newbie
Posts: 18
Joined: Thu Jul 21, 2016 4:54 pm
Contact:

Re: New to Renpy and Coding in general, need help :)

#5 Post by Senpai »

andrewngn13 wrote:1. I have no idea what RAGS is.
2. A framework is just code created and openly distributed to have certain functions, such as adding a rpg battle or time management assets. Understanding and using that code is up to you.
2. It sounds like you just want an imagemap or image button for transition between scenes. Probably some variable if statements to determine if they show or not.
leon/mugen based image button guide: viewtopic.php?f=51&t=22565
Aleema's styling + imagemap guide:viewtopic.php?f=8&t=9812
Indeed, I used Luxliev guide (viewtopic.php?f=51&t=35931) and was able to accomplish what I needed.

Learned that in order to transition from the "Story" to the "Game", I needed to "Call Screen", also understood how to use Imagemap in order to create "Jumps" to transition from screen to screen. It looked like this:

Code: Select all

screen broom:
    imagemap:
        ground 'Bedroom.png'
        idle 'Bedroom.png'
        hover ''

        hotspot(53,506,232,63) clicked Jump("lr")
And the call like this:

Code: Select all

call screen broom
This leads me into a question:

In the "Images" folder, how do I call an image inside another folder? I want to keep a "BG" folder for the BG, a "Screen" for the screens and so on.

User avatar
chocoberrie
Veteran
Posts: 254
Joined: Wed Jun 19, 2013 10:34 pm
Projects: Marshmallow Days
Contact:

Re: New to Renpy and Coding in general, need help :)

#6 Post by chocoberrie »

Senpai wrote:In the "Images" folder, how do I call an image inside another folder? I want to keep a "BG" folder for the BG, a "Screen" for the screens and so on.
All you need to do is specify the file path, like this:

Code: Select all

image forest bg = "BG/forest bg.jpg"
The folder that forest bg.jpg is in is called BG.

If you want to use subfolders, just add the subfolder with another forward slash, like this:

Code: Select all

image forest bg = "BG/forest/forest bg.jpg"
Now, forest bg.jpg is in the forest folder within the BG folder.

As for imagemaps and imagebuttons, I have thorough tutorial series for both of these. Here is the imagemap tutorial, and here is the imagebutton tutorial.

Hope this helps! :)

Senpai
Newbie
Posts: 18
Joined: Thu Jul 21, 2016 4:54 pm
Contact:

Re: New to Renpy and Coding in general, need help :)

#7 Post by Senpai »

chocoberrie wrote:
Senpai wrote:In the "Images" folder, how do I call an image inside another folder? I want to keep a "BG" folder for the BG, a "Screen" for the screens and so on.
All you need to do is specify the file path, like this:

Code: Select all

image forest bg = "BG/forest bg.jpg"
The folder that forest bg.jpg is in is called BG.

If you want to use subfolders, just add the subfolder with another forward slash, like this:

Code: Select all

image forest bg = "BG/forest/forest bg.jpg"
Now, forest bg.jpg is in the forest folder within the BG folder.

As for imagemaps and imagebuttons, I have thorough tutorial series for both of these. Here is the imagemap tutorial, and here is the imagebutton tutorial.

Hope this helps! :)
I see, thanks.

Now that things are starting to get in order, I have a new question:

How do I use more than a single script? As of right now I'm only using script.rpy, but I would like to separate scripts for every major thing, such as a script that involves the house, a script of one of the major NPC, and so on.

User avatar
chocoberrie
Veteran
Posts: 254
Joined: Wed Jun 19, 2013 10:34 pm
Projects: Marshmallow Days
Contact:

Re: New to Renpy and Coding in general, need help :)

#8 Post by chocoberrie »

You can certainly use more than one script file, yes. :)

According to the Quickstart:

"Labels may be defined in any file that is in the game directory, and ends with .rpy. The filename doesn't matter to Ren'Py, only the labels contained within it. A label may only appear in a single file."

For example, you can have a script file named "house script.rpy" and use jump statements from the main script to jump to it. Like this:

In script.rpy (the "main" script):

Code: Select all

label start:
    # code here

label scene:
    # code here
    jump label house_script
In "house script.rpy" (the house part you want to separate):

Code: Select all

label house_script:
    # code here
So when Ren'Py reaches the jump label in the main script, it'll run the code that comes under that label, even if it's written out in a separate script file.

If you want to return to the main script afterwards, you can use another jump statement:

In "house script.rpy":

Code: Select all

label house_script:
    # code here
    jump label NPC_scene
In script.rpy (the "main script"):

Code: Select all

label start:
    # code here
label scene:
    # code here
    jump label house_script
label NPC_scene
    # code here

Senpai
Newbie
Posts: 18
Joined: Thu Jul 21, 2016 4:54 pm
Contact:

Re: New to Renpy and Coding in general, need help :)

#9 Post by Senpai »

chocoberrie wrote:You can certainly use more than one script file, yes. :)

According to the Quickstart:

"Labels may be defined in any file that is in the game directory, and ends with .rpy. The filename doesn't matter to Ren'Py, only the labels contained within it. A label may only appear in a single file."

For example, you can have a script file named "house script.rpy" and use jump statements from the main script to jump to it. Like this:

In script.rpy (the "main" script):

Code: Select all

label start:
    # code here

label scene:
    # code here
    jump label house_script
In "house script.rpy" (the house part you want to separate):

Code: Select all

label house_script:
    # code here
So when Ren'Py reaches the jump label in the main script, it'll run the code that comes under that label, even if it's written out in a separate script file.

If you want to return to the main script afterwards, you can use another jump statement:

In "house script.rpy":

Code: Select all

label house_script:
    # code here
    jump label NPC_scene
In script.rpy (the "main script"):

Code: Select all

label start:
    # code here
label scene:
    # code here
    jump label house_script
label NPC_scene
    # code here
Oh, sounds simple enough, thanks. That means, if I wanted, I could just create a Script called BG Script, with every single BG, making it easier to look it up in case of using other scripts and I want a specific BG, right? Also, is there a simple way to create a new script or do I have to create a file ending with .rpy and open All Script files on the Ren'Py launcher?

User avatar
chocoberrie
Veteran
Posts: 254
Joined: Wed Jun 19, 2013 10:34 pm
Projects: Marshmallow Days
Contact:

Re: New to Renpy and Coding in general, need help :)

#10 Post by chocoberrie »

Senpai wrote:That means, if I wanted, I could just create a Script called BG Script, with every single BG, making it easier to look it up in case of using other scripts and I want a specific BG, right?
Yep! You can do this, as long as you define the background images properly. Also, make sure that the image tags match throughout all of the scripts so that you don't have to go hunting for errors everywhere.
Senpai wrote:Also, is there a simple way to create a new script or do I have to create a file ending with .rpy and open All Script files on the Ren'Py launcher?
Yes, you can use an editor to create new script files and save them with the .rpy extension (just type .rpy in the file name when you save the script as a .txt file). You don't have to open all the script files in the Ren'Py launcher; you can use an editor, or you can go into the game folder and open the script file directly by double clicking on it. I like using Notepad++ to write and edit scripts; it's free and you can set it up to work with Ren'Py coding easily.

Senpai
Newbie
Posts: 18
Joined: Thu Jul 21, 2016 4:54 pm
Contact:

Re: New to Renpy and Coding in general, need help :)

#11 Post by Senpai »

Ah, I see, thanks.

I'm using Editra, and I got to say, I like it.

OK, now it's time for me to search a way to create an In-game Time, that will be directly related to every single event in the game. The idea here is that every time I "Jump" an X amount of time will pass. If anyone knows a good tutorial for that, please post. If I'm able to do it before anyone posted it, I will edit this one and post how I did it, for future reference.

User avatar
andrewngn13
Regular
Posts: 65
Joined: Thu Nov 13, 2014 2:41 pm
Projects: Recast
Skype: andrewngn13
Location: Glued to my desktop
Contact:

Re: New to Renpy and Coding in general, need help :)

#12 Post by andrewngn13 »

Wouldn't you just...create a variable and increment when you "Jump".
"Feel feel to idea-bounce off me."
No, like seriously, just send a pm and I'll respond what I think. I'm open to reading anything.

Senpai
Newbie
Posts: 18
Joined: Thu Jul 21, 2016 4:54 pm
Contact:

Re: New to Renpy and Coding in general, need help :)

#13 Post by Senpai »

andrewngn13 wrote:Wouldn't you just...create a variable and increment when you "Jump".
Sorry, like I said, I'm completely new at coding. So even if something may seem simple for you, it won't ring any bells for me. If you could, mind giving an example? Or posting a link to a tutorial or something?

For starters, I still don't know how to show a text of something that will stick with the MC, like, showing a "Time" on the right top corner, that is text based instead of an imagemap. The best that I can come up with would be overly complicated and the only tutorials about clocks are real time clocks using ATL.

Depending on how the "Clock" is made, it may be easy to set variables in order to flag events, but I still need the clock XD

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: New to Renpy and Coding in general, need help :)

#14 Post by trooper6 »

You could use my clock code. It has an analog and a digital version. It has real time, automatic time, and plain old you can add time as you like time. It is a UDD rather than ATL. You just make it digital, put it on a screen in the upper right corner (or wherever you want it), and add time whenever you jump.

The link to my clock is in my sig.
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

Senpai
Newbie
Posts: 18
Joined: Thu Jul 21, 2016 4:54 pm
Contact:

Re: New to Renpy and Coding in general, need help :)

#15 Post by Senpai »

trooper6 wrote:You could use my clock code. It has an analog and a digital version. It has real time, automatic time, and plain old you can add time as you like time. It is a UDD rather than ATL. You just make it digital, put it on a screen in the upper right corner (or wherever you want it), and add time whenever you jump.

The link to my clock is in my sig.
Yes, I did see it, I'm taking a closer look at it, but it seems very complicated for me to digest easily and it involves too many functions that I don't want, making it even more complicated for me to find what I want and build my own code out of it. It's the equivalent of looking through a calculus problem, when you are trying to find out how to multiply. Because I just started to learn, I'm trying not to get overwhelmed with information, making smooth transitions from point A to point B. And as these add up, I will slowly learn more complex things that involve previous functions, much like learning Math.

Things I'm trying to learn at the moment:
1- How to put text on screen. :!:

Found out. By defining Screen and then Text under, you can put text on the screen by latter, like this:

Code: Select all

screen name_of_screen:
   text ("Your text here")
2- How to define the size, color and location of said text. :!:

Found out. You can change the text by adding more definitions to it, pos for location (x,y), color for color ("#??????"), size for size (font size), like this:

Code: Select all

screen name_of_screen:
   text ("Your text here") pos (x,y) color "#??????" size ?
3- How to interact with said text. :!:

Found out. You can interact with it by defining it. In case of a clock, I defined the clock as text composed of two parts, minutes and hours, where minutes is it's own definition and hours is just minutes divided by 60. Once I defined that minutes = time_in_minutes, any time I change time_in_minutes it will change said text, but also make sure to limit the growth with a %, that means it will get to the number you choose and start over again. Thus it looks something like this:

Code: Select all

screen time_overlay:
    $ minutes = time_in_minutes % 60
    $ hours = (time_in_minutes / 60) % 24 
    text ("%d:%02d" % (hours, minutes))
And when you want to change it, the + indicates that it adds:

Code: Select all

$ time_in_minutes += 1
Last edited by Senpai on Fri Jul 22, 2016 2:40 pm, edited 4 times in total.

Post Reply

Who is online

Users browsing this forum: 3N16M4