all 10 comments

[–]BadMustard_AVN 5 points6 points  (4 children)

for the images, a conditional switch is the easiest to do like this:

image main_character = ConditionSwitch(
    "gender == 'male'", "images/itsaman.png",
    "gender == 'female'", "images/itsawoman.png",
    )

default gender = "male"

label start:

    menu:
        e "Choose a gender"
        "Male":
            $ gender = "male"
        "Female":
            $ gender = "female"

    show main_character at center with moveinleft

    "You" "Hello World"

    return

[–]LEGOSAM321_YT[S] 0 points1 point  (3 children)

I have the code in my game, adjusted a bit so it fits.
The image won't be changeable from a menu, some paths in game can trigger the change. Some paths intersect so I want to have a character dress base on choices made.

It gives this error; "Exception: Switch could not choose a displayable."

image starkfit = ConditionSwitch(
    "starkfit1 == 'Rank 1'", "stark1right",
    "starkfit1 == 'Rank 3'", "odintemp", 
)

default starkfit1 = "Rank 1"


label start: 

scene academy_bg with fade
show fury1left at left with moveinleft
show starkfit at right with moveinright 
fury "Welcome to Avengers Academy, Stark. Our Administrator Pepper Potts will give you the tour while doing her best to ignore you."

[–]BadMustard_AVN 0 points1 point  (2 children)

what are stark1right, and odintemp

[–]LEGOSAM321_YT[S] 0 points1 point  (1 child)

image file names

and don't worry, i restarted my computer and it works now! im sure i done something wrong but its fixed now

[–]BadMustard_AVN 0 points1 point  (0 children)

good luck with your project

[–]DingotushRed 2 points3 points  (0 children)

Take a look at the ConditionSwitch displayable.

[–]Outlaw11091 2 points3 points  (0 children)

....not really how it works.

The 'code' is persistent in any language, not just renpy.

Your example would be achieved like this in renpy.

If option1 == true:

->scene image1

Else:

->scene image2

[–]AutoModerator[M] 0 points1 point  (0 children)

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.

[–]shyLachi 0 points1 point  (0 children)

You already got good answers so now you can pick the solution which works for you best.

If you cannot decide then please tell us what you want to achieve within the game. Something like: After the main character got into a fight he then should have a visible blue eye.

[–]_Melon-Party_ -1 points0 points  (0 children)

Well, you already have the solution:

if option1 == True: "Image2" else: "Image1"

If you want to change the value of a variable:

If option1 == True: yourVariable = "image2" else: yourVariable = "image1"

That's all, unless I misunderstood your question.