New to Python, new to programming, sort of.. I love to play classic CRPG's, however instead of pulling out the graph paper to map out the dungeons as I play I decided to write a program that essentially allows me the joy of manually mapping out a dungeon, but using a digital map instead. I have no idea what I'm doing and I'm learning as go.
I'm supplying a prompt '(0)>' from which I want to collect user input using:
Am I adding 'Con_sole' '(0)>' to the users input? I think it is, so I am using this line:
To try and find the first letter of the users input which currently is all I need to know, at least for now. However I'm getting an 'string index out of range error' so I must not be looking in the place place, or the input is not a string, because the if statements never run; hence why I added this line. If I try and print 'Con_Command' I get a memory address so, I'm lost.
I'm supplying a prompt '(0)>' from which I want to collect user input using:
1 |
Con_Command = input (Con_Sole) |
1 |
Con_Command = Con_Command[ 5 ] |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#Console Cursor_Position = [ 0 , 0 ] Con_Sole = '(0)> ' Con_Command = '' #Dungeon_Entrances Dungeon_Entrances = [ '...you feel something crawling across your feet.' , '...you get the sense of being watched from somewhere in the darkness just ahead.' , 'You hear a odd scream coming from deeper inside the dungeon' , 'What was that sound? The rattling of bones underfoot me thinks.' , 'Have a coin for the ferryman? You\'re going to be crossing the river styx quite often.' ] print ( " Welcome to the ye old CRPG Dungeon Mapper. If this is your first\n time here you can read the [M]anual" " (\'crpgdm manual\'). You can\n also start a \'new\' map, \'load\' a previously explored area, or\n sit here and " "\'enjoy\' the darkness.\n\n" ) print (random.choice(Dungeon_Entrances)) print ( '\n\n' ) Con_Command = input (Con_Sole) Con_Command = Con_Command[ 5 ] if (Con_Command) = = 'new' : if (Con_Command) = = 'n' : print ( 'new dungeon routine runs here' ) if (Con_Command) = = 'load' : if (Con_Command) = = 'l' : print ( 'load routine runs here' ) if (Con_Command) = = 'enjoy' : if (Con_Command) = = 'darkness' : print ( 'easter egg routine runs here' ) else : print ( 'You\'ll have to be more specific. Type ' Manual ' for help or \'crpgdm manual\' on the console.' ) |