<<|| idk what is wrong!||>> python syntax error! pls help!


#1




>
- invalid Syntax .>

#The City of Anmer
import time
potion=0        # User starts with 0 potions 
print("Welcome to My Text Adventure Game")
print("A long time ago, there was a magical city called Anmer \n" +
      "However, soon Anmer went under attack by the beasts of Xalaxxi\n" + 
      "The potions of Anmer went missing\n"+
      "The potions is what keeps the magic running without it all mystical creatures will die out\n" +
      "Can you find the Hidden potions of Anmer?")
hero=input("What is your name?")#input of users name
print("Greetings",hero,"! Good luck on your quest.")
print("You have",potion,"potions at this time.")
valid_option=0
while valid_option==0:
    direction=input("You are at Anmer, right now.\n" +
      "You have only THERE options. Left, Right and up.\n" +
      "Type 'left', 'right' or 'up'.")
    if direction=="left" or "Left":
        valid_option=0
        print("You have decided to turn left.")
        time.sleep(2)
        print("This place is dark and smelly. \n" +
              "You lose your footing and fall down",hero,"the misty fog has blinded you\n" +
              "You pause a while and look around.\n" +
              "You hear something dripping.\n" +
              "It's the potions!")
        choice1=input("Do you pick up the potions and keep it?\n" +
                      "Or leave it because it's not yours? Type 'keep' or 'leave'")
    elif choice1=="keep" or "Keep":
        valid_option=0
        print("Good choice. The people of Anmer will see you as their hero!")
        potion=potion+5
        print("You have",potion,"potions at this time.")
    elif choice1=="leave" or "Leave":
            print("I admire your honesty, but Anmer relies on you!\n" +
                  "It doesn't matter if it's not your, the creatures of Anmer will die!")
            print("You have",potion,"potions at this time.")
    else:
            print("Invalid option. Try again.")

    if direction=="right" or "Right":
            valid_option=0
            print("You walk along a long road. It is very quiet.")
            print("Wait! What's this? You've reached a dead end.\n" +
            print("Out of the misty fog a group of Harpies emerge and try to attack you")
    if direction=="up" or "Up":
            valid_option=0
            print("Oh no you have travelled in circles and you have returned back to Anmer.\n" +
                  "All you can see corpses hanging around the city.\n" +
                  "You have failed big time\n")   
            print("Soon after you join the group of corpses! Try again.")
#<<||END OF GAME||>>
print("Well done, you have saved the mystical creatures of Anmer \n"+
      "As a reward for saving everyone you become the king of Anmer")
print("Game has finished!")

#2

At line 46, namely print("Wait! What's this? You've reached a dead end.\n" you forgot to close the bracket.
CORRECTION:
print("Wait! What's this? You've reached a dead end.\n"
WILL NEED TO BE CHANGED WITH
print("Wait! What's this? You've reached a dead end.\n" )
And seeing as you want to simply print the string you actually can do without the brackets
print "Wait! What's this? You've reached a dead end.\n"


#3

Thank you.
You helped me getting it working.:grin:


#4

You are welcome :slight_smile:!


#5

hey,
I like it a lot, it never played these text adventure games but they remind me of good times. Anyway, keep on writing :slight_smile:
if you don't mind I tweaked your code so it is now running correctly. there were a couple of wrong elifs and valid_option was never = 1 so game was looping all the time, and some indentations missing. Anyway, nice work!!

#The City of Anmer by chipmaster64069
import time
potion=0        # User starts with 0 potions 
print("Welcome to My Text Adventure Game")
print("A long time ago, there was a magical city called Anmer \n" +
      "However, soon Anmer went under attack by the beasts of Xalaxxi\n" + 
      "The potions of Anmer went missing\n"+
      "The potions is what keeps the magic running without it all mystical creatures will die out\n" +
      "Can you find the Hidden potions of Anmer?")
hero=input("What is your name?")#input of users name
print("Greetings",hero,"! Good luck on your quest.")
print("You have",potion,"potions at this time.")
valid_option=0
while valid_option==0:
    direction=input("You are at Anmer, right now.\n" +
      "You have only THERE options. Left, Right and up.\n" +
      "Type 'left', 'right' or 'up'.")
    if direction==("left" or "Left"):
        valid_option=0
        print("You have decided to turn left.")
        time.sleep(2)
        print("This place is dark and smelly. \n" +
              "You lose your footing and fall down",hero,"the misty fog has blinded you\n" +
              "You pause a while and look around.\n" +
              "You hear something dripping.\n" +
              "It's the potions!")
        choice1=input("Do you pick up the potions and keep it?\n" +
                      "Or leave it because it's not yours? Type 'keep' or 'leave'")
        if choice1==("keep" or "Keep"):
            valid_option=1
            print("Good choice. The people of Anmer will see you as their hero!")
            potion=potion+5
            print("You have",potion,"potions at this time.")
        elif choice1==("leave" or "Leave"):
            print("I admire your honesty, but Anmer relies on you!\n" +
                  "It doesn't matter if it's not your, the creatures of Anmer will die!")
            print("You have",potion,"potions at this time.")
        else:
            print("Invalid option. Try again.")

    elif direction==("right" or "Right"):
            valid_option=0
            print("You walk along a long road. It is very quiet.")
            print("Wait! What's this? You've reached a dead end.\n" +
                "Out of the misty fog a group of Harpies emerge and try to attack you")
    elif direction==("up" or "Up"):
            valid_option=0
            print("Oh no you have travelled in circles and you have returned back to Anmer.\n" +
                  "All you can see corpses hanging around the city.\n" +
                  "You have failed big time\n")   
            print("Soon after you join the group of corpses! Try again.")
#<<||END OF GAME||>>
print("Well done, you have saved the mystical creatures of Anmer \n"+
      "As a reward for saving everyone you become the king of Anmer")
print("Game has finished!")