4
\$\begingroup\$

OK, you don't really have to read it all, but I think you get the basic Idea. Does anyone have anything small that could make my code better? I just found out about "global" and "lower()". Is there any small thing you can give me that could improve my code a lot, or at least save me some time?

global myname
global move2
global move1
def script():
    print("Made by Chase - Winner Playz")
print("This is your Pokemon Journey!")
print("Thanks for playing... and a little sidenote... CATCHING IS CURRENTLY DISABLED, IF YOU TRY TO CATCH IT MIGHT CRASH")
print("DO NOT make any typos, this will result in you having to start the entire game over, there is no way to save progress")
print("PLEASE READ EVERYTHING, I KNOW ITS A LOT, BUT PLEASE DO OR IT WON'T MAKE ANY SENSE")
print("There are 3 starters in the lab, and they all seem quite skilled")
starter = input("What will YOU choose? You can pick, Geodude, Drowzee, or Tyrogue").lower()
#if starter == "view":
    #print("Geodude - Rock pokemon, Evolves into Graveler, Then Golem, Moveset: Earthquake, Rock Slide, Defense Curl, Tackle")
    #print("Drowzee - Psychic pokemon, Evolves into Hypno, Moveset: Hypnosis, Psychic, Dream Eater, Light Screen")
    #print("Charmander - Fire pokemon, Evolves into Charmaleon, then Charizard, Moveset: Blast Burn, Flame Thrower, Headbutt, Scary Face")
