Hi. I've never used these forums, but I couldn't find an answer to my question in other places. I've been using the codecademy python track, and have been making my own little game. I made a function, prologue, and that works fine. I made another one, ActionChoice, that worked, but once I added a few things to the function, it says it's not defined. Please help, I can't figure out what the problem is.

def prologue(): print "Welcome to A Tale of Kings, a sequel to A Tale of Things. This game is not like AToT, because you are not just choosing little tiny paths. Your choices carry on, and you deal with money, foreign relations, and other troubles." Name = raw_input("What did you say your name was?") print "Ah right. You are the good Sir " + Name + ", One of the members of a great council for a king. This king, who rules the small kingdom of Tarnor, is currently facing a dilemma. It appears that a larger kingdom by the name of Engon has taken a fancy to your Amethyst deposits. They have attacked!" poop = raw_input("How much money do you think you have?") print "You have a small amount of money to work with, 500 Amethyst Royals. 'Tis a pity that the Amethyst Royals are so easy to come by, they are worth practically nothing. You will have to be clever with your useage of these funds." print print "You also have a good sturdy wall made out of cardstock. It currently has 250 layers of cardstock, and you hope it will last. Unfortunately, every action that you do, the enemy attacks your wall for 25 damage. Work fast!" print print "You think that you might be able to survive this war if only you could get the assistance of one neighboring kingdom, Farlon. The problem is, the king of that nation has set a price, 25 Golden Dragons for his help (Equivalent to 1500 Amethyst Royals). You will have to see if you can raise the funds....)" Start()prologue()

But you are calling the Start() function before it's defined.You are also trying to modify global variables from your function, which won't work without using the global statement.I would recommend not using globals at all, but defining them inside the function instead, or passing them as arguments to your function.

I'd say you're trying to make the game much too complicated for where your knowledge of the language currently is.Learning about classes will make creating this kind of a game much simpler.

Oh, thank you. I still don't really understand why one function works but the other doesn't, but I'll learn more about classes. I was kinda just following what I saw other people do, I've never made a game that complicated. Mostly simple choose your own adventures.

Ok, so I moved the Start function above the prologue. This made the Wall_Health variable not work, so I made a global statement. Then it randomly thinks I'm trying to add a string and an integer? I don't know what the matter could possibly be here, the variable is a number.

def Start(): Action = raw_input("What would you like to do? Make sure to type in all caps. BUILD WALL, COLLECT TAXES, SHOP?") if Action == 'BUILD WALL': if Wall_Rate == 25: print "You build up the wall 25 layers, but the enemy also attacks it for 25 damage. You might want to buy some building tools in the shop." Start() else: global Wall_Health

Wall_Health= Wall_Health - 25 print "Welcome to the shop!" print "We have many choices for you. Which menu would you like to see? Building tools? Tax Collectors? Or Weapons?"

def prologue(): Wall_Health = 250 print "Welcome to A Tale of Kings, a sequel to A Tale of Things. This game is not like AToT, because you are not just choosing little tiny paths. Your choices carry on, and you deal with money, foreign relations, and other troubles." Name = raw_input("What did you say your name was?") print "Ah right. You are the good Sir " + Name + ", One of the members of a great council for a king. This king, who rules the small kingdom of Tarnor, is currently facing a dilemma. It appears that a larger kingdom by the name of Engon has taken a fancy to your Amethyst deposits. They have attacked!" poop = raw_input("How much money do you think you have?") print "You have a small amount of money to work with, 500 Amethyst Royals. 'Tis a pity that the Amethyst Royals are so easy to come by, they are worth practically nothing. You will have to be clever with your useage of these funds." print print "You also have a good sturdy wall made out of cardstock. It currently has 250 layers of cardstock, and you hope it will last. Unfortunately, every action that you do, the enemy attacks your wall for 25 damage. Work fast!" print print "You think that you might be able to survive this war if only you could get the assistance of one neighboring kingdom, Farlon. The problem is, the king of that nation has set a price, 25 Golden Dragons for his help (Equivalent to 1500 Amethyst Royals). You will have to see if you can raise the funds....)" Start()prologue()

def prologue(gamedata): print "Welcome to A Tale of Kings, a sequel to A Tale of Things. This game is not like AToT, because you are not just choosing little tiny paths. Your choices carry on, and you deal with money, foreign relations, and other troubles." Name = raw_input("What did you say your name was?: ") print "Ah right. You are the good Sir " + Name + ", One of the members of a great council for a king. This king, who rules the small kingdom of Tarnor, is currently facing a dilemma. It appears that a larger kingdom by the name of Engon has taken a fancy to your Amethyst deposits. They have attacked!" poop = raw_input("How much money do you think you have?: ") print "You have a small amount of money to work with, 500 Amethyst Royals. 'Tis a pity that the Amethyst Royals are so easy to come by, they are worth practically nothing. You will have to be clever with your useage of these funds." print print "You also have a good sturdy wall made out of cardstock. It currently has 250 layers of cardstock, and you hope it will last. Unfortunately, every action that you do, the enemy attacks your wall for 25 damage. Work fast!" print print "You think that you might be able to survive this war if only you could get the assistance of one neighboring kingdom, Farlon. The problem is, the king of that nation has set a price, 25 Golden Dragons for his help (Equivalent to 1500 Amethyst Royals). You will have to see if you can raise the funds....)" Start(gamedata)