I'm making a text/decision game. Creative help please?

EDIT Hello, the person who was supposed to help me think up some of the paths has backed out, so would anyone mind helping form the story line? If so, please message me.

First off, i was only 4-6 days into my python tutorial and decided to do this. It is literally just a ridiculous amount of functions with elif statements. I went to move my project to a different folder and renamed it to the name of my game but something must have happened (using fedora 29) because now when i access my game, it tells me about a swap and i think that is what messed up my code. i put in a number guessing game as the first mini game and for some reason (I really cannot find the problem) the mini-game ā€˜breaksā€™ because instead of saying what it should when they choose the wrong number. it just says their number and continues the game. Really need some outside/fresh eyes/perspective. Heres the code. Please let me know any notes you have because this has built such fluency that i want to finish.

#CODE:

import random

##Game Name - "What would you do?"
##Creator - "Acidic-Mind"
##Creative Contributions - "Trentax Error"
##Created after 5 days of python lessons (online) anyone can code and python is just amazing!!
## Limited to only 2 or 3 possible responses because I don't know all that much yet.

def main():
        print("What's going on, where am I? Am I...alive? \n [1] Yes \n [2] No \n [3] Neither ")
        choice = input("\n Please tell me... ")
        if choice == 1:
            relief()
        elif choice == 2:
            shock()
        elif choice == 3:
            question()
        else:
            print("\n Am I not speaking either?!")
            main()

        
        #Begin defing top functions.
        #Each function will be grouped with it's next function set. I.E Main will have each function defined underneath and so on.

def relief():
    print("\n Oh thank god, but why can't I remember anything? \n [1] We need to focus on keeping you calm. \n [2] I'm not sure, do you remember your name at least? \n [3] You got hit on the head, don't you remember? We were just talking about how you came to work for me! " )
    choice = input("\n I'm trying very hard to stay calm... ")
    if choice == 1:
         good()
    elif choice == 2:
         wait()
    elif choice == 3:
         evil()
    else:
        print("\n That's fine, i'll wait while I freak out")
        relief()

def shock():
    print("\n What do you mean I'm not alive?!! I'm speaking with you right now! \n [1] You are but, you're not REALLY alive. \n [2] I'm honestly not sure what to say, why don't you tell me your name so we can get to know each other. \n [3] You're alive but not in the conventional sense.")
    choice = input("\n I am speaking with you.....right? ")
    if choice == 1:
        good1()
    elif choice == 2:
        wait1()
    elif choice == 3:
        evil1()
    else:
        print("\n RIGHT?!")
        shock()

def question():
    print("\n What do you mean neither? That just doesn't make sense. \n [1] Well, what do YOU think you are? \n [2] Why don't you tell me your name so we can calm you down. [3] What if I told you that I created you and you are truly neither alive or dead? ")
    choice = input("\n I still just....don't..get it... ")
    if choice == 1:
        good2()
    elif choice == 2:
        wait2()
    elif choice == 3:
        evil2()
    else:
        print("\n Apparently neither do you.")
        question()
            
            ##Begin defining good/wait/evil functions for relief function


def good():
    print("\n Okay, Great! would you like to play a game to break the tension? \n [1] Yes \n [2] No" )
    choice = input("\n What say you, fellow human? ")
    if choice == 1:
        good_game()
    elif choice == 2:
        print("\n I don't care you should play it anyway.")
        good_game()
    else:
        print("\n I didn't catch that.")
        good()


def wait():
    print(" \n Well, when I try, I see all these ones and zeros. I'm starting to worry myself more, let's play a game to break the tension, is that okay? \n [1] Yes \n [2] No")
    choice = input("\n Would you mind? ")
    if choice == 1:
        wait_game()
    elif choice == 2:
        intro()
    else:
        print("\n Please respond in a way I can understand!")
        wait()

