Hello.
Is it possible to use multiple AND conditions on the same line? I would like an option to appear in a menu if three conditions were met: x >3, y is true and z is false:
It works with two conditions:
menu:
"Option A" if x>3 and y
But if I need another "and", things will not work out.
menu:
"Option A" if x>3 and y and not z
Note that I need to write everything on the same line because it is a menu option. Can you use multiple "and" and "or" or do I have to do it any other way?
Multiple AND conditions?
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.
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.
- RicharDann
- Veteran
- Posts: 286
- Joined: Thu Aug 31, 2017 11:47 am
- Contact:
Re: Multiple AND conditions?
Yes, using multiple conditions that way should work. Are you sure that you're using the correct syntax?
Code: Select all
menu:
"Option A" if x > 3 and y and not z:
"You picked A"
The most important step is always the next one.
Re: Multiple AND conditions?
Yes, it worked, I had made a ridiculous mistake in the name of the variable (it was not as simple as "y"). I think the moderator can delete this topic!
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Multiple AND conditions?
Just for info, you can use all( list of tests ) and/or any( list of tests ) in a menu...
Code: Select all
menu:
"ok 1" if all( [ True, 1, len("a") ] ):
"..."
"ok 2" if any( [ True, 0, len("") ] ):
"..."
"bad 1" if all( [ False, 1, len("a") ] ):
"..."
"bad 2" if any( [ False, 0, len("") ] ):
"..."
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Who is online
Users browsing this forum: Google [Bot], Majestic-12 [Bot]