In-game menus
This page is part of the GenPy Ren'Py learning path. It focuses on practical Ren'Py 8.x production and links each concept back to the GenPy workflow.
Learning goals
- Write a basic menu block.
- Gate options with conditions.
- Connect choices to variables, labels, and endings.
Core syntax
menuifsetjumpdefault
Runnable example
text
label investigate:
menu:
set seen_choices # 选过的选项加入该集合并隐藏
"查看书架":
"全是旧书。"
"查看抽屉":
"里面有一把钥匙。"
"离开":
jump leave
jump investigate # 回到菜单,已选项不再出现Study outline
- Start with the smallest example for in-game menus.
- Test the key terms in a clean Ren'Py project: menu, if, set, jump.
- Move the pattern back into your real project only after the example runs.
- Use GenPy docs and validation to keep the feature connected to story, assets, and export readiness.
Common pitfalls
- Make sure conditional menu options can actually become visible.
- Track one-time choices with variables that are initialized with default.
- Test the smallest working script before layering on visual or UI complexity.
- Run Ren'Py Lint before release builds, even when the script appears to run locally.
- Keep examples in standard .rpy files so they remain editable outside GenPy.
Official references
- Ren'Py official reference: https://www.renpy.org/doc/html/menus.html
- Ren'Py screen language reference: https://www.renpy.org/doc/html/screens.html
How this fits in GenPy
- Use Branch View to reason about choices and route coverage.
- Use Variables and Validation to check that menu conditions match project state.
Recommended GenPy docs:
