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.
I am still fairly new to Ren'Py, and so far I am loving it.
I am a little stuck in the coding; I am trying to let players enter there names. After it finally stopped showing error codes for the user interaction, it keeps saying there is indentation mismatch in line 41. I used spaces, and it's still showing this error.
why? what am I doing wrong?
$ player_name = player_name.strip()
# The .strip() instruction removes any extra spaces the player
# may have typed by accident.
# If the player can't be bothered to choose a name, then we
# choose a suitable one for them:
if player_name == "":
$ player_name="Mei Jones"
# And get a nostalgic sigh from Seasons of Sakura fans!
# Now the other characters in the game can greet the player.
p "I am [player_name]." #The error is here.
un "I am Alban Joesphs, Founder of Joesphs Designs Inc. I will be interviewing you."
return
You have an indentation mismatch. The 'if player_name == "":' is preceded by 6 spaces, while 'p "I am [player_name]."' is preceded by only 4 spaces. Statements at the same 'level' must be indented at the same level. Either remove two spaces from the if statement or add two spaces to the "I am [player_name]." statement.
You have 6 spaces before the if player_name line and only 4 before the p "I am... line. They need to line up; I'd probably stick with 4 throughout. In fact, do those lines need to be indented at all?
$ player_name = player_name.strip()
if player_name == "":
$ player_name="Mei Jones"
p "I am [player_name]."
un "I am Alban Joesphs, Founder of Joesphs Designs Inc. I will be interviewing you."
return