Update 3: Improved Item Counting
Through testing, I realized that the previous version of the code could cause a small issue, which happened to come up in my own game.
It only affects setups where:
- A choice has a
condition=
kwarg that fails, and - The total number of menu items (
len(items)
) is used elsewhere in your customchoice(items)
screen for visuals (for example, triggering a scrollbar when there are more than 5 items).
In the old version, failed conditionals would still be counted as items, even though they weren't actually shown — which could throw off item-based calculations.
To fix this, I added a new variable before the for
loop, which is now used to loop through choices:
$ visible_items = [i for i in items if i.kwargs.get("condition", True)]
for i in visible_items:
...
This ensures that only visible choices are counted. There’s also no longer any need to manually skip failed choices inside the loop, so the code is now slightly cleaner and shorter overall.
This probably won’t matter for most people using the default setup, but I wanted to make sure developers working with more complex screens don't run into unexpected behavior!
If this issue comes up for you, use len(visible_items)
to make extra calculations within the screen :)
Get Choice Kwargs Tutorial For Ren’py
Choice Kwargs Tutorial For Ren’py
Easily customize the display of Ren'Py choices!
Status | Released |
Category | Assets |
Author | aurawave |
Genre | Interactive Fiction, Visual Novel |
Tags | 2D, Asset Pack, Dating Sim, Meaningful Choices, Narrative, Ren'Py, Singleplayer, Story Rich |
More posts
- Update 2: Tooltip Functionality and Background Customization42 days ago
- Update: Simpler Syntax47 days ago
Leave a comment
Log in with itch.io to leave a comment.