[Solved] Exception error "required parameter current_name has no value" at the end of code

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Andwiiger
Newbie
Posts: 14
Joined: Thu Oct 26, 2017 12:35 pm
Contact:

[Solved] Exception error "required parameter current_name has no value" at the end of code

#1 Post by Andwiiger » Tue May 29, 2018 2:30 pm

I have a code that runs perfectly until the end, where I get an Exception: Required parameter current_name has no value.
Here's the code:

Code: Select all

label name_accept(current_name, whatCharacter, capitalCharacter):
    $ new_name = ""
    "Do you want to name [whatCharacter] [current_name]?"

    menu:
        "Yes ":
            pass

        "No":
            $ new_name = renpy.input("What do you want to change [current_name] to?")
            $ new_name = new_name.strip()
            "[captialCharacter]'s name has been changed to [new_name]"
            $ current_name = new_name
Anyone has any idea why this happens? And only at the end, right before it would go to the main menu?

Edit:
Adding how I call the label:

Code: Select all

$ player_name = renpy.input("Feel free to give him a name, or hit enter for default name \"Michael\"")
    $ player_name = player_name.strip()

    if (player_name == ""):
        $ player_name = "Michael"

    call name_accept(player_name, "the main character", "The Main Character")
Edit 2 Solution:
The problem came from previous label block not having a return statement. With the return statement in place, everything works as it should
Last edited by Andwiiger on Tue May 29, 2018 5:23 pm, edited 1 time in total.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 659
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Exception error "required parameter current_name has no value" at the end of code

#2 Post by Milkymalk » Tue May 29, 2018 4:14 pm

This question may seem unrelated, but what is directly above the label name_accept?
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Andwiiger
Newbie
Posts: 14
Joined: Thu Oct 26, 2017 12:35 pm
Contact:

Re: Exception error "required parameter current_name has no value" at the end of code

#3 Post by Andwiiger » Tue May 29, 2018 4:21 pm

Code: Select all

label day1:
    "This is empty for now, I'll add something here later"


User avatar
Milkymalk
Miko-Class Veteran
Posts: 659
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: [Solved] Exception error "required parameter current_name has no value" at the end of code

#4 Post by Milkymalk » Thu May 31, 2018 11:47 am

Kivik solved it in the other thread already, but it's as I suspected: The previous label carries over into this label, expecting parameters it didn't get.

Labels aren't python functions. I you don't tell them what to do after they are finished, they will just go on to whatever is next in the file. If you don't want that, always return or jump somewhere else.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Post Reply

Who is online

Users browsing this forum: KField