I am making a small python text based game, and Im having an issue with the global variable assignment. Heres the code in question.
print("story text removed for length")
light = False
killer_location =2
wolves = True;
commands = ["n", "S", "E", "W", "north", "south", "east", "west", "look","use","pick up", "attack","jump","throw"]
inventory = ["testinventoryobjectforarray"]
user_input = ">"
def forestscene():
print("You are in a small clearing in the woods. Tall trees in every direction.")
print("You see a dirt road to the north of you. ")
while user_input not in commands:
print("...")
user_input = input("> ")
if user_input.lower() == "n" or user_input.lower() == "north":
roadscene()
elif user_input.lower() == "s" or user_input.lower() == "south":
wolfscene()
elif user_input.lower() == "e" or user_input.lower() == "east":
print("The trees are too dense and it's too dark to proceed further east.")
forestscene()
However upon running, each function call returns "local variable User_Input referenced before assignment". I've tried adding global user_input, however that only resolved the first line, and adding them to all the calls causes the code to end after the first user input. Please help.