I have a diary with a 3 digit pin code on it. If the player guesses the correct answer (306) they can unlock the diary.
The problem I'm having is when I push "down" on the second and third number, it doesn't show the image for "9", but if I push up it does. Also, if I choose 9 on the first number, the 9s on the second and third will appear. After messing around for a while, every time 9 appears on the first number "999" appears on all. What's going on? Here's my code (sorry it's super long for such an easy thing! I think my problem is that there must be a simpler way of doing this but I don't know how):
Definitions in script.rpy:
Code: Select all
default firstlock = 10.0 # I am starting with 10 to avoid entering negative numbers
default secondlock = 10.0
default thirdlock = 10.0
Code: Select all
label diary_explore:
call screen diary_unlock
$ result = _return
if result == "first_up": # push up on first dial
$ firstlock += 1.0
elif result == "first_down": # push down on first dial
$ firstlock -= 1.0
elif result == "second_up": # push up on second dial
$ secondlock += 1.0
elif result == "second_down": # push down on second dial
$ secondlock -= 1.0
elif result == "third_up": # push up on third dial
$ thirdlock += 1.0
elif result == "third_down": # push down on third dial
$ thirdlock -= 1.0
elif result == "enter": # try entering combination
if firstlock == 13.0: # there are two "3s" (13.0 and 3.0). same for 0 and 6
if secondlock == 10.0:
if thirdlock == 16.0:
m "Unlocked!" # etc
elif thirdlock == 6.0:
m "Unlocked!" # etc
else:
m "Nope."
jump diary_explore
elif secondlock == 0.0:
if thirdlock == 16.0:
m "Unlocked!" # etc
elif thirdlock == 6.0:
m "Unlocked!" # etc
else:
m "Nope."
jump diary_explore
else:
m "Nope."
jump katiediary_explore
elif firstlock == 3.0:
if secondlock == 10.0:
if thirdlock == 16.0:
m "Unlocked!" # etc
elif thirdlock == 6.0:
m "Unlocked!" # etc
else:
m "Nope."
jump diary_explore
elif secondlock == 0.0:
if thirdlock == 16.0:
m "Unlocked!" # etc
elif thirdlock == 6.0:
m "Unlocked!" # etc
else:
m "Nope."
jump diary_explore
else:
m "Nope."
jump diary_explore
else:
m "Nope."
jump diary_explore
if firstlock == 10.0: # dial images
show lock_1 0
elif firstlock == 11.0:
show lock_1 1
elif firstlock == 12.0:
show lock_1 2
elif firstlock == 13.0:
show lock_1 3
elif firstlock == 14.0:
show lock_1 4
elif firstlock == 15.0:
show lock_1 5
elif firstlock == 16.0:
show lock_1 6
elif firstlock == 17.0:
show lock_1 7
elif firstlock == 18.0:
show lock_1 8
elif firstlock == 19.0:
show lock_1 9
elif firstlock == 9.0:
show lock_1 9
elif firstlock == 8.0:
show lock_1 8
elif firstlock == 7.0:
show lock_1 7
elif firstlock == 6.0:
show lock_1 6
elif firstlock == 5.0:
show lock_1 5
elif firstlock == 4.0:
show lock_1 4
elif firstlock == 3.0:
show lock_1 3
elif firstlock == 2.0:
show lock_1 2
elif firstlock == 1.0:
show lock_1 1
elif firstlock == 0.0:
show lock_1 0
$ firstlock += 10.0 # to ensure it doesn't go in negative
elif firstlock == 20.0:
show lock_1 0
$ firstlock -= 10.0 # to ensure it doesn't go into twenties and beyond
if secondlock == 10.0:
show lock_2 0
elif secondlock == 11.0:
show lock_2 1
elif secondlock == 12.0:
show lock_2 2
elif secondlock == 13.0:
show lock_2 3
elif secondlock == 14.0:
show lock_2 4
elif secondlock == 15.0:
show lock_2 5
elif secondlock == 16.0:
show lock_2 6
elif secondlock == 17.0:
show lock_2 7
elif secondlock == 18.0:
show lock_2 8
elif secondlock == 19.0:
show lock_2 9
elif firstlock == 9.0:
show lock_2 9
elif secondlock == 8.0:
show lock_2 8
elif secondlock == 7.0:
show lock_2 7
elif secondlock == 6.0:
show lock_2 6
elif secondlock == 5.0:
show lock_2 5
elif secondlock == 4.0:
show lock_2 4
elif secondlock == 3.0:
show lock_2 3
elif secondlock == 2.0:
show lock_2 2
elif secondlock == 1.0:
show lock_2 1
elif secondlock == 20.0:
show lock_2 0
$ secondlock -= 10.0
elif secondlock == 0.0:
show lock_2 0
$ secondlock += 10.0
if thirdlock == 10.0:
show lock_3 0
elif thirdlock == 11.0:
show lock_3 1
elif thirdlock == 12.0:
show lock_3 2
elif thirdlock == 13.0:
show lock_3 3
elif thirdlock == 14.0:
show lock_3 4
elif thirdlock == 15.0:
show lock_3 5
elif thirdlock == 16.0:
show lock_3 6
elif thirdlock == 17.0:
show lock_3 7
elif thirdlock == 18.0:
show lock_3 8
elif thirdlock == 19.0:
show lock_3 9
elif firstlock == 9.0:
show lock_3 9
elif thirdlock == 8.0:
show lock_3 8
elif thirdlock == 7.0:
show lock_3 7
elif thirdlock == 6.0:
show lock_3 6
elif thirdlock == 5.0:
show lock_3 5
elif thirdlock == 4.0:
show lock_3 4
elif thirdlock == 3.0:
show lock_3 3
elif thirdlock == 2.0:
show lock_3 2
elif thirdlock == 1.0:
show lock_3 1
elif thirdlock == 20.0:
show lock_3 0
$ thirdlock -= 10.0
elif thirdlock == 0.0:
show lock_3 0
$ thirdlock += 10.0
jump diary_explore
Code: Select all
screen diary_unlock:
imagebutton idle Solid("#0000", xysize=(35, 26)) clicked Return('first_up') xpos 1411 ypos 479 focus_mask None
imagebutton idle Solid("#0000", xysize=(35, 26)) clicked Return('second_up') xpos 1452 ypos 476 focus_mask None
imagebutton idle Solid("#0000", xysize=(35, 26)) clicked Return('third_up') xpos 1493 ypos 473 focus_mask None
imagebutton idle Solid("#0000", xysize=(35, 26)) clicked Return('first_down') xpos 1416 ypos 554 focus_mask None
imagebutton idle Solid("#0000", xysize=(35, 26)) clicked Return('second_down') xpos 1457 ypos 551 focus_mask None
imagebutton idle Solid("#0000", xysize=(35, 26)) clicked Return('third_down') xpos 1498 ypos 548 focus_mask None
imagebutton idle Solid("#0000", xysize=(42, 54)) clicked Return('enter') xpos 1357 ypos 503 focus_mask None
Code: Select all
image lock_1 0:
xanchor 0 xpos 1418
yanchor 0 ypos 512
"images/present/lock_0.png"
image lock_1 1:
xanchor 0 xpos 1418
yanchor 0 ypos 512
"images/present/lock_1.png"
image lock_1 2:
xanchor 0 xpos 1418
yanchor 0 ypos 512
"images/present/lock_2.png"
image lock_1 3:
xanchor 0 xpos 1418
yanchor 0 ypos 512
"images/present/lock_3.png"
image lock_1 4:
xanchor 0 xpos 1418
yanchor 0 ypos 512
"images/present/lock_4.png"
image lock_1 5:
xanchor 0 xpos 1418
yanchor 0 ypos 512
"images/present/lock_5.png"
image lock_1 6:
xanchor 0 xpos 1418
yanchor 0 ypos 512
"images/present/lock_6.png"
image lock_1 7:
xanchor 0 xpos 1418
yanchor 0 ypos 512
"images/present/lock_7.png"
image lock_1 8:
xanchor 0 xpos 1418
yanchor 0 ypos 512
"images/present/lock_8.png"
image lock_1 9:
xanchor 0 xpos 1418
yanchor 0 ypos 512
"images/present/lock_9.png"
image lock_2 0:
xanchor 0 xpos 1460
yanchor 0 ypos 510
"images/present/lock_0.png"
image lock_2 1:
xanchor 0 xpos 1460
yanchor 0 ypos 510
"images/present/lock_1.png"
image lock_2 2:
xanchor 0 xpos 1460
yanchor 0 ypos 510
"images/present/lock_2.png"
image lock_2 3:
xanchor 0 xpos 1460
yanchor 0 ypos 510
"images/present/lock_3.png"
image lock_2 4:
xanchor 0 xpos 1460
yanchor 0 ypos 510
"images/present/lock_4.png"
image lock_2 5:
xanchor 0 xpos 1460
yanchor 0 ypos 510
"images/present/lock_5.png"
image lock_2 6:
xanchor 0 xpos 1460
yanchor 0 ypos 510
"images/present/lock_6.png"
image lock_2 7:
xanchor 0 xpos 1460
yanchor 0 ypos 510
"images/present/lock_7.png"
image lock_2 8:
xanchor 0 xpos 1460
yanchor 0 ypos 510
"images/present/lock_8.png"
image lock_2 9:
xanchor 0 xpos 1460
yanchor 0 ypos 510
"images/present/lock_9.png"
image lock_3 0:
xanchor 0 xpos 1502
yanchor 0 ypos 508
"images/present/lock_0.png"
image lock_3 1:
xanchor 0 xpos 1502
yanchor 0 ypos 508
"images/present/lock_1.png"
image lock_3 2:
xanchor 0 xpos 1502
yanchor 0 ypos 508
"images/present/lock_2.png"
image lock_3 3:
xanchor 0 xpos 1502
yanchor 0 ypos 508
"images/present/lock_3.png"
image lock_3 4:
xanchor 0 xpos 1502
yanchor 0 ypos 508
"images/present/lock_4.png"
image lock_3 5:
xanchor 0 xpos 1502
yanchor 0 ypos 508
"images/present/lock_5.png"
image lock_3 6:
xanchor 0 xpos 1502
yanchor 0 ypos 508
"images/present/lock_6.png"
image lock_3 7:
xanchor 0 xpos 1502
yanchor 0 ypos 508
"images/present/lock_7.png"
image lock_3 8:
xanchor 0 xpos 1502
yanchor 0 ypos 508
"images/present/lock_8.png"
image lock_3 9:
xanchor 0 xpos 1502
yanchor 0 ypos 508
"images/present/lock_9.png"