Need some basic coding help with Ren'Py

Elementario

Member
Game Developer
Nov 11, 2017
252
312
Hey, so..i am a noob at coding and i am trying to create a game using Ren'Py
The problem is i am stuck and need some help, i can't seem to find it anywhere and would love if some of you guys could take some time to help and explain it to me
The thing is the Ren'Py tutorial is a little confusing, what i am actually trying to do is have an interactive game like you can say Superpowered where there are menus and huds displaying things and i want to make a calendar and a time system too. Also if possible a little pointer on gui
I can't seem to understand how to do that properly
I am not experienced at coding, but i really wanna complete this VN i am creating, so please help me out a little
Thanks in advance
 

OhWee

Forum Fanatic
Modder
Game Developer
Jun 17, 2017
5,718
28,975
Hey, so..i am a noob at coding and i am trying to create a game using Ren'Py
The problem is i am stuck and need some help, i can't seem to find it anywhere and would love if some of you guys could take some time to help and explain it to me
The thing is the Ren'Py tutorial is a little confusing, what i am actually trying to do is have an interactive game like you can say Superpowered where there are menus and huds displaying things and i want to make a calendar and a time system too. Also if possible a little pointer on gui
I can't seem to understand how to do that properly
I am not experienced at coding, but i really wanna complete this VN i am creating, so please help me out a little
Thanks in advance
What you are trying to do is actually somewhat involved, as it involves a number of Renpy features. What I would suggest is to find another Renpy game you like, that does most of what you are trying to do, and look over the coding for that game to get a feel r.e. how to add menus, calendars, etc.. This should give you a fair idea of how most of these things are done.

I learned Renpy this way doing a personal mod for Lab Rats, which has a fair amount of what you mentioned. But there are other examples.

Note that you can 'unpack' most Renpy games, in order to view the script and art assets, using Unren.bat, a tool that is available elsewhere on this forum.


I also find that starting off by modding another game is a good way to get your feet wet, so that you can learn how to make changes to the code, and by extension the appearance of menus, etc. as well as maybe add some new dialogue or whatever. But not everyone starts out this way.

Also, the Renpy forum is a great place to find various scripting gems. I do find that getting answers there can be frustrating sometimes though... A lot of the time people there assume that you understand coding, and talk in ways that most noobs won't grasp without a bunch of followup questions... Plus some of the script examples there are just too vague, and without context (i.e. how it should actually look and be formatted in the script).
 

Elementario

