"if" chose between 2 amount

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
Riky35800
Newbie
Posts: 5
Joined: Sat Feb 29, 2020 12:44 pm
Contact:

"if" chose between 2 amount

#1 Post by Riky35800 » Sun Mar 08, 2020 9:55 pm

Is it possible to make the code ralise an amount between 2?
Like

Code: Select all

if points == -10:
	"bad ending"
if points == 0:
	"Normal ending"
if points 1 - 30:
	"Good ending"
if points > 30
	"Super good ending"		
Like, i don't wanna go and do all the "200 if"s if I have a point scale 0-1000 and I want to make random variations between 100-200 201-300 301-400 and so on.
Is that possible somehow?

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: "if" chose between 2 amount

#2 Post by IrinaLazareva » Mon Mar 09, 2020 4:16 am

Example with several code variants:

Code: Select all

label start:
    $ point = 10
    
    if 0 < point < 30 or 60 < point < 100:
        "1-29 and 59-100"
    elif point >= 30 and point <= 60:
        "30-60"
    elif 200 > point >= 100:
        "100...199"
    elif point <= 0:
        "0 and less"
    else:
        "200 and more"

Riky35800
Newbie
Posts: 5
Joined: Sat Feb 29, 2020 12:44 pm
Contact:

Re: "if" chose between 2 amount

#3 Post by Riky35800 » Tue Mar 10, 2020 6:21 am

Thx! Worked

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]