Mrocks22 Ответов: 0

Как использовать переменную в одном определенном блоке в другом определенном блоке


Я создаю игру для школьного проекта на python и столкнулся с проблемой
Я хочу создать переменную после каждого ответа, которая говорит что-то вроде

batdenlocation = 'unlocked'


Затем эта переменная будет вызвана в другом определенном разделе

def Fairshadeguild():
    print("You walk through the door of the Adventurer's Guild and and a voice calls out to you")
    print('Hello, ' + address + ' ,what can I do for you?')
    print('The voice came from a receptionist woman standing at the counter.')
    print('')
    reply = input('''How do you reply?
1. Nothing much just looking around
2. Yeah, I was wondering if I could sign up as an adventurer
3. Nothing much just looking for a party to join''')
        if reply == '1':
            print('')
            print('The receptionist then begins to strike up a converation with another person letting you look around the guild')
            print('You gaze around the room and see a corkboard with many papers pinned to it.')
            print('''One paper in particular catches your eye. It says
"Clearing of Monster Bats Den"
    Reward - 100 gold''')
            print('You decide to clear the den of monster bats to earn some money')
            print('-Location Beastly Bat Den added to map signboard-')
            print('')
            
        if reply == '2':
            print('')
            print('The receptionist proceeds to take out several forms which you complete')
            print('"Now all you need to do is clear a local monsters den to prove you have to strength to be an adventurer"')
            print('-Location Beastly Bat Den added to map signboard-')
            print('')
            
        if reply == '3':
            print('')
            print('As you wander around the guild a veteran adventurer calls out you')
            print('"Ahh, a new face, you should go and sharpen your skills at the monsters den"')
            print('-Location Beastly Bat Den added to map signboard-')
            print('')

def mapsignboard():
    print('where do you want to go?')
    if batdenlocation == 'unlocked'
        print('- Beastly Bat den')


Что я уже пробовал:

Я попытался использовать функцию return для возврата batdenlocation, однако затем код просто заканчивается, и игра не прогрессирует.

0 Ответов