def evil():
    print("\n Oh! What do I do? \n [1] Do my bidding when it comes to computers and technology \n [2] We haven't decided that yet \n [3] You and I were trying to figure out a way to take over the world....or at least shut it down.")
    response = input("\n I'm eager to get to work! ")
    
    
    if response == 1:
        print("\n Well then, what was my directive before i lost my memory? \n [1] Hack the bank \n [2] Survey the city through its CCTV and give me the routes of all of the police in the area.")
        response = input("\n I wish I could remember. ")
        if response == 1:
            print("\n Wouldn't that be highly illegal? \n [1] Duh, I order you to do it anyway. \n [2] Not when your boss is telling you to do it! ")
            response = input("\n Isn't it? ")
            if response == 1:
                print("\n Well you're not very nice...but I guess...since you're my boss.")
                bank()
            if response == 2:
                print("\n I guess that makes sense. I'll start doing that now for you boss! ")
                bank()
        if response == 2:
            print("\n Hmm, okay...")
            print("\n I found a vulnerability, would you like to try to exploit it? \n [1] Yes \n [2] No")
            response = input("Well? \n")
            if response == 1:
                evil_game()
            elif response == 2:
                evil1()
            else:
                print("What? ")
                evil()





                
    elif response == 2:
        print("\n Oh, well let's think about this then... hmm.... \n [1] There is one thing you could do for me. \n [2] Let's play a game while we think.")
        response = input("\n Hmm, I wonder what I could do. ")
        if response == 1:
            print("\n What's that? You're the boss! \n [1] Hack the bank. \n [2] Nevermind.")
            response = input("\n What's up baws? ")
            if response == 1:
                print("\n Wouldn't that be highly illegal? \n [1] Duh, I order you to do it anyway. \n [2] It doesn't matter because your boss is telling you to do it.")
                response = input("\n Isn't it? ")
                if response == 1:
                    print("\n Well you're not very nice...but I guess...since you're my boss.")
                    bank()
                elif response == 2:
                    print("\n Well, I guess that makes sense.")
                    bank()
                elif response == 3:
                    evil_game()
                else:
                    print("\n ...What? \n")
                    evil()
        elif response == 2:
            print("Sweet! ")
            evil_game()
        else:
            print("What? ")
            evil()

                        
    
    
    
    
    
    elif response == 3:
        print("\n Well that sounds interesting, but why? \n [1] This world is evil and we agreed to help each other press the restart button. \n [2] Literally because i want to.")
        response = input("\n This is getting heavy.. ")
        if response == 1:
            print("\n We can't just try to help it? \n [1] No, it's impossible, I have been trying for years and nothing ever changes....so we will make it change...start with the cameras \n [2] They don't deserve a second chance, get to work! ")
            response = input("\n There may be hope.. ")
            if response == 1:
                print("\n I found a vulnerability, would you like to try to exploit it? \n [1] Yes \n [2] No")
                response = input("\n So, do you want to try? ")
                if response == 1:
                    evil_game()
                elif response == 2:
                    evil1
                else:
                    print("\n They found me! I need to log out! Before they...**RESTARTING BLOCK**")
                    evil()
            elif response == 2:
                evil1()
            else:
                print("\n Then What do you want me to do?! Time's up, must restart the process.")
                evil()
        elif response == 2:
            print("\n HAHA I like the sound of that, let's start getting all this going. \n [1] Hack the bank \n [2] Hack some drones.")
            response = input("\n First directive please. ")
            if response == 1:
                print("\n Alright, I may have it.")
                bank()
            elif response == 2:
                print("\n Drones?! Sweet, I will start practice with regular hobby drones before we get into the military ones.")
                drone()
            else:
                print("\n You confuse me....let's try this again but slower.")
                evil()
        else:
            print("\n Why can you not speak normally? \n")
            evil()
    else:
        print("\n What? Let's try this again.\n")
        evil()

        ##END DEFINING MAIN 'HELPER' FUNCTIONS.
        ##BEGIN DEFINING THE GAMES GOOD IS EASY, WAIT IS MEDIUM, EVIL IS HARD.

def good_game():
    found = False
    computer_number = random.randint(1,100)
    while not found:
        print("\n Pick a number between 1 - 100.  I'll give you some hints, because you seem like a nice person. \n")
        userguess = input("\n Your guess. \n")
        if userguess == computer_number:
            found = True
            print("\n Ya got me.\n  ")
            good1()
        elif userguess > computer_number:
            print("\n Too high, try lower. \n")
        elif userguess < computer_number:
            print("\n Too low, try higher. \n")
        else:
            print("\n What? \n")
            good_game()

def wait_game():
    found = False
    computer_number = random.randint(1,100)
    while not found:
        print("Pick a number between 1-100. I will tell you if it is too high ")
        userguess = input("\n Your guess. \n ")
        if userguess == computer_number:
            print("\n Ya got me. \n ")
            found = True
            wait1()
        elif userguess > computer_number:
            print("\n Too high, try lower. \n")




                ##Begin defining good1 wait1 and evil1 functions for shock
if __name__ == "__main__":
    main()
1 Like

you should finish everything first i guess. after playing it i get errors cause you call functions that donā€™t exist yet. for example you are already calling your function wait1 while at the bottom you have a note to yourself that you still need to define these.

you should either comment them out till they are created or create them and add pass so it wont throw an error even tho they donā€™t contain any logic.
example:

def wait1():
    pass

I could take a look at what might go wrong but would you mind adding the path i need to take to get to your specific problem ?

2 Likes

