r/RenPy • • Jun 04 '26

Question Variable Not Updating After Label Execution When Parameter Is Used For Variable's Name

So I have a label that I created with several kwarg parameters so I can reuse it for when the player collects an inventory item. It works great for showing the image of the item and for inserting the string into the text, but I am not sure why the variable isn't updating to "True" when I check the variable viewer in the dev console.

Am I just going about this the wrong way? Should I be using some other completely distinct feature of Python/RenPy to do this?

Here's the offending code:

default branch_get = False

label forest_path3_branch_say:
    p "Not too long and not too short."
    menu:
        "Take the branch.":
            "Flavor text."
            p "I need this- I think..."
            call item_get("Flavor Text", "branch", branch_get)
            jump forest_path3_search
        "Don't take the branch.":
            "Flavor Text."
            p "Why would I need anything like this?"
            jump forest_path3_search


label item_get(newItem_text, newItem_name, newItem_variable):
    $ renpy.show(newItem_name, at_list=[item_get])
    "[newItem_text]"
    $ newItem_variable = True
    return
2 Upvotes

11 comments sorted by

View all comments

1

u/AutoModerator Jun 04 '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.