1

I am creating a text adventure in python and i want it to be different than the traditional turn-based gameplay. But also not the real time gameplay of a MUD. I have designed a method where the program asks you to input a certain string within a certain amount of seconds. E.g.

while goblin != str('dead'):
    type 'slash at goblin' within 3 seconds.
    if you succeed the program prints "you slash at the goblin, the goblin is now dead"
    goblin == str('dead')
    if you fail the program prints "the goblin slashes at you (-5 hp)."
    hp == int(hp) - 5
    and restarts the loop.

any ideas on how i could do this? how to force the program to type a command within a certain amount seconds? any help would be much appreciated THnx!

Marcelo Cantos
  • 167,268
  • 37
  • 309
  • 353
Dannyboy8899
  • 101
  • 2
  • 7
  • Maybe you could adapt this [Retry Loop](http://code.activestate.com/recipes/578527-retry-loop/?in=lang-python) recipe on ActiveState, – martineau Jun 15 '13 at 01:32

0 Answers0