I wrote my code as normal but for some reason when it gets to the point before def jscript() it just stops. No errors or anything it just stops. Can someone help me pls. Sorry for all the code... Here is all my code to try out and then you will understand what is happening. I think the copy and paste messed up the indentation though.
def script():
Wins = 0
Fails = 0
Energy = 20
Fuel = 40
Oxygen = 30
Coins = 10
Life = 100
AlienLife = 250
global Energy
global Fuel
global Oxygen
global Coins
global Life
global Wins
global Fails
time.sleep(5)
firstName = input("Hello! What is your first name? ")
surnameName = input(" And what is your surname? ")
fullName = firstName + " " + surnameName
print ("Ok then. Welcome,",fullName,"to the Age Of Space! Here you will have to drive your spaceship victoriously and survive all enemy threats. Your mission is to free Earth from the alien abduction!")
time.sleep(7)
print("Btw good luck in defeating the alien king! ;)")
time.sleep(3)
print("Your spaceship will take off in 5...")
time.sleep(2)
print("4...")
time.sleep(1)
print("3...")
time.sleep(1)
print("2...")
time.sleep(1)
print("1...")
time.sleep(2)
print ("BLAST OFF!!!")
time.sleep(5)
print("You are now in the depths of space. Commander please ensure that you keep safe during your journey. Good luck!")
time.sleep(2)
sleep = input("Commander, would you like to sleep now? If yes then we can take out your bed. ")
if sleep == "yes":
Energy = Energy + 5
print("We have taken out your bed. The spaceship is on autopilot and you may now sleep.")
time.sleep(4)
print("2 weeks later...")
else:
Energy = Energy - 5
print("Ok. It is all your choice. BUT you WILL lose energy. Lets carry on with the journey. You have",Energy,"energy remaining.")
time.sleep(4)
print("Commander, you have been extremely successful so far. Well done and keep it up!")
time.sleep(6)
direction = input("Oh no Sir! There is trouble ahead! Please make your decision quick. It's a matter of life and death. It is also a matter of chance! There are many asteroids ahead. You may either go forwards, backwards, left or right. Make your decision...before it's too late! ")
if direction == "left":
Coins = Coins + 15
Fuel = Fuel - 15
while True:
print ("You have managed to pass the asteroids, you may now carry on. You have",Fuel,"fuel left.")
break
continue
elif direction == "backwards":
print("You have retreated and gone back to Earth. You will have to start your mission all over again.")
time.sleep(2.5)
print("The game will now restart.")
time.sleep(2)
print("Please wait...\n"*3)
time.sleep(5)
keep_playing = True
while True:
script()
elif direction == "forwards":
Fails = Fails + 1
print("You have crashed and passed away. Your bravery will always be remembered even if you did fail terribly. You have failed",Fails,"times.")
time.sleep(3)
ans = input("Do you want to play again? ")
if ans == "yes":
time.sleep(6)
script()
else:
print("Our Earth is now an alien world...")
else:
Fuel = Fuel - 10
Coins = Coins + 15
print("You have landed on a planet and have",Fuel,"fuel left.")
time.sleep(1)
def myscript():
Fuel = 30
Oxygen = 30
Coins = 25
print("What do you want to buy? You have currently",Coins,"coins and",Fuel,"fuel.")
print ("You have a choice between the following and may only buy one:")
time.sleep(1)
pistol = 20
print("A pistol for 20 coins")
time.sleep(1)
costfuel = 10
print("15 fuel for 10 coins")
time.sleep(1)
shotgun = 40
print("A shotgun for 40 coins")
time.sleep(1)
costoxygen = 10
print("10 oxygen for 10 coins")
time.sleep(1)
costlife = 50
print("or 5 life for 50 coins")
time.sleep(1)
choose = input("You may now choose which of the following you want - please type it in e.g fuel. ")
if choose == "pistol":
while Coins < pistol:
print ("You cannot buy this as you do not have enough money. Please type in something else.")
time.sleep(4)
myscript()
break
else:
Coins = Coins - 20
print ("Thank you for purchasing the pistol! You have",Coins,"coins remaining.")
elif choose == "fuel":
while Coins < costfuel:
print ("You cannot buy this as you do not have enough money. Please type in something else.")
time.sleep(4)
global Coins
myscript()
break
else:
Coins = Coins - 10
Fuel = Fuel + 15
print ("Thank you for purchasing the fuel! You have",Fuel,"fuel remaining and",Coins,"coins remaining.")
elif choose == "shotgun":
while Coins < shotgun:
print ("You cannot buy this as you do not have enough money. Please type in something else.")
time.sleep(4)
global Coins
global Fuel
Coins = 15
Fuel = 45
myscript()
break
else:
Coins = Coins - 40
print ("Thank you for purchasing the shotgun! You have",Coins,"coins remaining")
elif choose == "oxygen":
while Coins < costoxygen:
print ("You cannot buy this as you do not have enough money. Please type in something else.")
time.sleep(4)
global Coins
myscript()
break
else:
Coins = Coins - 10
Oxygen = Oxygen + 10
print ("Thank you for purchasing the oxygen! You have",Coins,"coins remaining and",Oxygen,"oxygen remaining.")
global Coins
Coins = 15
global Oxygen
Oxygen = 40
else:
while Coins < costlife:
print ("You cannot buy this as you do not have enough money. Please type in something else.")
time.sleep(4)
myscript()
break
else:
Coins = Coins - 50
print ("Thank you for purchasing more life! You have",Coins,"coins remaining and",Life,"life remaining!")
myscript()
time.sleep(3.5)
prin = input("Well done Commander! Bravo! You are doing excellent! Would you like to eat? ")
if prin == "yes":
Oxygen = Oxygen - 10
print ("There is a lot of food in the cupboard please help yourself.")
else:
print ("Very well, hope you don't get hungry Sir.")
time.sleep(2.5)
papy = input("Would you like to go to sleep commander? ")
if papy == "yes":
Energy = Energy + 5
print("Hope you have a great nap and fill yourself with enrgy Sir! Your bed has been taken out and you may now sleep.")
time.sleep(6)
print("15 hours later...")
time.sleep(3.5)
print("Sir! Sorry to interfere your sleep but you have landed on a planet!")
def minescript():
global Coins
global Oxygen
global Fuel
print("What do you want to buy? You have currently",Coins,"coins and",Fuel,"fuel.")
print ("You have a choice between the following and may only buy one:")
time.sleep(1)
pistol = 20
print("A pistol for 20 coins")
time.sleep(1)
costfuel = 10
print("15 fuel for 10 coins")
time.sleep(1)
shotgun = 40
print("A shotgun for 40 coins")
time.sleep(1)
costoxygen = 10
print("10 oxygen for 10 coins")
time.sleep(1)
choose = input("You may now choose which of the following you want - please type it in e.g fuel. If you do not have enough money to buy anything type in 'nothing'. ")
if choose == "pistol":
while Coins < pistol:
print ("You cannot buy this as you do not have enough money. Please type in something else.")
time.sleep(4)
minescript()
break
else:
Coins = Coins - 20
print ("Thank you for purchasing the pistol! You have",Coins,"coins remaining.")
elif choose == "fuel":
while Coins < costfuel:
print ("You cannot buy this as you do not have enough money. Please type in something else.")
time.sleep(4)
myscript()
break
else:
Coins = Coins - 10
Fuel = Fuel + 15
print ("Thank you for purchasing the fuel! You have",Fuel,"fuel remaining and",Coins,"coins remaining.")
elif choose == "shotgun":
while Coins < shotgun:
print ("You cannot buy this as you do not have enough money. Please type in something else.")
time.sleep(4)
minescript()
break
else:
Coins = Coins - 40
print ("Thank you for purchasing the shotgun! You have",Coins,"coins remaining")
elif choose == "oxygen":
while Coins < costoxygen:
print ("You cannot buy this as you do not have enough money. Please type in something else.")
time.sleep(4)
minescript()
break
else:
Coins = Coins - 10
Oxygen = Oxygen + 10
print ("Thank you for purchasing the oxygen! You have",Coins,"coins remaining and",Oxygen,"oxygen remaining.")
else:
print ("Hope you find something to buy next time :)")
minescript()
else:
Energy = Energy - 10
print("Very well Sir. You have",Energy,"energy remaining now.")
time.sleep(4)
print("Now you will see a map of where you are and how close you are to the alien palace.")
time.sleep(2)
print("Please wait...")
time.sleep(2)
print("Please wait...")
time.sleep(2)
print("Please wait...")
time.sleep(8)
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("ZZZZZZZZZZZZZZZZZZZZZ00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("ZZZZZZZZZZZZZZZZZZZZZ00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print(" ZZ00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print(" ZZ00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print(" ZZ00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print(" ZZ00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print(" ZZ00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print(" ZZ000000000000000000MMMM000000000000000000000000PPPPPPPPPP0000000000000000000000000000000000000000000000-00000000-0000000000000000000")
print(" ZZ000000000000000000MMMM000000000000000000000000P P000000000000000000000000000000000000000000000- -000000- -000000000000000000")
print(" ZZ000000000000000000MMMM00000000MMM0000000000000P PLANET P00000000000000000000000000000000000000000000- -0000- -00000000000000000")
print(" EARTH ZZ0000000000000000000---------00MMM0000000000000P P000000000000000000000000000000000*0000000000- -000- -00000 ** ** 0")
print("(where you started)ZZ--------------------000MMM0--------------00000PPPPPPPPPP0000000000000000000000000000000*****00000000- a -000- -00000 .. .. 0")
print(" ZZ00000000000000000000000MMM00000000000000-0000000000000000000000000IIIII0000000000000000*****00000000- l -000- -00000 oo 0")
print(" ZZ000000000000000000000000000000MMM0000000--------------------------I U I00000000000000000000000000000- i -000- -00000 0")
print(" ZZ000000000000000000000MMMMM0000000000000000000000000000000000000000IIIII00000000000000000000000000000- e -000- -00000 (_______) 0")
print(" ZZ000000000000000000000MMMMM00000000000000000000000000000000000000000000000000000000000000000000000000- n -000- -00000 0")
print(" ZZ000000000000000000000MMMMM0000000000000000000000000000000000000000000000000000000000000000000*000000- -000- p -00000000000000000")
print(" ZZ0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*****0000- -000- a -00000000000000000")
print(" ZZ00000000000000000000000000000000000PPPPPPPPPP0000000000000000000000000000000000000000000000*****0000- -000- l -00000000000000000")
print("ZZZZZZZZZZZZZZZZZZZZZ00000000000000000000000000000000000P P0000000000000000000000000000000000000000000000000000000- -000- a -00000000000000000")
print("ZZZZZZZZZZZZZZZZZZZZZ00000000000000000000000000000000000P PLANET P0000000000000000000000000000000000000000000000000000000- -000- c -00000000000000000")
print("00000000000000000000000000000000000000000000000000000000P P0000000000000000000000000000000000000000000000000000000- -000- e -00000000000000000")
print("00000000000000000000000000000000000000000000000000000000P P00000000000000000000000000000000000000000000000000000000- -00000- -000000000000000000")
print("00000000000000000000000000000000000000000000000000000000PPPPPPPPPP000000000000000000000000000000000000000000000000000000000--0000000-0000000000000000000")
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
print("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
time.sleep(5)
print("MMM = asteroids")
time.sleep(1.5)
print("U = where you are")
time.sleep(1.5)
print("---- = path")
time.sleep(1.5)
print("***** = alien security/alien guards ")
time.sleep(6)
print("Please ensure that you have reviewed the map - thank you.")
print("Commander, you have progressed extremely well and will be well remembered in history. For your progress you have been awarded 100 extra coins! Please use it wisely if you get a chance. Remember you have",Life,"lives and the alien king has",AlienLife,"lives!")
global Coins
Coins = Coins + 100
print("You now have",Coins,"coins.")
p = input("You have " + str(Energy) + " energy left commander, would you like to go to sleep? ")
if p == "yes":
print("Hope you have a great sleep THIS time :)")
Energy = Energy + 2
else:
print("Very well.")
Energy = Energy - 5
if Energy == 0:
print("You have run out of energy master! You must retreat now!")
time.sleep(1)
print ("Your mission is over. You have travelled back to Earth on autopilot. You were too tired to carry on.")
time.sleep(2)
print ("The game will now restart.")
time.sleep(4)
script()
else:
Fuel = Fuel - 5
print("You have",Energy,"energy and",Fuel,"fuel left.")
print("You are doing very well. Soon you will have to battle the alien guards so be prepared to loose some lives :). No pressure.")
time.sleep(3)
print("After an hour...")
time.sleep(3)
Fuel = Fuel - 5
if Energy == 0:
print("You have run out of energy master! You must retreat now!")
time.sleep(1)
print ("Your mission is over. You have travelled back to Earth on autopilot. You were too tired to carry on.")
time.sleep(2)
print ("The game will now restart.")
time.sleep(4)
script()
else:
print("Sir! The ship has broken down. You have to go outside to fix it. As a consequence you will loose quite a bit of oxygen. You have",Oxygen,"oxygen left and",Energy,"energy left. Please make a choice between the following:")
time.sleep(2)
print("Repair fully - result in 10 oxygen loss and 10 energy loss.")
time.sleep(2)
print("Repair half - result in 5 oxygen loss and 5 energy loss. Then you will be able to finish it off the next day after sleeping.")
time.sleep(2)
print("Do not repair now - result in no loss of energy and oxygen but you will not be able to finish the repair the next day either.")
def jscript():
global Coins
global Oxygen
global Fuel
repair = input("Please type in your choice. E.g. full or half or not now. ")
if repair == "full":
while Energy < 10:
print("You cannot carry out this option, sorry.")
time.sleep(3)
jscript()
break
else:
Oxygen = Oxygen - 10
Energy = Energy - 10
print("The repair has been successful. You now have",Fuel,"fuel",Oxygen,"oxygen and",Coins,"remaining!")
elif repair == "half":
while Energy < 5:
print("You cannot carry out this option, sorry.")
time.sleep(3)
jscript()
break
else:
Oxygen = Oxygen - 5
Energy = Energy - 5
print("The half repair has been successful. You now have",Fuel,"fuel",Oxygen,"oxygen and",Coins,"remaining!")
time.sleep(2)
print("Commander hopefully this will not seem too aggressive to you, but I think you HAVE to sleep now. The beds are ready so take a rest...")
Energy = Energy + 6
time.sleep(3)
print("The next day...")
time.sleep(3)
print("Congarats! The rest of the spaceship has been repaired successfully without any loss! ;)")
else:
print("There will be no repair done.")
time.sleep(2.5)
print("The next day...")
time.sleep(3.5)
foo = ['a'] * 65 + ['b'] * 35
an = random.choice(foo)
if an == "a":
print("hi")
else:
print("SHing CHing")
script()