if starter == "geodude":
    print("Great choice! You decided on the Rock pokemon Geodude!")
    nicknamequestion = input("Would you like to nickname Geodude? (Yes or No?)").lower()
    if nicknamequestion == "yes":
        myname = input("What would you like to nickname it?")
        print("OK, your Geodude's new name is now",myname)
        print("Also note that you will not be able to use any of the pokemon that you catch (Catching is currently not working anyway)")
        print("You start your journey by walking into your first patch of grass...")
        print("A wild Rattata appeared!")
        print("Go",myname, "!")
        q1 = input("Would you like to attack, or try to catch it?").lower()
        if q1 == "attack" or "attack it":
            move1 = input("What would you like to use? Earthquake or Rock Slide?").lower()
        if move1 == "earthquake":
            print("You one shotted it, Fantastic!", myname, "is now level 6!")
            print("You move on...")
            print("You are now in Viridian City... but the gym seems to be locked")
            print("The gym's note say's...")
            print("The gym will be open after you collect another 2 badges")
            print("You move on to the next city...")
            print("There are a couple of trainers that want to battle you")
            print("For you're times sake, you will only have to do one of them, the others will be done for you")
            print("The trainer sent out Charmaleon")
            print("Go", myname)
            move2 = input("What would you like to use? Earthquake or Rock Slide?")
        elif move1 == "rockslide" or "rock slide":
            print("Enemy rattata is left with 6 health!")
            print("Enemy Rattata used Tackle")
            print(myname, "is left with 19 health")
            move5 = input("What would you like to use? Earthquake or Rock slide?").lower()
            if move5 == "earthquake" or "rock slide" or "rockslide":
                print("You defeated enemy Rattata, Geodude leveld up!")
                print("You move on...")
                print("You are now in Viridian City... but the gym seems to be locked")
                print("The gym's note say's...")
                print("The gym will be open after you collect another 2 badges")
                print("You move on to the next city...")
                print("There are a couple of trainers that want to battle you")
                print("For you're times sake, you will only have to do one of them, the others will be done for you")
                print("The trainer sent out Charmaleon")
                print("Go", myname)
                move2 = input("What would you like to use? Earthquake or Rock Slide?")
                if move2 == "earthquake":
                    print("It's super effective!")
                    print("You one shotted it, great", myname, "!")
                    print(myname, "is now level 7!")
                    print("You battled the other trainers, and your", myname, "is level 9")
                    print("This game doesnt follow actual pokemon, so your geodude will evolve at level 10")
                    print("You see a gym in a distance, and it looks like it's in Pewter city")
                    print("On your way there, a trainer want's to battle you, you accept")
                    print("The trainer sent out Hitmonchan!")
                    print("Oh, he has an advantage, but I think you can do this...")
                    print("I'm counting on you... Go", myname)
                    print("Enemy Hitmonchan used Mega Punch")
                    print("Enemy Hitmonchan's attack missed")
                    move3 = input("What would you like to use? Earthquake or Rock slide?").lower()
                    if move3 == "Earthquake":
                        print("Hitmonchan lost half of it's health!")
                        print("Enemy Hitmonchan used Mega Punch")
                        print(myname, "is left with 7 health!")
                        move4 = input("What would you like to use? Earthquake or Rock slide?").lower()
                        if move4 == "earthquake":
                            print("Enemy Hitmonchan fainted!")
                            print(myname, "leveled up to level 10!")
                            print("Alright", myname, "awesome!")
                            print("What!? Geodude is evolving")
                            print("...")
                            print("Conratulations! Your Geodude evolved into a Graveler!")
            print("You one shotted it, Fantastic!", myname, "is now level 6!")
            print("You move on...")
            print("You are now in Viridian City... but the gym seems to be locked")
            print("The gym's note say's...")
            print("The gym will be open after you collect another 2 badges")
            print("You move on to the next city...")
            print("There are a couple of trainers that want to battle you")
            print("For you're times sake, you will only have to do one of them, the others will be done for you")
            print("The trainer sent out Charmaleon")
            print("Go", myname)
            move2 = input("What would you like to use? Earthquake or Rock Slide?")
            if move2 == "earthquake":
                print("It's super effective!")
                print("You one shotted it, great", myname,"!")
                print(myname, "is now level 7!")
                print("You battled the other trainers, and your", myname, "is level 9")
                print("This game doesnt follow actual pokemon, so your geodude will evolve at level 10")
                print("You see a gym in a distance, and it looks like it's in Pewter city")
                print("On your way there, a trainer want's to battle you, you accept")
                print("The trainer sent out Hitmonchan!")
                print("Oh, he has an advantage, but I think you can do this...")
                print("I'm counting on you... Go", myname)
                print("Enemy Hitmonchan used Mega Punch")
                print("Enemy Hitmonchan's attack missed")
                move3 = input("What would you like to use? Earthquake or Rock slide?").lower()
                if move3 == "Earthquake":
                    print("Hitmonchan lost half of it's health!")
                    print("Enemy Hitmonchan used Mega Punch")
                    print(myname, "is left with 7 health!")
                    move4 = input("What would you like to use? Earthquake or Rock slide?").lower()
                    if move4 == "earthquake":
                        print("Enemy Hitmonchan fainted!")
                        print(myname, "leveled up to level 10!")
                        print("Alright", myname, "awesome!")
                        print("What!? Geodude is evolving")
                        print("...")
                        print("Conratulations! Your Geodude evolved into a Graveler!")
    if nicknamequestion == "no":
        print("Also note that you will not be able to use any of the pokemon that you catch (Catching is currently not working anyway)")
        print("You start your journey by walking into your first patch of grass...")
        print("A wild Rattata appeared!")
        print("Go Geodude!")
        q1 = input("Would you like to attack, or try to catch it?").lower()
        if q1 == "attack" or "attack it":
            move1 = input("What would you like to use? Earthquake or Rock Slide?").lower()
            if move1 == "earthquake":
                print("You one shotted it, Fantastic! Your Geodude is now level 6!")
                print("You move on...")
                print("You are now in Viridian City... but the gym seems to be locked")
                print("The gym's note say's...")
                print("The gym will be open after you collect another 2 badges")
                print("You move on to the next city...")
                print("There are a couple of trainers that want to battle you")
                print("For you're times sake, you will only have to do one of them, the others will be done for you")
                print("The trainer sent out Charmaleon")
                print("Go Geodude!")
                move2 = input("What would you like to use? Earthquake or Rock Slide?")
                if move2 == "earthquake":
                    print("It's super effective!")
                    print("You one shotted it, great Geodude!")
                    print("Geodude is now level 7!")
                    print("You battled the other trainers, and your Geodude is level 9")
                    print("This game doesnt follow actual pokemon, so your geodude will evolve at level 10")
                    print("You see a gym in a distance, and it looks like it's in Pewter city")
                    print("On your way there, a trainer want's to battle you, you accept")
                    print("The trainer sent out Hitmonchan!")
                    print("Oh, he has an advantage, but I think you can do this...")
                    print("I'm counting on you... Go Geodude")
                    print("Enemy Hitmonchan used Mega Punch")
                    print("Enemy Hitmonchan's attack missed")
                    move3 = input("What would you like to use? Earthquake or Rock slide?").lower()
                    if move3 == "Earthquake":
                        print("Hitmonchan lost half of it's health!")
                        print("Enemy Hitmonchan used Mega Punch")
                        print("Geodude is left with 7 health!")
                        move4 = input("What would you like to use? Earthquake or Rock slide?").lower()
                        if move4 == "earthquake":
                            print("Enemy Hitmonchan fainted!")
                            print("Geodude leveled up to level 10!")
                            print("Alright Geodude, awesome!")
                            print("What!? Geodude is evolving")
                            print("...")
                            print("Conratulations! Your Geodude evolved into a Graveler!")
            if move2 == "rock slide" or "rockslide":
                print("It's super effective!")
                print("You one shotted it, great Geodude!")
                print("Geodude is now level 7!")
                print("You battled the other trainers, and your Geodude is level 9")
                print("This game doesnt follow actual pokemon, so your geodude will evolve at level 10")
                print("You see a gym in a distance, and it looks like it's in Pewter city")
                print("On your way there, a trainer want's to battle you, you accept")
                print("The trainer sent out Hitmonchan!")
                print("Oh, he has an advantage, but I think you can do this...")
                print("I'm counting on you... Go Geodude")
                print("Enemy Hitmonchan used Mega Punch")
                print("Enemy Hitmonchan's attack missed")
                move3 = input("What would you like to use? Earthquake or Rock slide?").lower()
                if move3 == "Earthquake":
                    print("Hitmonchan lost half of it's health!")
                    print("Enemy Hitmonchan used Mega Punch")
                    print("Geodude is left with 7 health!")
                    move4 = input("What would you like to use? Earthquake or Rock slide?").lower()
                    if move4 == "earthquake":
                        print("Enemy Hitmonchan fainted!")
                        print("Geodude leveled up to level 10!")
                        print("Alright Geodude, awesome!")
                        print("What!? Geodude is evolving")
                        print("...")
                        print("Conratulations! Your Geodude evolved into a Graveler!")
        elif move1 == "rock slide" or "rockslide":
            print("You almost one shotted it... ")
            print("Enemy Rattata used Tackle!")
            print("It's not very effective...")
            move2 = input("What would you like to use? Earthquake or Rock Side?").lower()
            if move2 == "earthquake" or "rockslide" or "rock slide":
                print("Congrats! You defeated the Rattata, and your Geodude has leveled up!")
                print("You move on...")
                print("You are now in Viridian City... but the gym seems to be locked")
                print("The gym's note say's...")
                print("The gym will be open after you collect another 2 badges")
                print("You move on to the next city...")
                print("There are a couple of trainers that want to battle you")
                print("For you're times sake, you will only have to do one of them, the others will be done for you")
                print("The trainer sent out Charmaleon")
                print("Go Geodude!")
                move2 = input("What would you like to use? Earthquake or Rock Slide?")
                if move2 == "earthquake":
                    print("It's super effective!")
                    print("You one shotted it, great Geodude!")
                    print("Geodude is now level 7!")
                    print("You battled the other trainers, and your Geodude is level 9")
                    print("This game doesnt follow actual pokemon, so your geodude will evolve at level 10")
                    print("You see a gym in a distance, and it looks like it's in Pewter city")
                    print("On your way there, a trainer want's to battle you, you accept")
                    print("The trainer sent out Hitmonchan!")
                    print("Oh, he has an advantage, but I think you can do this...")
                    print("I'm counting on you... Go Geodude")
                    print("Enemy Hitmonchan used Mega Punch")
                    print("Enemy Hitmonchan's attack missed")
                    move3 = input("What would you like to use? Earthquake or Rock slide?").lower()
                    if move3 == "Earthquake":
                        print("Hitmonchan lost half of it's health!")
                        print("Enemy Hitmonchan used Mega Punch")
                        print("Geodude is left with 7 health!")
                        move4 = input("What would you like to use? Earthquake or Rock slide?").lower()
                        if move4 == "earthquake":
                            print("Enemy Hitmonchan fainted!")
                            print("Geodude leveled up to level 10!")
                            print("Alright Geodude, awesome!")
                            print("What!? Geodude is evolving")
                            print("...")
                            print("Conratulations! Your Geodude evolved into a Graveler!")
    #elif q1 == "catch" or "Catch it" or "Catch" or "catch it":
        #print("You threw the Pokeball... and you CAUGHT IT!")
