edit: Jesus christ I might actually be the most stupid person alive. The "prompt()" was not indented in the right way, and I fixed the problem. I actually took like 30 mins of my time to write this. I will leave this for you to read anyway.
Jesus christ man, thank you so much for helping me, I'm going to stick with the 2nd example for now (but keep the others in mid)as I don't want it to become too complicated.
I know I'm really pushing myself as a complete newbie to python, actually to coding in general. I've learned so much the first week of coding and I promest, one day, I'm going to become an indie game developer, and publish games on Steam or Gog or something like that (I'm only 18 so I pretty much got my whole life ahed of me (except the 1/5 I've already wasted)), and you are the person that helped me, when completely new to coding and really had no clue what code.
With that out of the way, I have another problem, yeyeye I know, your pretty much my "free" teacher, I don't even understand why you spend your time to help people on this forum. Am I drunk? Not that much actually.
Anyway, I'm coding my "main_game_loop"
I'm done with the intro ("Whats your name" and "class"). HOWEVER, after the intro is done, the last code ("prompt()") doesn't activate. Instead the loop, keeps looping as if "prompt()" is not in the "main_game_loop"
tl;dr
What I want Python to do is excecute "prompt()", which should print "What would you like to do? (and the rest of prompt aswell). However as stated before, Python acts if "prompt()" is outside the loop for some reason.
This is what my "main_game_loop" looks like at the moment:
Jesus christ man, thank you so much for helping me, I'm going to stick with the 2nd example for now (but keep the others in mid)as I don't want it to become too complicated.
I know I'm really pushing myself as a complete newbie to python, actually to coding in general. I've learned so much the first week of coding and I promest, one day, I'm going to become an indie game developer, and publish games on Steam or Gog or something like that (I'm only 18 so I pretty much got my whole life ahed of me (except the 1/5 I've already wasted)), and you are the person that helped me, when completely new to coding and really had no clue what code.
With that out of the way, I have another problem, yeyeye I know, your pretty much my "free" teacher, I don't even understand why you spend your time to help people on this forum. Am I drunk? Not that much actually.
Anyway, I'm coding my "main_game_loop"
I'm done with the intro ("Whats your name" and "class"). HOWEVER, after the intro is done, the last code ("prompt()") doesn't activate. Instead the loop, keeps looping as if "prompt()" is not in the "main_game_loop"
tl;dr
What I want Python to do is excecute "prompt()", which should print "What would you like to do? (and the rest of prompt aswell). However as stated before, Python acts if "prompt()" is outside the loop for some reason.
This is what my "main_game_loop" looks like at the moment:
def prompt(): print('What would you like to do?') action = input('>') acceptable_actions = ['move', 'go', 'travel', 'walk', 'quit', 'examine', 'inspect', 'interact', 'look',] while action.lower() not in acceptable_actions: print('Unknown command, try another.\n') action = input('>') if action.lower() == 'quit': sys.exit() elif action.lower() in ['move', 'go', 'travel', 'walk']: player_move(action.lower()) elif action.lower() in ['examine', 'inspect', 'interact', 'look']: player_examine(action.lower()) def main_game_loop(): while myPlayer.game_over is False: ##### INTRO ##### question1 = "Hello there, what's your name?\n" for character in question1: sys.stdout.write(character) sys.stdout.flush() time.sleep(0.01) player_name = input('>') myPlayer.name = player_name os.system('cls') # Clear question2 = player_name + " huh...\nYes... I recognize that name but I do not remember where from...\n" for character in question2: sys.stdout.write(character) sys.stdout.flush() time.sleep(0.01) ### Job Handling question3 = "Well then, tell me...\nAre you a mighty Warrior or a wize Wizard?\n" for character in question3: sys.stdout.write(character) sys.stdout.flush() time.sleep(0.01) player_job = input('> ') if player_job.lower() in valid_jobs: myPlayer.job = player_job else: while player_job.lower not in valid_jobs: os.system('cls') # Fix stuck in loop print('Say again, I did not understand.') # Fix print flush and time https://stackoverflow.com/questions/9246076/how-to-print-one-character-at-a-time-on-one-line print('What are you? a Warrior or a Wizard?') print('##### This part is bugged, restart game #####') player_job = input('> ') if player_job.lower() in valid_jobs: myPlayer.job = player_job os.system('cls') #Clear question4 = player_name + " the mighty " + player_job + " huh...\n" #yes or no for character in question4: sys.stdout.write(character) sys.stdout.flush() time.sleep(0.01) speach1 = "Yes, I do not know why I have your name in my mind...\n" for character in speach1: sys.stdout.write(character) sys.stdout.flush() time.sleep(0.01) speach2 = "But that is not important right now...\n" for character in speach2: sys.stdout.write(character) sys.stdout.flush() time.sleep(0.01) os.system('cls') #Clear speach3 = player_name + ', \n' for character in speach3: sys.stdout.write(character) sys.stdout.flush() time.sleep(0.01) speach4 = "tell me... are you wize enough to escape this illusion of mine?\n" # #tell me, are you STRONG/WIZE (depening on warr or wiz) for character in speach4: sys.stdout.write(character) sys.stdout.flush() time.sleep(0.01) input('>') os.system('cls') print("In the blink of an eye, you appear in a place you have never been, as if you were pulled into another dimension.\n") prompt() #### Launch Game #### os.system('cls') title_screen() # Tiles_screen() - 'play - main_game_loop -