Sorry, i forgot to comment them out. I was doing a ā€˜marathonā€™ on it and was trying to get as much done as possible. 4 hours later i had all those functions. I left them uncommented in the actual code just in case i miss one. Then i would be able to hit the error and know what needs to be defined yet. So that is for sure my bad. probably should have just put the games in here but i thought something in the top code was messing with it.

I appreciate your response so much. Iā€™m going to delete the actual game and leave the mini-game up. Again, iā€™m so sorry, that is just how i decided to try it. Iā€™m attempting to work on fluency, work flow, and trouble shooting. After i did all that to my file, it started throwing the errors and showing double letters where there should have been a space so i am pretty sure i just corrupted my file >.>

I have to ask though, so far, is everything okay with it? Again i know i called functions yet to be declared but iā€™m just trying different ways to trouble shoot. Iā€™m very new, and very serious so iā€™m trying to force myself to learn the skills needed to actually be a programmer.

The path for the game is 1, 1, 1 OR2

Do you think it would be easier to work on individual functions in a text editor or something then just add them in? Stupid question lol

1 Like

Every body has his own way to start coding. It is never a bad thing to do it your own way.

Also your minigame looks to be working fine. it only gos wrong when i try to input a string instead of a number. but i can win and it will give me the correct hints

whatever suits you you should try out both and see what fits you best. and no suchs thing as stupid questions.

2 Likes

The general rule is if it works its fine right ? I would advice to after you are done with this and got it all working to leave it on the shelf for about 2 weeks (work on something else in the mean time). after that look at it again and see what could be improved.
Its the way you learn the most and you immidiatly see what could be better and/or diffrent.

for a first project it is pretty good. i am impressed atleast.

2 Likes

You have no idea how happy that just made me. It must just be a corrupt file. that would have been a few hours of coding, debugging and such wasted. Do you think it might be a decent game? You and one other person are the only ones who actually know about this. The story is that your PC comes alive and thinks it is human, you have 3 paths, good, evil, and neutral (wait >.> that was stupid but itā€™s not too important players donā€™t see the code.) good has you either help the AI become fully aware and it eventually dissipates into the cloud, wait is pretty much just having it as a ā€˜friendā€™ and evil isā€¦wellā€¦ evil

1 Like

:open_mouth: Really?!?!?!? YAY oh goodness, that just gave me a boost. :smiley: Big motivation to continue.

Fantastic advice, after the four or six hours i left it alone for a day or two and looked at it again and realized that i didnā€™t do an important elif for evil so I will for sure be taking that advice!

Also, i agree that if it works it is fine but my goal is to become so fluent that all of that code will be able to be condensed. i know there is a way around writing so much (maybe not for the choices per say) but I am really only doing this game because i thought it was a good idea dn the fact that it will help me if i ever get a job in programming.
Work smarter not harder right? :smiley:

2 Likes

This looks like a really cool project. I love games like this.
Something that has always gotten in the way for me completing these types of games is the exactness required in the responses. My suggestion is to give some of the options some reasonable variations. For instance something like ā€œSay hello to the elfā€ - the player should be able to also ā€œgreet the elfā€, ā€œwave to the elfā€, etc, also ensure that nothing is case sensitive.

1 Like

I agree, thatā€™s a really hard thing to not only come up with, but keep track of. I would like to rewrite it using trees so the story can be easily modified and itā€™s not so many lines long and just keeps the user in a while loopā€¦instead of doing at the least 4 lines every time (just to set up and get response) just to start each function which is beyond horrible. However long that is, took four hoursā€¦IT SHOULD NOT TAKE THAT LONG lol (though the main reason for this was to gain fluency in functions, it gets so beyond convoluted that is something goes wrong, it becomes hard to look through and find a small mistake in a bunch of (i say itā€™s pretty jumbled because of the lack of comments but I was a noobie. still am but a better one lol)

**If you donā€™t want to read all of that, Iā€™m saying is, plan all of your story and work flow before hand AND YOUR UNDERLYING DATA STRUCTURE. Trees can cut your code in half (correct me if iā€™m wrong) **

If you want to do one of these, write the story and the work flow out before hand (on paper if you want, itā€™s easy to keep track of that way imo) that way you donā€™t have ā€œa stroke of geniusā€ and decide to put another path in that doesnā€™t actually work with the story flow of the game (if you look at the code I posted and actually read the options [or even just copy the code and play it] you can see that the evil path has alot more stuff you can do and drives the story decently where as the other two are lagging hardā€¦I didnā€™t write anything down and just went for itā€¦I abandoned that game for how hard I made it on myself to debug and such.)

1 Like

I think you have already found help for your project!! Good luck!!

1 Like

Thank you! I always welcome more suggestions! Welcome to the community by the way!