string = "Your NEW name is ALBY. You have 3 minutes to get to your shelter or you get RIPPED APART by gamma radiation and A MASSIVE FIREBALL. Do you RUN, SHELTER, or WAIT?"
for char in string:
print(char, end='')
time.sleep(.05)
print("")
time.sleep(5)
answer1 = input("What do you do?")
while True:
if answer1 == "RUN":
print("")
print ("You choose to RUN. Within minutes of running you see a massive
FIREBALL behind you, say your PRAYERS and DIE.")
print("")
time.sleep(5)
print("You Died! The creator of this game can't use 'While True'
statements and therefore you must restart.")
elif answer1 == "WAIT":
print("This is certainly not YOUR BEST IDEA. You WAIT for the bomb to drop
and DIE a hot death.")
print("")
time.sleep(5)
print("")
print("You Died! The creator of this game can't use 'While True' statements and therefore you must restart.")
elif answer1 == "SHELTER":
def slowprint(s):
for c in s + '\n':
sys.stdout.write(c)
sys.stdout.flush() # defeat buffering
time.sleep(random.random() * 0.1)
slowprint('Hello, world.')
Above is the code snippet, i have the typewriter effect going for a little text adventure. When I run the code all that happens is i get a blank loop, or the first letter of the line.
[EDIT: This isn't a duplicate of a flushing issue. I didn't want to flush slowprint i just needed to redefine it.]