Conditional Statements Not Working? [Solved]

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.
Message
Author
User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Conditional Statements Not Working?

#16 Post by PyTom »

Code: Select all

label Chapter_02: 
    
    "Let's see if it worked...!"

     $ max_pre = max(an_pre, az_pre, mi_pre, s_pre, y_pre)

    "an=[an_pre] az=[az_pre] mi=[mi_pre] s=[s_pre] y=[y_pre] max=[max_pre]"
    
    if an_pre == max_pre:
        $ an_r = True
    elif az_pre == max_pre:
        $ az_r = True
    elif mi_pre == max_pre:
        $ mi_r = True
    elif s_pre == max_pre:
        $ s_r = True
    elif y_pre == max_pre:
        $ y_r = True

    if an_r == True:
        an "Dog"
    if az_r == True:
        az "Dog"    
    if mi_r == True:
        mi "Dog"    
    if s_r == True:
        s "Dog"
    if y_r == True:
        y "Dog"

return

Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
yon
Regular
Posts: 174
Joined: Tue Sep 09, 2014 5:09 pm
Projects: YDSP
Soundcloud: tetra-yon
itch: v-ual
Location: United States
Contact:

Re: Conditional Statements Not Working?

#17 Post by yon »

Image
Image

It looks like it's working now! I tried out another route and it worked there, too.
Thank you for the help. I really appreciate it.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]