Member
Game Developer
Nov 11, 2017
252
312
First of all, Thanks for the quick reply
I get your suggestion and i am currently trying to go through different examples i can find
As for "unpacking" a game and and viewing scripts...I did that but these scripts are either too complex for a noob (as there's no explanation on why and how things are done) or too simple which i have already got a grasp on
But i understand the best way to learn is still going through those scripts, so i will keep doing that for now
Once again thanks for the reply, i will try a bit harder
 

OhWee

Forum Fanatic
Modder
Game Developer
Jun 17, 2017
5,718
28,975
First of all, Thanks for the quick reply
I get your suggestion and i am currently trying to go through different examples i can find
As for "unpacking" a game and and viewing scripts...I did that but these scripts are either too complex for a noob (as there's no explanation on why and how things are done) or too simple which i have already got a grasp on
But i understand the best way to learn is still going through those scripts, so i will keep doing that for now
Once again thanks for the reply, i will try a bit harder
It also helps to 'start small'. You can work on your storywriting and art while you are figuring out various things (alternating as needed so you don't burn out), so you aren't completely dead in the water in the meantime.

I'm hoping that other more seasoned members here can jump in here and point you to games that are 'cleanly coded' and easier to understand. Lab Rats was somewhat straightforward, but I'm thinking there should be some cleaner examples out there.

A number of games use script.rpy for scripts and screens.rpy for menus (these are the two biggies in a 'default' Renpy build), etc. but other games go another way with their Renpy scripting, which can be more confusing, especially for noobs trying to learn Renpy. Hence why I'm hoping others will jump in here with their own suggestions.
 

Elementario

Member
Game Developer
Nov 11, 2017
252
312
Yeah, some clean examples would really help a lot
I have already worked on storywritting and for most part its done just needs a little polishing (Of the first version, of course)
On the side i am already working on rendering and have created most of the characters and a few starting scenes, can't find a good home though
I have already completed coding for the game's Intro and basic choices in the start, its these above mentioned things that are giving me a lot of trouble
But once again thanks a lot for the help
 
  • Like
Reactions: OhWee

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,059
It might be better to break down a whole gui coding help request, down to a specific stat / presentation that your unsure how to implement. In general though any GUI will be done with 'screens'.
I would also suggest looking through Ren'py's official forum in the 'Cookbook Section' because there are a decent amount of examples there to tear apart/implement/adapt.
Also be able to determine the complexity of what you want to do, system can build upon system to make something look simple to a user but actually be complex...

An example of what I'm doing for time/calendar in my Adam and Gaia Mod/Ren'py recreation is the date is a simple array that gets updated after you expend all the 'Action Points' you have available to use. Consuming action points is a simple set of functions called at the end what would be a full scene (even if it's multiple labels strung together). My time system is incredibly simple because I don't need it to be complex.

Functions For Reference:
Code:
    def worldfunction_ConsumeActionPoints(consumed):
        store.worldstat_ActionsLeft -= consumed
        if store.worldstat_ActionsLeft < 1:
            internalfunction_AdvanceDay()

    def internalfunction_AdvanceDay():
        store.worldstat_CurrentDay += 1
        store.worldstat_ActionsLeft = store.worldstat_ActionsMaximum
        if store.worldstat_CurrentDay > 7:
            internalfunction_AdvanceWeek()
        else:
            renpy.jump("worldlabel_NewDayBegins")

    def internalfunction_AdvanceWeek():
        store.worldstat_CurrentDay = 1
        store.worldstat_CurrentWeek += 1
        if store.worldstat_CurrentWeek == store.worldstat_WeekWinterStarts:
            store.worldstat_ActionsLeft = store.worldstat_ActionsMaximum
            renpy.jump("worldlabel_WinterBegins")
        elif store.worldstat_CurrentWeek > 52:
            store.worldstat_ActionsLeft = store.worldstat_ActionsMaximum
            store.worldstat_CurrentWeek = 1
            store.worldstat_CurrentYear += 1
            renpy.jump("worldlabel_NewYearBegins")
        else:
            store.worldstat_ActionsLeft = store.worldstat_ActionsMaximum
            renpy.jump("worldlabel_NewWeekBegins")
def worldfunction_UpdateCurrentDate():
        store.worldstat_CurrentDate = [store.worldstat_CurrentYear, store.worldstat_CurrentWeek, store.worldstat_CurrentDay]
 
  • Like
Reactions: Elementario

Elementario

Member
Game Developer
Nov 11, 2017
252
312
It might be better to break down a whole gui coding help request, down to a specific stat / presentation that your unsure how to implement. In general though any GUI will be done with 'screens'.
I would also suggest looking through Ren'py's official forum in the 'Cookbook Section' because there are a decent amount of examples there to tear apart/implement/adapt.
Also be able to determine the complexity of what you want to do, system can build upon system to make something look simple to a user but actually be complex...

An example of what I'm doing for time/calendar in my Adam and Gaia Mod/Ren'py recreation is the date is a simple array that gets updated after you expend all the 'Action Points' you have available to use. Consuming action points is a simple set of functions called at the end what would be a full scene (even if it's multiple labels strung together). My time system is incredibly simple because I don't need it to be complex.
[/CODE]
Hey, thanks for the reply and suggestion
And many thanks for the reference code,
I will try to play around some codes for a bit and determine what best suits my game style
The thing i was mostly confused about before was screens, which were cleared up a little by @OhWee and now thanks to you i have got an understanding of the time system
I will still to make sense of things, cause i don't fully understand it. But still thanks!
 

Elementario

Member
Game Developer
Nov 11, 2017
252
312
Thanks, as of right now I am both learning and making the game
The thing is i don't really have the time to sit back and start learning everything and I don't even have the money to pay to someone else to code for me
So, even though i know doing things like this is time consuming and also a pain in the ass, that's the only choice i have right now
But its okay, there are a lot of good people here who help me when i get stuck
So i will keep doing things like things, its a little slow but it works