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.
-
r_metal
- Newbie
- Posts: 1
- Joined: Sun Oct 16, 2016 8:27 am
-
Contact:
#1
Post
by r_metal » Sun Oct 16, 2016 8:42 am
Hello. I have read Quickstart documentation and i got everything but "Python and If statements". Don't get me wrong, I know what Python is and have been learning it for a while before i discovered Ren'Py but i just don't understand that example and what does "bl_game =" do there. If you please can help me understand how to store the user's choices in variables, and access them again later i would really appreciate that!
Code: Select all
#Python makes it easy to store flags in response to user input. Just initialize the flag at the start of the game:
label start:
$ bl_game = False
#You can then change the flag in code that is chosen by menus:
label hentai:
$ bl_game = True
m "Why it's a game with lots of sex."
s "You mean, like a boy's love game?"
s "I've always wanted to make one of those."
s "I'll get right on it!"
jump marry
#And check it later:
"And so, we became a visual novel creating team."
"We made games and had a lot of fun making them."
if bl_game:
"Well, apart from that boy's love game she insisted on making."
"And one day..."
-
Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#2
Post
by Ocelot » Sun Oct 16, 2016 10:39 am
RenPy code is just a higher level language which in the end is parsed and executed as Python code.
A dollar sign tells that rest of the line should be interpreted as raw python code. In your case it is just a simple Python statement, which creates variable bl_game or assigns it new value, if it is already exist.
if bl_game: is a RenPy language statement which works wimilarly to Pytjon one: it checks if bl_game is True and executes next block if t is.
< < insert Rick Cook quote here > >
Users browsing this forum: No registered users