-2

I have no idea what string it's talking about so I am kind of stuck. Also have no clue how a string can't be callable, did they mean variable or something?

from time import *

sleep(1)
axecount = 0

#intro

def fail():
  global rcommand
  rcommand = None
  sleep(1)
  print('---------------------------------------------')
  print('What? I did not understand, lol. Please time travel back to the past and retry.')
  sleep(1)
  print('')
  print('| RETURN |')
  print('---------------------------------------------')
  rcommand = input('Command:')
  if rcommand == 'RETURN':
    play()
  else:
    fail()
  print('---------------------------------------------')

def play():
  global axecount
  global rcommand
  rcommand = None
  print('---------------------------------------------')
  print('Welcome to...')
  print('')
  sleep(1)
  print('-=-=An Adventure through Time=-=-')
  print('')
  sleep(1)
  print('| PLAY | HELP | STORY |')
  print('')
  print('---------------------------------------------')
  sleep(1)
  play = (input('Command:'))
  print('---------------------------------------------')

  #if player chooses to play

  if play == 'PLAY':
    sleep(1)
    print('Well, let us begin!')
    print('')
    sleep(1)

    #map selection begins

    print('Select a map: DIMENSION, LANDMASS')
    print('---------------------------------------------')
    mapchooser = (input('Map chosen:'))

    #if player chooses the dimension map then...

    if mapchooser == 'DIMENSION':
      print('---------------------------------------------')
      print('Map DIMENSION loading...')
      print('---------------------------------------------')
      sleep(2)
      print('Loaded!')
      print('---------------------------------------------')
      sleep(1)
      print('-Stage 1-')
      print('---------------------------------------------')
      sleep(1)
      print('There are 3 doors. One at your LEFT, RIGHT, and FORWARD. Where do you go?')
      sleep(1)
      print('One of them has a monster... Good luck.')
      print('---------------------------------------------')

      #direction that he chooses to go at the first door choice

      def firstdoor():
        global axecount
        firstdoor = input('Command:')
        print('---------------------------------------------')

        #if player chooses to go left

        if firstdoor == 'LEFT':

          #dies

          sleep(1)
          print('Ouch! A monster! Travel back in time and retry!')
          print('---------------------------------------------')
        elif firstdoor == 'RIGHT':
          sleep(1)
          print('Wow, a chest has been found!')
          sleep(1)
          print('You get an axe!')
          print('Type INVENTORY as your command to view your items.')
          axecount += 1
          print('---------------------------------------------')

        elif firstdoor == 'INVENTORY':

          #opens inventory of player

          sleep(1)
          print('You have... ')
          print('Axes - ' + axecount)
          firstdoor()

      firstdoor()


    #if player chooses the landmass map then...

    elif mapchooser == 'LANDMASS':
      print('---------------------------------------------')
      print('Map LANDMASS loading...')
      sleep(3)
      print('Map LANDMASS not yet created. Coming soon!')
      print('Please time travel back to the past and retry.')
      sleep(1)
      print('| RETURN |')
      print('---------------------------------------------')
      rcommand = input('Command:')
      if rcommand == 'RETURN':
        play()
      else:
        fail()
      print('---------------------------------------------')

    #if player enters some nonsense that isnt correct

    else:
      sleep(1)
      print('---------------------------------------------')
      print('What? I did not understand, lol. Please time travel back to the past and retry.')
      sleep(1)
      print('')
      sleep(1)
      print('Look at HELP for more information.')
      print('---------------------------------------------')
      sleep(1)
      print('| RETURN |')
      print('---------------------------------------------')
      rcommand = input('Command:')
      if rcommand == 'RETURN':
        play()
      else:
        fail()
      print('---------------------------------------------')

  #help screenH

  elif play == 'HELP':
    sleep(1)
    print('Answer the command exactly how it looks like on the selection.')
    print('Example: Enter PLAY if it says PLAY')
    print('')
    sleep(1)
    print('There are monsters in some rooms and chests in some rooms.')
    print('Monsters kill you and the game ends.')
    print('Chests give you materials to try and kill the monster.')
    print('')
    sleep(1)
    print('Restart the game to go back to the selection screen.')
    sleep(1)
    print('---------------------------------------------')
    print('| RETURN |')
    print('---------------------------------------------')
    rcommand = input('Command:')
    if rcommand == 'RETURN':
      play()
    else:
      fail()


  elif play == 'STORY':
    sleep(1)
    print('You enter a dungeon but not all is what it seems...')
    sleep(1)
    print('The dungeon is haunted by powerful magic...')
    sleep(1)
    print('And each time you go to a room, the other rooms age by 10 years.')
    sleep(1)
    print('Is luck on your side?')
    sleep(1)
    print('---------------------------------------------')
    print('| RETURN |')
    print('---------------------------------------------')
    rcommand = input('Command:')
    if rcommand == 'RETURN':
      play()
    else:
      fail()
    print('---------------------------------------------')

  #if player enters some nonsense that isnt correct

  else:
    fail()

play()
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
keiowo
  • 11
  • 3

2 Answers2

0

You have a variable named play on line, right here :

  sleep(1)
  play = (input('Command:'))
  print('---------------------------------------------')

This naming interferes with your function naming, changing this variable name to something not already used for a function should solve the problem.

TheWildHealer
  • 1,546
  • 1
  • 15
  • 26
0

You have a variable called play

play = (input('Command:'))

Now play is a string, so if you try and call play(), it is trying to call a string as if it were a function.

If you call your play variable something else, it won't conflict with the function name play.

khelwood
  • 55,782
  • 14
  • 81
  • 108