• To improve security, we will soon start forcing password resets for any account that uses a weak password on the next login. If you have a weak password or a defunct email, please update it now to prevent future disruption.

Ren'Py If else and or...

recreation

pure evil!
Respected User
Game Developer
Jun 10, 2018
6,260
22,220
Since google didn't help and the search function didn't show anything relative:
Is it possible to use "and" and "or" commands in renpy? It would make my life much easier, especially in a menu with lots of choices with condition tied to it.
 

Papa Ernie

Squirrel!?
Uploader
Donor
Dec 4, 2016
12,328
47,244
Since google didn't help and the search function didn't show anything relative:
Is it possible to use "and" and "or" commands in renpy? It would make my life much easier, especially in a menu with lots of choices with condition tied to it.
Yes.
 
  • Like
Reactions: recreation

Papa Ernie

Squirrel!?
Uploader
Donor
Dec 4, 2016
12,328
47,244
@recreation
Example:
Code:
label bath4:
    $ renpy.show("bath4-" + renpy.random.choice(["1", "2"]))
    with fade
    'You walk in and see several good looking girls in the bath, what do you do?'
    menu:
        "Walk away":
            "You quickly walk away without being noticed."

        "Join them!":
            if ((inhibition - renpy.random.randint(0,5)) > 75 and povGender == 'Male' or (inhibition - renpy.random.randint(0,10)) > 75 and povGender == 'Female'):
                "After the girls notice you, they start to scream and throw stuff at you! You run away as fast as you can."
                $ reputation -= 1
                $ morale -= 1
            else:
                "After the girls notice you, they ask about your day and what business you have in the baths, after chatting for a while, they politely ask you to leave."
                $ inhibition -= 1
                $ morale += 1
    return
 
  • Like
Reactions: Sumodeine

Papa Ernie

Squirrel!?
Uploader
Donor
Dec 4, 2016
12,328
47,244
@recreation
As a side note, you can also use them as conditional statements for menu choices if you only want them to show when certain criteria are met.
 

recreation

pure evil!
Respected User
Game Developer
Jun 10, 2018
6,260
22,220
@jerricho13
Yep, that was what I meant^^
Code:
menu:
     "Lay down, we have to talk..." if (ytlove > 50 and yttrust > 50) or (ytlove > 50 and ytlust > 50) or (ytobedience > 50 and yttrust > 50):
                $ ytlove += 1
                $ yttrust += 1
                $ ytfear -= 1
                $ ythate -= 1
                $ ythappiness +1
                jump tosomewhereelse
thy