Hi, I am using PyCharm, which is real sweet (ooh, Americano!) but everytime i try to run the code, the start menu "Enter any key then SPACE to play" works, then "Press N to go to the village" doesn't. Why? When I enter n, or in fact, any key, it says "Name not Defined'. Im Confused.

ALSO, Please have a look at my code, and rate the game! It is in Pre-Alpha, and will be for months, but I'm a budding game developer! THX! Oh yea, Here is my code (IDK how to shorten the code so it is in a pretty lil' box.)

threeSpaces()#Starting Sequenceprint("\nPRESS ANY KEY, THEN ENTER TO START YOUR QUEST ")raw_input(">>")print("GAME STARTING")threeSpaces()openSequence()wood=random.randint(10, 50)#T his is the villager stats.#

print("\n You landed in a strange place, in middle of a meadow. To the north you see a valley, and you decide to explore the valley, as you see a village there.\n PRESS N TO GO THERE ")goNorthValley = input('>>')

print("You leave the village, to explore. You see a woods to the east, and a winding field to the further north.")wood = random.randint(10, 50)firstgoChoice = input("/n You then decide to get wood to build a nice house in the meadow, and stay the night in one of the villager's house. PRESS W")print(" Phew! After a solid day's work, you collected", wood, "wood!")print("You dig a hole, bury the wood in the pit, and stay the night in the cabin.")startvillage()print("You are in a deep slumber...")

print("Now you have somewhere to stay. you place a chest in your house, along with a lot of things that is essencial for household uses, and a blacksmith, a gem forge, and a potions master if they ever arrive.")threeSpaces()print("[BUILDER]: AIN'T THIS A FINE THANG, SIR? I'M SURE YOU'LL AGREE, SIR! IN FACT, I'LL GIVE MY EXPOR TO YOU!")rucksack.append("Expor")print("The Expor lets you have an XP bar! Woohoo! Every 3 XP = 1 Level! Unfortunately, you'll need to activate it in future adventures.")print("[BUILDER]: POP TOLD ME THAT IT NEEDS TO BE ACTIVATED AT THE FOUNTAIN OF KE'LL! OH YEA, HERES A MAP!")rucksack.append("Town Map")print("being bored after all the action, you decide to explore. One thing crosses your mind. \n After the attack, you need some defences. And where do you find weapons? The Smith of course! ")

walktime = random.randint(5, 20)

for (i) in range (walktime): time.sleep(1) print('You are walking to the smith...')

print('After you get there, you see a fresh sword on the anvil, along with a wooden staff, which has a red orb on the top.')print('Now, do you pick up the sword, or the staff, as the smith (called Myles) revealed to you it was. If you choose wand, then press W. Otherwise, if you prefer the sword, press S.')weaponChoice = input("Weapon of Choice? >>").lower

print('[MYLES]: GOOD CHOICE! BUT YOU BETTER TAKE THE OTHER ONE AS WELL.')print('you take the other weapon. You now have both weapons. Now for some cool clothes.')print('If you wish to have a magical robe, which boosts magic and XP points, press R followed by ENTER.')print('If you want a nice, strong armour which greatly boosts HP, and slows you down (does not affect gameplay), press K, followed, as usual, by ENTER.')clothesKindChoice = input('Shopping for what? Strength or Stealth? >>').lower

def ShoppingForClothes (): if (clothesKindChoice == 'r'): print('You got a nice flowing silk robe, with complex runes that move about as if they were alive.') elif(clothesKindChoice == 'k'): print('Boom! After a few nights sleep, you finally get the armour. You hang it up by the wall, and you stare gleefully at it.') else: ShoppingForClothes()ShoppingForClothes()print('Whoo! Now, after a massive order of Kyahaiyas (pyjamas) and Kondobanyas (Normal clothes like coats and shirts) and parting with a lot of cash, your clothing is finally fixed.')print('Before bed, you look at your nice new clothes. You put on your Kyahiayas, and the velvety clothes puts you to sleeeeep.')

print('Its a wonderful new day... What are you going to do? If you want to explore the forest to the east, press F. If you want to take a meal rest, press Y.')exChoice1 = input(">>").lower()def exChoiceLoop1(): if (exChoice1 == 'f'): print("You take your stuff, and walk over to the forest. Your tummy rumbles, so you take food from your bag,") elif (exChoice1 == 'y'): print('You settle down at an inn, a crowdy place. You order some hot lamb soup. It norishes you, leaving a very happy costumer.') HP = HP + 2 print('You have', HP,'HP after that soup!' ) print('You head off towards the forest.')

print('You see a sign. It says:')print("BEWARE MONS...R.. TSA'GA FORES...")print('You wanna go into the forest? Y/N').lower()forest1 = int(input('>>'))def enterForestLoop(): if (forest1 == 'y'): print('You went in cautiously, but you are blocked by thick trunks.') elif (forest1 == 'n'): print('You decide to get psyched up, and go another time.') else: enterForestLoop()enterForestLoop()

input() will try to interpret anything you enter as python code. raw_input() gets a string from user.

Also, there is quite a bit of suspiciously indented code.Specifically, a lot of your functions seem to do nothing, but declare a few variables as globals.Make sure you indent everything properly, indentation is important in python.

Nice to see someone of your age getting into programming.

Last edited by stranac on Sun Mar 30, 2014 9:40 pm, edited 1 time in total.
Reason:Felt like we were hijacking the thread, split the rest to General Discussions

input() will try to interpret anything you enter as python code. raw_input() gets a string from user.

Also, there is quite a bit of suspiciously indented code.Specifically, a lot of your functions seem to do nothing, but declare a few variables as globals.Make sure you indent everything properly, indentation is important in python.

Nice to see someone of your age getting into programming.

Eeh... When I try raw_input, my IDE (PyCharm) gives an error. I am using Python 3.3.5

You next goal should be to get rid of any and all global variables.If you are not ready to look into classes then try passing around a dictionary of game state information from function to function.The only things in your global scope should pretty much be functions, classes, and GLOBAL_CONSTANTS.

Also some basic structural issues.This is the structure of essentially any game you have ever played:

Eeh... I dont know how to do classes (it is all very high-end to me!), and that would mean trudging and deleting a lot of old code, so I need some pointers on how to use these global_constant and class thingies.

OK. But main() might be hard soooo Im not sure how. do I pack all my def()s first, and then do main() then pack all my other code in, and call the stuff from the above def()s? So would it look something like this?