search terms -path:launcher/game/tl -path:the_question -path:the_question_old -path:tutorial
play music "audio/music/song.mp3" loop fadeout 2.5 fadein 2.5
# Fadeout gives the fadeout time for currently playing music in seconds,
# while fadein gives the time it takes to fade in the new music.
# Disables adding audio files as variables, which will save some memory since we aren't using the variables.
init -1 python:
config.audio_directory = None
# this resets variable on game restart, but not on load.
# afterload lable probably only thing to reset on load and restart.
# mymodule.py
foo = "bar"
# script.py
init python:
import mymodule
label start:
"[mymodule.foo]"
$ mymodule.foo = "asfsdf"
"[mymodule.foo]"
"save here"
"[mymodule.foo]"
$ persistent._seen_ever["label_name"] = True
# cache is VRAM not ram
config.predict_statements = 48
config.image_cache_size_mb = 512
# This has no effect on videos. Videos are never cached/preloaded/predicted.
$ renpy.free_memory()
# Works best when doing it on the defined image animation. Doesn't work on video files.
$ renpy.start_predict("aut_mast_sex")
# These two don't work well (or at all?).
$ renpy.start_predict("images/aut_mast_*.*") # Match files
$ renpy.start_predict("aut_mast_*") # Match declared images
$ renpy.stop_predict()
build.archive("audio", "all")
build.archive("images", "all")
build.archive("scripts", "all")
build.archive("videos", "all")
# default exclusions here
build.classify("game/**.rpy", None)
build.classify("game/audio/**", "audio")
build.classify("game/**.jpg", "images")
build.classify("game/**.png", "images")
build.classify("game/**.rpyc", "scripts")
build.classify("game/videos/**", "videos")
init python:
config.font_replacement_map["fonts/DejaVuSans.ttf", False, True] = ("fonts/DejaVuSans-Italic.ttf", False, False)
config.font_replacement_map["fonts/DejaVuSans.ttf", True, False] = ("fonts/DejaVuSans-Bold.ttf", False, False)
config.font_replacement_map["fonts/DejaVuSans.ttf", True, True] = ("fonts/DejaVuSans-Bold-Italic.ttf", False, False)
# Always use this one, Works on emulator
renpy.variant("mobile"):
# Doesn't work on emulator
renpy.mobile:
menu my_menu:
"Choice 1" if not done_c1:
$ done_c1
jump my_menu
"Choice 2" if not done_c2:
$ done_c2
jump my_menu
"Choice 3" if not done_c3:
$ done_c3
jump my_menu
jump after_menu
# DO NOT DO:
label my_label:
if done_c1 and done_c2 and done_c3:
jump after_menu
menu:
"Choice 1" if not done_c1:
$ done_c1
jump my_label
"Choice 2" if not done_c2:
$ done_c2
jump my_label
"Choice 3" if not done_c3:
$ done_c3
jump my_label
label start:
scene black with None
show my_image at vshake
transform vshake:
linear 0.05 yoffset 0
linear 0.05 yoffset 10
linear 0.05 yoffset -10
linear 0.05 yoffset 10
linear 0.05 yoffset -10
linear 0.05 yoffset 10
linear 0.05 yoffset -10
linear 0.05 yoffset 0
# gui.rpy
style button:
properties gui.button_properties("button")
hover_sound "sounds/hover.ogg"
activate_sound "sounds/click.ogg"
imagebutton:
idle Fixed(Transform("image.png", size=(352, 198)), Color((0, 0, 0, 190)), mod_completed_text, maximum=(352, 198))
screen example:
style_prefix "mystyle"
text "Line 1"
text "Line 2"
text "Line 3"
style mystyle_text:
size 30
transform example:
on hover:
easein 0.3 zoom 1.2
on idle:
easein 0.3 zoom 1.0
imagebutton align (0.5, 0.42) anchor (0.5, 0.5) idle "gui/btn_play.png" at example action NullAction()
transform example:
on hover, idle:
easein 0.4 zoom 1.5
easein 0.4 zoom 1.0
imagebutton idle "btn_idle.png" hover "btn_hover.png" at example
imagebutton idle Transform("example.png", zoom=0.4) hover Transform(im.MatrixColor("example.png", im.matrix.brightness(0.20)), zoom=0.4)
action Show("screen", fade)
$ renpy.notify("This will create a pop-up notification.")
tag tag_name
tag menu
An invisible frame. (A frame without the background and borders)
screen fast_travel:
fixed:
text "Fast travel to.." align (0.5, 0.3)
textbutton "Floor 1" align (0.25, 0.5) action Jump("floor1")
textbutton "Floor 2" align (0.50, 0.5) action Jump("floor2")
textbutton "Back" align (0.75, 0.5) action Hide("fast_travel")
https://www.renpy.org/doc/html/#customizing-ren-py
The pause statement causes Ren'Py to pause until the mouse is clicked. If a number is given, the pause will end when that number of seconds have elapsed.
pause
pause 3.0
While some games can be made by only using the statements given above, other games requires data to be stored and recalled later. For example, it might make sense for a game to remember a choice a player has made, return to a common section of the script, and act on the choice later. This is one of the reasons why Ren'Py has embedded Python support.
To initialize a variable, use the default statement, before label start.
default book = False
label book:
$ book = True
m "It's like an interactive book that you can read on a computer or a console."
jump marry
Lines beginning with a dollar-sign are interpreted as Python statements. The assignment statement here assigns a value to a variable. Ren'Py has support for other ways of including Python, such as a multi-line Python statement, that are discussed in other sections of this manual.
# in screens.rpy find and change to:
default quick_menu = False
define gui.text_color = '#ffffff'
define gui.dialogue_text_outlines = [ (0, "#000000", 2, 2) ]
- artstation animations