if starter == "drowzee":
    print("Great choice! You decided on the Psychic pokemon Drowzee!")
    nicknamequestion = input("Would you like to nickname Geodude? (Yes or No?)").lower()
    if nicknamequestion == "yes":
        myname = input("What would you like to nickname it?")
        print("OK, your Drowzee's new name is now",myname)
    print("Also note that you will not be able to use any of the pokemon that you catch (Catching is currently not working anyway)")
    print("You start your journey by walking into your first patch of grass...")
    print("A wild Rattata appeared!")
    print("Go", myname, "!")
    q1 = input("Would you like to attack, or try to catch it?").lower()
    if q1 == "attack" or "attack it":
        move1 = input("What would you like to use? Psychic or Headbutt?").lower()
        if move1 == "psychic":
            print("You one shotted it, Fantastic!", myname, "is now level 6!")
            print("You move on...")
            print("You are now in Viridian City... but the gym seems to be locked")
            print("The gym's note say's...")
            print("The gym will be open after you collect another 2 badges")
            print("You move on to the next city...")
            print("There are a couple of trainers that want to battle you")
            print("For you're times sake, you will only have to do one of them, the others will be done for you")
            print("The trainer sent out Charmaleon")
            print("Go", myname)
            move2 = input("What would you like to use? Earthquake or Rock Slide?")
            if move2 == "earthquake":
                print("It's super effective!")
                print("You one shotted it, great", myname,"!")
                print(myname, "is now level 7!")
                print("You battled the other trainers, and your", myname, "is level 9")
                print("This game doesnt follow actual pokemon, so your geodude will evolve at level 10")
                print("You see a gym in a distance, and it looks like it's in Pewter city")
                print("On your way there, a trainer want's to battle you, you accept")
                print("The trainer sent out Hitmonchan!")
                print("Oh, he has an advantage, but I think you can do this...")
                print("I'm counting on you... Go", myname)
                print("Enemy Hitmonchan used Mega Punch")
                print("Enemy Hitmonchan's attack missed")
                move3 = input("What would you like to use? Earthquake or Rock slide?").lower()
                if move3 == "Earthquake":
                    print("Hitmonchan lost half of it's health!")
                    print("Enemy Hitmonchan used Mega Punch")
                    print(myname, "is left with 7 health!")
                    move4 = input("What would you like to use? Earthquake or Rock slide?").lower()
                    if move4 == "earthquake":
                        print("Enemy Hitmonchan fainted!")
                        print(myname, "leveled up to level 10!")
                        print("Alright", myname, "awesome!")
                        print("What!? Geodude is evolving")
                        print("...")
                        print("Conratulations! Your Geodude evolved into a Graveler!")
    print("Also note that you will not be able to use any of the pokemon that you catch (Catching is currently not working anyway)")
    print("You start your journey by walking into your first patch of grass...")
    print("A wild Rattata appeared!")
    print("Go Drowzee!")
    q1 = input("Would you like to attack, or try to catch it?").lower()
    if q1 == "attack" or "attack it":
        move1 = input("What would you like to use? Psychic or Headbutt?").lower()
        if move1 == "psychic":
            print("You one shotted it, Fantastic! Your Drowzee is now level 6!")
            print("You move on...")
            print("You are now in Viridian City... but the gym seems to be locked")
            print("The gym's note say's...")
            print("The gym will be open after you collect another 2 badges")
            print("You move on to the next city...")
            print("There are a couple of trainers that want to battle you")
            print("For you're times sake, you will only have to do one of them, the others will be done for you")
            print("The trainer sent out Charmaleon")
            print("Go Drowzee!")
            move2 = input("What would you like to use? Psychic or Headbutt?")
            if move2 == "psychic":
                print("You one shotted it, great Drowzee!")
                print("Drowzee is now level 7!")
                print("You battled the other trainers, and your Drowzee is level 9")
                print("This game doesnt follow actual pokemon, so your Drowzee will evolve at level 10")
        elif move1 == "headbutt" or "head butt":
            print("You almost one shotted it... ")
            print("Enemy Rattata used Tackle!")
            print("Drowzee has 17 health remaining!")
            move2 = input("What would you like to use? Psychic or Headbutt?").lower()
            if move2 == "psychic" or "head butt" or "headbutt":
                print("Congrats! You defeated the Rattata, and your Drowzee has leveled up!")
                print("You move on...")
                print("You are now in Viridian City... but the gym seems to be locked")
                print("The gym's note say's...")
                print("The gym will be open after you collect another 2 badges")
                print("You move on to the next city...")
                print("There are a couple of trainers that want to battle you")
                print("For you're times sake, you will only have to do one of them, the others will be done for you")
                print("The trainer sent out Charmaleon")
                print("Go Drowzee!")
                move2 = input("What would you like to use? Psychic or Headbutt?").lower()
                if move2 == "psychic":
                    print("You one shotted it, great Drowzee!")
                    print("Drowzee is now level 7!")
                    print("You battled the other trainers, and your Drowzee is level 9")
                    print("This game doesnt follow actual pokemon, so your Drowzee will evolve at level 10")
    elif q1 == "catch" or "Catch it" or "Catch" or "catch it":
        print("You threw the Pokeball... and you CAUGHT IT!")
