2016-05-04 7 views
1

Ich bin relativ neu in Python und während im Prozess der Schaffung eines grundlegenden Python RPG Wordquest-Spiel. Ich bekomme immer eine ungültige Syntax auf def showInstructions():.Ungültige Syntax in Python für RPG-Spiel

rooms = { 
     1 : { "name" : "Hall" }, 
     2 : { "name" : "Bedroom" }, 
     3 : { "name" : "Kitchen" }, 
     4 : { "name" : "Bathroom" } 

def showInstructions(): 
    #The Main Menu 
    print ("Mr Bailey's Nightmare!") 
    print ("======================") 
    print ("Commands:") 
    print ("go [direction]'") 

def showStatus 
    #shows player stats, essentially current room 
    print ("---------------------------------------------------------") 
    print ("You are in the " + rooms[currentRoom]["name"] 
    print ("---------------------------------------------------------") 

Antwort

3

Sie müssen rooms dict schließen:

rooms = { 
    1 : { "name" : "Hall" }, 
    2 : { "name" : "Bedroom" }, 
    3 : { "name" : "Kitchen" }, 
    4 : { "name" : "Bathroom" } 

Bedürfnisse

} 

so

rooms = { 
    1 : { "name" : "Hall" }, 
    2 : { "name" : "Bedroom" }, 
    3 : { "name" : "Kitchen" }, 
    4 : { "name" : "Bathroom" } 
} 

auch Ihre Syntax bei showStatus vermasselt wird

def showStatus(currentRoom): # is this the right argument? 
    #shows player stats, essentially current room 
    print ("---------------------------------------------------------") 
    print ("You are in the " + rooms[currentRoom]["name"]) 
    print ("---------------------------------------------------------")