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.
Wataru2
Newbie
Posts: 12 Joined: Sat Sep 29, 2018 11:04 am
Contact:
#1
Post
by Wataru2 » Tue Oct 02, 2018 9:24 pm
I'm having a hard time figuring out how to get a range of values to use as a condition pass.
Code: Select all
$ currenttime = hour
if currenttime = range (8,10):
show black
Problem is I can't find a syntax that checks whether currenttime is simply in the range of the two numbers...
Per K Grok
Miko-Class Veteran
Posts: 882 Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:
#2
Post
by Per K Grok » Wed Oct 03, 2018 12:19 am
Wataru2 wrote: ↑ Tue Oct 02, 2018 9:24 pm
I'm having a hard time figuring out how to get a range of values to use as a condition pass.
Code: Select all
$ currenttime = hour
if currenttime = range (8,10):
show black
Problem is I can't find a syntax that checks whether currenttime is simply in the range of the two numbers...
You could do
if currenttime >= 8 and currenttime <= 10
IrinaLazareva
Veteran
Posts: 399 Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:
#3
Post
by IrinaLazareva » Wed Oct 03, 2018 7:56 am
Wataru2 wrote: ↑ Tue Oct 02, 2018 9:24 pm
Problem is I can't find a syntax that checks whether currenttime is simply in the range of the two numbers...
Code: Select all
if currenttime in range(8, 11):
show black
is equivalent to:
or
Wataru2
Newbie
Posts: 12 Joined: Sat Sep 29, 2018 11:04 am
Contact:
#4
Post
by Wataru2 » Wed Oct 03, 2018 3:28 pm
Thanks! Either of those did the trick! I knew I was messing up with something that's so obvious...
Users browsing this forum: Bing [Bot] , Google [Bot] , Semrush [Bot]