I’m currently in school for programming and my first class is about Python, after learning the basics of variables and the print function, I decided to try my hand at making a text based game on my own time and I’m having trouble getting a loop working where I have it give a “Invalid input” message and offers the player to enter their choice again. I hope that’s specific enough. Any help would be appreciated. Thanks all!
# This program was made by Big Jake # Name Character gamename = "Firewall" print (f"Hello. Welcome to {gamename}.") print("IMPORTANT NOTICE: THIS GAME IS CASE SENSITIVE") print ("This is a text based adventure game set in Phoenix, Arizona in the year 2100.") name = input("Name your character:n> ") print(f'Greetings {name}! Welcome to Phoenix.') print("Select a background:") print("(Your background decides where your adventure begins.)") background = input("Corpo | Rebeln> ") # Rebel Path if background == "Rebel": print("You grew up on the streets of the city, and you've just been accepted into El Dolor, the local cartel arm.") print("You wake up at 11am to a text from Tomás, your boss. He says he needs you to do a pickup.") print("What do you do?") # Corpo Path elif background == "Corpo": print("Your life consists of slaving away as a Corporate Spy for Radico, a hardware manufacturing Megacorporation.") print("While scrolling your phone on your break, Jett, a fellow spy who works under another supervisor, starts asking you about your weekend.") print("What do you do?") #Coworker Choice coworkerchoice = input("Share | Ignore | Attackn> ") if coworkerchoice == "Share": print("You share the details of your weekend. Jett shares regails a story of hitting up the local brothel during his weekend.") print("Edgar, your boss, walks into the break room and scolds Jett for slacking off. He then asks to see you in his office.") print('His office fills with smoke as he takes deep inhales form his cigar. He looks towards you and says') print(f'"{name}, I need you to do something for me. You're one of our best spies, and only you can do this."') print("He explains that he needs you to steal a corporate secret from Techaland, a local small competitor.") print("This is a routine job, won't pay much, but it may move you higher on the ladder. Who knows what will happen if you say no?") print("What do you do about this job?") corpojobchoice = input("Accept | Declinen> ") if corpojobchoice == "Accept": print('') elif corpojobchoice == "Decline": print('"I see," Edgar says, "Then I'm sorry I have to do this."') print("Edgar reaches into his pocket and points a pistol at you.") print(f'"You see, {name}, no one else except the operative can know about this." Edgar shakes his head.') print('"I really like you, and I don't want to do this. So I ask you once more..."') print('Will you accept this job?"') print("His finger is on the trigger, but he looks hesitant. What do you do?") corpogun = input("Accept | Decline | Attack") elif coworkerchoice == "Ignore": print("You ignore Jett, and continue focusing on your phone. He gets visibly angry and says") print('"Yeah, you always thought you were better than me."') print("Jett walks back to his office as Edgar, your boss, walks into the break room and asks you to meet him in his office.") print('His office fills with smoke as he takes deep inhales form his cigar. He looks towards you and says') print(f'"{name}, I need you to do something for me. You're one of our best spies, and only you can do this."') print("He explains that he needs you to steal a corporate secret from a local small competitor.") print("This is a routine job, won't pay much, but it may move you higher on the ladder. Who knows what will happen if you say no?") print("What do you do about this job?") corpojobchoice = input("Accept | Declinen> ") elif coworkerchoice == "Attack": print("You slowly stand up and crack your knuckles.") print("As you remember all the times Jett talked shit to you, you ready your fist, and lunge at him.") print("As you two begin to fight, Edgar, your boss, comes into the break room and tries to break it up.") print(f'He pulls you away and starts screaming "{name}! Jett! Get the fuck out of here before I call the cops! You're both fired!"') print("Your employment contract limits your future employment options, and your salary is too good to give up. What do you do about Edgar's demand?") firedchoice = input("Comply | Bargain | Attackn> ")
submitted by /u/Actual_Big_Jake
[link] [comments]
r/learnpython I’m currently in school for programming and my first class is about Python, after learning the basics of variables and the print function, I decided to try my hand at making a text based game on my own time and I’m having trouble getting a loop working where I have it give a “Invalid input” message and offers the player to enter their choice again. I hope that’s specific enough. Any help would be appreciated. Thanks all! # This program was made by Big Jake # Name Character gamename = “Firewall” print (f”Hello. Welcome to {gamename}.”) print(“IMPORTANT NOTICE: THIS GAME IS CASE SENSITIVE”) print (“This is a text based adventure game set in Phoenix, Arizona in the year 2100.”) name = input(“Name your character:n> “) print(f’Greetings {name}! Welcome to Phoenix.’) print(“Select a background:”) print(“(Your background decides where your adventure begins.)”) background = input(“Corpo | Rebeln> “) # Rebel Path if background == “Rebel”: print(“You grew up on the streets of the city, and you’ve just been accepted into El Dolor, the local cartel arm.”) print(“You wake up at 11am to a text from Tomás, your boss. He says he needs you to do a pickup.”) print(“What do you do?”) # Corpo Path elif background == “Corpo”: print(“Your life consists of slaving away as a Corporate Spy for Radico, a hardware manufacturing Megacorporation.”) print(“While scrolling your phone on your break, Jett, a fellow spy who works under another supervisor, starts asking you about your weekend.”) print(“What do you do?”) #Coworker Choice coworkerchoice = input(“Share | Ignore | Attackn> “) if coworkerchoice == “Share”: print(“You share the details of your weekend. Jett shares regails a story of hitting up the local brothel during his weekend.”) print(“Edgar, your boss, walks into the break room and scolds Jett for slacking off. He then asks to see you in his office.”) print(‘His office fills with smoke as he takes deep inhales form his cigar. He looks towards you and says’) print(f'”{name}, I need you to do something for me. You’re one of our best spies, and only you can do this.”‘) print(“He explains that he needs you to steal a corporate secret from Techaland, a local small competitor.”) print(“This is a routine job, won’t pay much, but it may move you higher on the ladder. Who knows what will happen if you say no?”) print(“What do you do about this job?”) corpojobchoice = input(“Accept | Declinen> “) if corpojobchoice == “Accept”: print(”) elif corpojobchoice == “Decline”: print(‘”I see,” Edgar says, “Then I’m sorry I have to do this.”‘) print(“Edgar reaches into his pocket and points a pistol at you.”) print(f'”You see, {name}, no one else except the operative can know about this.” Edgar shakes his head.’) print(‘”I really like you, and I don’t want to do this. So I ask you once more…”‘) print(‘Will you accept this job?”‘) print(“His finger is on the trigger, but he looks hesitant. What do you do?”) corpogun = input(“Accept | Decline | Attack”) elif coworkerchoice == “Ignore”: print(“You ignore Jett, and continue focusing on your phone. He gets visibly angry and says”) print(‘”Yeah, you always thought you were better than me.”‘) print(“Jett walks back to his office as Edgar, your boss, walks into the break room and asks you to meet him in his office.”) print(‘His office fills with smoke as he takes deep inhales form his cigar. He looks towards you and says’) print(f'”{name}, I need you to do something for me. You’re one of our best spies, and only you can do this.”‘) print(“He explains that he needs you to steal a corporate secret from a local small competitor.”) print(“This is a routine job, won’t pay much, but it may move you higher on the ladder. Who knows what will happen if you say no?”) print(“What do you do about this job?”) corpojobchoice = input(“Accept | Declinen> “) elif coworkerchoice == “Attack”: print(“You slowly stand up and crack your knuckles.”) print(“As you remember all the times Jett talked shit to you, you ready your fist, and lunge at him.”) print(“As you two begin to fight, Edgar, your boss, comes into the break room and tries to break it up.”) print(f’He pulls you away and starts screaming “{name}! Jett! Get the fuck out of here before I call the cops! You’re both fired!”‘) print(“Your employment contract limits your future employment options, and your salary is too good to give up. What do you do about Edgar’s demand?”) firedchoice = input(“Comply | Bargain | Attackn> “) submitted by /u/Actual_Big_Jake [link] [comments]
I’m currently in school for programming and my first class is about Python, after learning the basics of variables and the print function, I decided to try my hand at making a text based game on my own time and I’m having trouble getting a loop working where I have it give a “Invalid input” message and offers the player to enter their choice again. I hope that’s specific enough. Any help would be appreciated. Thanks all!
# This program was made by Big Jake # Name Character gamename = "Firewall" print (f"Hello. Welcome to {gamename}.") print("IMPORTANT NOTICE: THIS GAME IS CASE SENSITIVE") print ("This is a text based adventure game set in Phoenix, Arizona in the year 2100.") name = input("Name your character:n> ") print(f'Greetings {name}! Welcome to Phoenix.') print("Select a background:") print("(Your background decides where your adventure begins.)") background = input("Corpo | Rebeln> ") # Rebel Path if background == "Rebel": print("You grew up on the streets of the city, and you've just been accepted into El Dolor, the local cartel arm.") print("You wake up at 11am to a text from Tomás, your boss. He says he needs you to do a pickup.") print("What do you do?") # Corpo Path elif background == "Corpo": print("Your life consists of slaving away as a Corporate Spy for Radico, a hardware manufacturing Megacorporation.") print("While scrolling your phone on your break, Jett, a fellow spy who works under another supervisor, starts asking you about your weekend.") print("What do you do?") #Coworker Choice coworkerchoice = input("Share | Ignore | Attackn> ") if coworkerchoice == "Share": print("You share the details of your weekend. Jett shares regails a story of hitting up the local brothel during his weekend.") print("Edgar, your boss, walks into the break room and scolds Jett for slacking off. He then asks to see you in his office.") print('His office fills with smoke as he takes deep inhales form his cigar. He looks towards you and says') print(f'"{name}, I need you to do something for me. You're one of our best spies, and only you can do this."') print("He explains that he needs you to steal a corporate secret from Techaland, a local small competitor.") print("This is a routine job, won't pay much, but it may move you higher on the ladder. Who knows what will happen if you say no?") print("What do you do about this job?") corpojobchoice = input("Accept | Declinen> ") if corpojobchoice == "Accept": print('') elif corpojobchoice == "Decline": print('"I see," Edgar says, "Then I'm sorry I have to do this."') print("Edgar reaches into his pocket and points a pistol at you.") print(f'"You see, {name}, no one else except the operative can know about this." Edgar shakes his head.') print('"I really like you, and I don't want to do this. So I ask you once more..."') print('Will you accept this job?"') print("His finger is on the trigger, but he looks hesitant. What do you do?") corpogun = input("Accept | Decline | Attack") elif coworkerchoice == "Ignore": print("You ignore Jett, and continue focusing on your phone. He gets visibly angry and says") print('"Yeah, you always thought you were better than me."') print("Jett walks back to his office as Edgar, your boss, walks into the break room and asks you to meet him in his office.") print('His office fills with smoke as he takes deep inhales form his cigar. He looks towards you and says') print(f'"{name}, I need you to do something for me. You're one of our best spies, and only you can do this."') print("He explains that he needs you to steal a corporate secret from a local small competitor.") print("This is a routine job, won't pay much, but it may move you higher on the ladder. Who knows what will happen if you say no?") print("What do you do about this job?") corpojobchoice = input("Accept | Declinen> ") elif coworkerchoice == "Attack": print("You slowly stand up and crack your knuckles.") print("As you remember all the times Jett talked shit to you, you ready your fist, and lunge at him.") print("As you two begin to fight, Edgar, your boss, comes into the break room and tries to break it up.") print(f'He pulls you away and starts screaming "{name}! Jett! Get the fuck out of here before I call the cops! You're both fired!"') print("Your employment contract limits your future employment options, and your salary is too good to give up. What do you do about Edgar's demand?") firedchoice = input("Comply | Bargain | Attackn> ")
submitted by /u/Actual_Big_Jake
[link] [comments]