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.
-
hapciupalit
- Regular
- Posts: 52
- Joined: Tue Nov 13, 2018 6:00 am
-
Contact:
#1
Post
by hapciupalit » Wed Nov 11, 2020 6:48 am
Hi there,
I've been struggling with some easy things for two hours and for the life of me, I can't find what I have done wrong. Maybe I'm just stupid. If one of you sees the error please tell me cuz I can't find it.
Code: Select all
label home_front:
$currentLocation = "home_front"
$tClockVal = 0
if scheduleId == 1:
if tClockVal == 1 or 7 or 13 or 19 or 20 or 21 or 25 or 26 or 28:
$print ("I'm here", tClockVal)
call screen home_front("", "_off")
else:
$print ("I should be here")
if tClockVal == 4 or 5 or 11 or 16 or 17 or 23 or 29 or 35 or 41:
call screen home_front("_car", "_on")
else:
call screen home_front("_car", "_off")
For some reason I go in the if instead the else and in that log I see "I'm here 0" so I don't understand why it wouldn't go in the else.
-
drKlauz
- Veteran
- Posts: 237
- Joined: Mon Oct 12, 2015 3:04 pm
-
Contact:
#2
Post
by drKlauz » Wed Nov 11, 2020 7:17 am
Your conditions are wrong, use
Code: Select all
if tClockVal == 1 or tClockVal == 7 or ...:
or
Code: Select all
if tClockVal in [1,7,13,19,20,21,25,26,28]:
P.S.: reason why condition is wrong is:
works next way:
- check if tClockVal equal to 1
- if not then check if 7 is truthy, which is always
So your condition is actually
-
hapciupalit
- Regular
- Posts: 52
- Joined: Tue Nov 13, 2018 6:00 am
-
Contact:
#3
Post
by hapciupalit » Wed Nov 11, 2020 7:46 am
drKlauz wrote: ↑Wed Nov 11, 2020 7:17 am
Your conditions are wrong, use
Code: Select all
if tClockVal == 1 or tClockVal == 7 or ...:
or
Code: Select all
if tClockVal in [1,7,13,19,20,21,25,26,28]:
P.S.: reason why condition is wrong is:
works next way:
- check if tClockVal equal to 1
- if not then check if 7 is truthy, which is always
So your condition is actually
I understand now... Thank you very much.
Cheers!
Users browsing this forum: Google [Bot]