Hello, I've had this problem before and I managed to get help from the forum to fix it, but that was a while ago and I forgot how I did it ^^;. My problem is that I want the side image for my main character to change expressions when need be, and I want the player to be able to change the main character's name. I've been trying to use this jumbled mess of a code:
Code: Select all
define k = Character('Kash', color="#c8ffc8")
init:
image raia = "Raia Chara norm.png"
image side raia_smile = "Raia Chara smile.png"
$ p = Character("player_name", dynamic=True, color = "#ffffff", show_side_image=ConditionSwitch('raia==0', 'raia_smile', xalign=0, yalign=1.0), window_left_padding=230)
"I've been thinking about changing my name."
# The phrase in the brackets is the text that the game will display to prompt
# the player to enter the name they've chosen.
$ player_name = renpy.input("What is your name?")
$ 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="Raia"
# Now the other characters in the game can greet the player.
label start:
show raia
$ raia = 0
p "Hello!"
k "Hello. It's nice to meet you, %(player_name)s!"
return
Code: Select all
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/script.rpy", line 5: init statement expects a non-empty block.
init:
^
File "game/script.rpy", line 6: expected statement.
image raia = "Raia Chara norm.png"
^
File "game/script.rpy", line 7: expected statement.
image side raia_smile = "Raia Chara smile.png"
^
File "game/script.rpy", line 8: expected statement.
$ p = Character("player_name", dynamic=True, color = "#ffffff", show_side_image=ConditionSwitch('raia==0', 'raia_smile', xalign=0, yalign=1.0), window_left_padding=230)
^
File "game/script.rpy", line 10: expected statement.
"I've been thinking about changing my name."
^
File "game/script.rpy", line 15: expected statement.
$ player_name = renpy.input("What is your name?")
^
File "game/script.rpy", line 17: expected statement.
$ player_name = player_name.strip()
^
File "game/script.rpy", line 23: expected statement.
if player_name == "":
^
File "game/script.rpy", line 24: expected statement.
$ player_name="Raia"
^
File "game/script.rpy", line 31: expected statement.
show raia
^
File "game/script.rpy", line 32: expected statement.
$ raia = 0
^
File "game/script.rpy", line 34: expected statement.
p "Hello!"
^
File "game/script.rpy", line 35: expected statement.
k "Hello. It's nice to meet you, %(player_name)s!"
^
File "game/script.rpy", line 36: expected statement.
^
File "game/script.rpy", line 38: expected statement.
^
File "game/script.rpy", line 39: expected statement.
return
^
Ren'Py Version: Ren'Py 6.99.12.2.2029
Oh by the way, the "naming your character" code works on it's own:
Code: Select all
define p = Character("player_name", dynamic=True)
define k = Character('Kash', color="#c8ffc8")
# The game starts here.
label start:
"I've been thinking about changing my name."
# The phrase in the brackets is the text that the game will display to prompt
# the player to enter the name they've chosen.
$ player_name = renpy.input("What is your name?")
$ 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="Raia"
# Now the other characters in the game can greet the player.
p "Hello!"
k "Hello. It's nice to meet you, %(player_name)s!"
return