import time
def temp():
print(script)
print(a,sce1)
print(b,sce2)
print(c,sce3)
print(d,sce4)
choice = str(input())
return choice
if choice =="i":
print(inventory)
if choice =="p":
print(storyline_varable)
script = ""
a = ""
b = ""
c = ""
d = ""
sce1 = ""
sce2 = ""
sce3 = ""
sce4 = ""
choice = ""
inventory = list((""))
storyline_variable = list((""))
print("Welcome to choice dungeon! Go through this dangerous place by typing the letter of the choice you'd like to make (also type 'i' to see your inventory and 'p' to see important choices made), good luck!")
time.sleep(4)
#start
script = "You lay shackled to a wall in a room with damp walls made of rough stone, you are cold and wet, what do you do?"
sce1 = "Pull the shackles"
sce2 = "Shout for help"
sce3 = "Sit in the cold dark room for a while"
sce4 = "Start nawing your hand off"
a = "a-"
b = "b-"
c = "c-"
d = "d-"
if temp() == "a" or temp() == "ba" or temp() == "ca":
#a&ba&ca
script = "Your shackles break free, there is a dimmly lit room with a skeleton, a torch and a closed door"
sce1 = "Grab the torch"
sce2 = "Search the skeleton"
sce3 = "Go through the door"
a = "aa-"
b = "ab-"
c = "ac-"
d = "ad-"
if temp() == "b":
#b&cb&db
storyline_variable.append("Someone has been woken up")
script = "You call for hours to no avail, until you hear a faint shout from a distance: 'Shut up'. Try another option"
sce1 = "Pull the shackles"
sce2 = "Shout for help...again"
sce3 = "Sit in the cold dark room for a while"
sce4 = "Start nawing your hand off"
a = "ba-"
b = "bb-"
c = "bc-"
d = "bd-"
if temp() == "c" or temp() == "bc" or temp() == "cc":
#c&cc
script = "You just sit there, it's a bit uncomfortable and a tad boring but it isn't that bad. Try another option"
sce1 = "Pull the shackles"
sce2 = "Shout for help"
sce3 = "Sit there more"
sce4 = "Start nawing your hand off"
a = "ca-"
b = "cb-"
c = "cc-"
d = "cd-"
if temp() == "d" or temp() == "bd" or temp() == "cd":
print("Was it worth it? You bled out... ouch")
else:
print("Pressing a random button doesn't help you know? You know what? You died for being stupid")
Вот полный код, который я не могу заставить работать, кто-нибудь может помочь?
Я не на 100% о том, как работают функции и как их использовать в операторе if, как бы это исправить?
Единственное, что отображает правильное сообщение, это если я поставлю 'a', затем 'b', затем 'c', затем 'd', все остальное повторяет строку #start, и я не могу понять, почему.
Как вы, вероятно, видите, я делаю игру в стиле подземелий и драконов, и вы также можете сказать, что я относительно новичок в использовании python, мне очень жаль, если я не могу понять ответы, которые вы даете. Также имейте в виду, что этот код предназначен для прохождения «подземелья», поэтому могут иметь некоторые элементы, показывающие это.