Ren'Py Call Back A Screen

Part

Member
Donor
Nov 14, 2016
225
2,906
Hi here, I'm looking for a tuto, an example with dev code of renpy game with choices and variables that increase or decrease with the choices of the reader, as Depraved Awakening ( ). I understand how to code simple choices :
Code:
label start:
    menu:
        "I am older than 18 years old.":
            jump choice1_yes
        "I am younger than 18 years old":
            jump choice1_no


label choice1_yes:
    menu:
        "Start the interractive novel":
            jump day1
        "Have a look to my artworks":
            jump artwork
But I wan't to understand how to code choices and variables.
The better will be a game like this Depraved Awakening with all the code.

I need to understand this. My novel (in my sign) hasn't any choice. I wan't to improve it, but I need to learn how to code this before.
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,839
Hi here, I'm looking for a tuto, an example with dev code of renpy game with choices and variables that increase or decrease with the choices of the reader, as Depraved Awakening ( ). I understand how to code simple choices :
Code:
label start:
    menu:
        "I am older than 18 years old.":
            jump choice1_yes
        "I am younger than 18 years old":
            jump choice1_no


label choice1_yes:
    menu:
        "Start the interractive novel":
            jump day1
        "Have a look to my artworks":
            jump artwork
But I wan't to understand how to code choices and variables.
The better will be a game like this Depraved Awakening with all the code.

I need to understand this. My novel (in my sign) hasn't any choice. I wan't to improve it, but I need to learn how to code this before.

First of all, give the menus a label.
Instead of
Code:
label choice1_yes:
    menu:
        "Start the interractive novel":
            jump day1
        "Have a look to my artworks":
            jump artwork
You can write:
Code:
menu choice1_yes:
    "Start the interractive novel":
        jump day1
    "Have a look to my artworks":
        jump artwork
This way, the menu itself is called choice1_yes and if you jump from any point to the label it will automatically jump to this menu.

Ok next to your real question:

Lets imagine you want your menus to check what the player chose in the previous menu....

Your original:
Code:
label start:
    menu:
        "I am older than 18 years old.":
            jump choice1_yes
        "I am younger than 18 years old":
            jump choice1_no


label choice1_yes:
    menu:
        "Start the interractive novel":
            jump day1
        "Have a look to my artworks":
            jump artwork
My modified:
Code:
label start:
    menu choice1:
        "I am older than 18 years old.":
            $ choice1 = 1
            jump choice2
        "I am younger than 18 years old":
            $ choice1 = 2
            jump choice2


    menu choice2:
        "Start the interractive novel" if choice1 == 1:
            jump day1
        "Have a look to my artworks" if choice1 == 1:
            jump artwork
        "Sorry but I'll have to exit the game since I'm just to young..." if choice1 == 2:
            return
Alright, so here we have a variable called "$ choice1" now which we set to 1 if the player is older than 18 years or to 2 if he is younger. In the next menu we will ask if the choice1 is 1 then show the menus "Start the interactive novel" and the "Have a look to my artworks" but don't show "Sorry but I'll have to exit the game since I'm just to young..."
On the other hand if the variable "choice1" is "2" then it will only show the last element and not the two above...

In this case we could've made it easier by using a boolean, meaning "True or False" 0 or 1
So we could've written:
$ over18 = True
or
$ over18 = False

the corresponding if statements would've been:
"choice text" if over18:
this one happens when True

"choice text" if not over18:
this one happens when False

But you wanted a point system... like DA

then you'd have to make menus like this:

Code:
menu randomSexSceneOne:
    "Put it in her ass and finger her pussy":
        $ patriciaAss += 10
        $ patriciaPussy += 5
        jump patriciaAssPussyScene
    "Put it in her mouth and be a little rough":
        python:
            patriciaOral += 10
            patriciaM += 5
        jump patriciaRoughOral
The easiest way to keep track of those variables would be to create a new .rpy file and use it to store the default values of the variables.

I usually use one like "variables.rpy" or "main.rpy" or whatever
inside the .rpy I'd write a list like this:

Code:
default over18 = False
default patriciaLove = 0
default patriciaAss = 0
default patriciaPussy = 0
default patriciaOral = 0
# patricias masochist value
default patriciaM = 0
This way you have a list of variables and can easily find the one you need for a specific situation... there are more advanced ways like using classes and so on but for a beginner like you it would suffice to create variables like this in an easy to read list (preferable with comments in cases like "patriciaM" so that you may know later on what the variables meaning was)
+= -= *= /= are possible operators to calculate new values.
So patriciaAss += 10 would mean, whatever is stored in the variable patriciaAss it would increment by 10
if you'd forget the + infront of the = then it would SET patriciaAss to 10 instead of adding 10 points to it. So keep that in mind.


If you've more questions let us know ;) Hope I could help a little even though that's the absolut minimum fundamental you'd have to learn on your own to get a program running at all.... next time google "Python beginners guide" which would explain the use of variables. Maybe just reading the beginners guide on the ren'py documentation would've also helped since it's all in there ;) And it's just about 20 pages to read... even you can do that ;)
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,839
You're welcome!
Don't hesitate to ask questions we have a good and helping community here, but also try to gather as much info as you can by yourself to show that you're determined to learn ;)
 
  • Like
Reactions: Part