\$\endgroup\$
4
  • \$\begingroup\$ Hello there, Welcome to codereview, Your code can easily be understood but it is recommended that you explain your code a bit at the start. \$\endgroup\$ Jun 2, 2020 at 21:44
  • \$\begingroup\$ Oh OK, sorry about that \$\endgroup\$ Jun 2, 2020 at 21:47
  • \$\begingroup\$ It's Python BTW, for anyone who doesn't know. sorry for not clarifying that earlier \$\endgroup\$ Jun 2, 2020 at 21:48
  • \$\begingroup\$ You surely will like twinery.org/2 to write interactive stories very simply for free \$\endgroup\$
    – Caridorc
    Jun 3, 2020 at 10:45

1 Answer 1

2
\$\begingroup\$

Bug

elif q1 == "catch" or "Catch it" or "Catch" or "catch it":

Because:

>>> q1 = "a"
>>> q1 == "catch" or "Catch it" or "Catch" or "catch it"
'Catch it'
>>> "catch" == "catch" or "Catch it" or "Catch" or "catch it"
True
>>> "0" == "catch" or "Catch it" or "Catch" or "catch it"
'Catch it'

So it is true for all strings.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Eyup you are correct. \$\endgroup\$ Jun 3, 2020 at 9:35
  • \$\begingroup\$ Wait, what exactly was done with the code here? \$\endgroup\$ Jun 3, 2020 at 14:41
  • \$\begingroup\$ @Chase-WinnerPlayz elif q1 in ["catch", "Catch it", "Catch", "catch it"]: but you could make it easier with elif q1.lower().startswith('catch'): and cover everything starting with "catch" \$\endgroup\$
    – xhainingx
    Jun 3, 2020 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.