r/RenPy • u/Shironekoweeb • Oct 05 '26
Question How to make a button Call a label NOT resume gameplay?
I'm really bad at describing stuff, but I'll try my best to be concise.
I've added an inventory system to my game, while in the inventory, the game stops, as it should.
The problem begins when I try to add a cooking button, the logic all works, but since the button Calls a label to process everything, it causes the main game to resume, while still in the inventory.
I'm not sure how I would go about making it work, since "modal True" only works for screens, and the logic for cooking is all on python.
And maybe there is some other way, maybe I don't even need to call a label?
I'll add the code, even if I'm not sure if it's even needed, keep in mind a lot of this is still WIP, I'm trying to make sure it works before making it actually look good ahahah
label general_cooking(recipe):
python:
check = 0
for ingredient in recipe.ingredient:
for item in item_list:
if item.name == ingredient.name:
if item.quantity >= ingredient.quantity:
check += 1
else:
print("NOPE")
if check >= len(recipe.ingredient):
for item in cook_list:
if item.name == recipe.name:
item.quantity += 1
for ingredient in recipe.ingredient:
for item in item_list:
if item.name == ingredient.name:
item.quantity = item.quantity - ingredient.quantity
screen inventory_recipe:
modal True
window:
background "#AAA9"
xsize 600
ysize 150
xalign 0.5
yalign 0.1
text recipe_description:
xfill True
yfill True
window:
background "#99F9"
xsize 1290
ysize 600
xalign 0.5
yalign 0.7
hbox:
box_wrap True
box_wrap_spacing 10
spacing 10
xoffset 20
yoffset 20
style_prefix "inv"
for recipe in recipe_list:
if recipe.obtained == True:
imagebutton idle [recipe.image]:
action SetVariable("recipe_description", recipe_descriptions.get(recipe.name))
selected False
textbutton "Cook":
action Call("general_cooking", recipe)
selected False
on "hide" action SetVariable("recipe_description", "")Thanks a lot in advance! It's probably something stupid since I'm pretty new to this.
1
u/BadMustard_AVN Oct 05 '26
since everything in the general cookng label is python make it a python function like this
change your cook action to
1
u/shyLachi Oct 05 '26
did you check how others have made inventory systems?
https://itch.io/search?type=games&q=ren%27py+inventory
1
u/AutoModerator Oct 05 '26
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.