-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprintsleep.py
More file actions
76 lines (55 loc) · 2.29 KB
/
Copy pathprintsleep.py
File metadata and controls
76 lines (55 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import time
global time_sleep_choosen
time_sleep_choosen = 1
def print_fast(text):
"""Prints and waits a small interval. Used for quick texts.
"""
print(text)
time.sleep(1 * time_sleep_choosen)
def print_med(text):
"""Print and waits a slight bigger interval. Used for dialogues.
"""
print(text)
time.sleep(2 * time_sleep_choosen)
def print_long(text):
"""Prints and waits a big interval. Used for dramatic pauses.
"""
print(text)
time.sleep(4 * time_sleep_choosen)
def sleep_option():
"""Allows user to choose a time multiplier that will increase or decrease how much they wait between each message.
"""
global time_sleep_choosen
print("\n Escolhe quanto tempo esperar entre cada texto:")
print(" ▹ Devagar (1.5x)")
print(" ▹ Padrão (1x)")
print(" ▹ Rápido (0.5x)")
print(" ▹ Nenhum (0x)\n")
# Loop for the choice just so that if the user inputs something invalid the whole menu doesn't pop back up.
while True:
speed_choice = input(">>> ").lower()
if speed_choice == "voltar" or speed_choice == "sair":
# Exits the function, goes back to options().
return
elif speed_choice == "devagar":
# Attributes value of 1.5 to the time.sleep multiplier that will apply to all text in the game.
time_sleep_choosen = 1.5
# Exits the function, goes back to options().
return
elif speed_choice == "padrão" or speed_choice == "padrao":
# Attributes the default value of 1 to the multiplier.
time_sleep_choosen = 1
# Exits the function, goes back to options().
return
elif speed_choice == "rápido" or speed_choice == "rapido":
# Attributes value of 1.5 to the multiplier.
time_sleep_choosen = 0.5
# Exits the function, goes back to options().
return
elif speed_choice == "nenhum":
# Nullifies the multiplier.
time_sleep_choosen = 0
# Exits the function, goes back to options().
return
else: # Checks for invalid input and asks for it again.
print("\n> Entre uma opção válida.\n")