Side image with different expressions and a changeable name?

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
Miss Nay
Newbie
Posts: 10
Joined: Mon Dec 29, 2014 2:10 am
Deviantart: JaiselArcher
Location: Los Angeles, CA
Contact:

Side image with different expressions and a changeable name?

#1 Post by Miss Nay »

Edit: [SOLVED! I used a different code, and it works just fine]



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
But when I try to use it, I get this error report:

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
I don't know what it means by "init statement expects a non-empty block" and I don't know how to fix it. Also I feel like that's not the only problem with the code.
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
But of course when I try to mix it with the "character changes expressions" code, stuff doesn't work -_-;;.

Post Reply

Who is online

Users browsing this forum: piinkpuddiin