diff --git a/xpub-mud/__pycache__/mudserver.cpython-310.pyc b/xpub-mud/__pycache__/mudserver.cpython-310.pyc new file mode 100644 index 0000000..2fffc86 Binary files /dev/null and b/xpub-mud/__pycache__/mudserver.cpython-310.pyc differ diff --git a/xpub-mud/rooms.json b/xpub-mud/rooms.json index 9cafd63..772ffd3 100644 --- a/xpub-mud/rooms.json +++ b/xpub-mud/rooms.json @@ -1,26 +1 @@ -{ - "Studio": { - "name": "Studio", - "description": "You're in a cosy studio. It smells a bit like soup.", - "exits": {"south": "Corridor"} - }, - "Office": { - "name": "Office", - "description": "You're in an office with glass windows to the corridor.", - "exits": {"east": "Corridor", "south": "artificial research station"} - }, - "Corridor": { - "name": "Corridor", - "description": "You're in a short corridor with doors on three sides.", - "exits": {"north": "Studio", "south": "Aquarium", "west": "Office"} - }, - "Aquarium": { - "name": "Aquarium", - "description": "You're in an underwater cavern, somehow you can breathe!", - "exits": {"north": "Corridor"} - }, - "artificial research station": { - "description": "You're in the artificial research station. What happens here?", - "exits": {"north": "Office"} - } -} \ No newline at end of file +{"Studio": {"name": "Studio", "description": "You're in a cosy studio. It smells a bit like soup.", "exits": {"south": "Corridor"}}, "Office": {"name": "Office", "description": "You're in an office with glass windows to the corridor.", "exits": {"east": "Corridor", "south": "artificial research station"}}, "Corridor": {"name": "Corridor", "description": "You're in a short corridor with doors on three sides.", "exits": {"north": "Studio", "south": "Aquarium", "west": "Office", "east": "tunnel"}}, "Aquarium": {"name": "Aquarium", "description": "You're in an underwater cavern, somehow you can breathe!", "exits": {"north": "Corridor"}}, "artificial research station": {"description": "You're in the artificial research station. What happens here?", "exits": {"north": "Office"}}, "tunnel": {"description": "this is a secret tunnel", "exits": {"east": "Corridor"}}} \ No newline at end of file diff --git a/xpub-mud/xpub_mud.py b/xpub-mud/xpub_mud.py index 9b68e84..0426131 100644 --- a/xpub-mud/xpub_mud.py +++ b/xpub-mud/xpub_mud.py @@ -224,7 +224,7 @@ Hi there! This is the multiplayer, text-based version of the Experimental Publis mud.send_message(id, "You dropped it") # make command - elif command == "made": + elif command == "make": mud.send_message(id, "You made a ") # 'create' command @@ -294,6 +294,9 @@ Hi there! This is the multiplayer, text-based version of the Experimental Publis # invite the player to write a description for the room mud.send_message(id, "The room is not described yet. When you are in the room, you can use 'describe' to add a description. For example: 'describe This is the XML! It smells a bit muffy here.'") + with open("rooms.json", "w") as jsonFile: + json.dump(rooms, jsonFile) + # warn the player when the "create" command is not used in the right way else: mud.send_message(id, f"Sorry you cannot create a new room in that way. Try: 'create direction roomname'") @@ -309,7 +312,10 @@ Hi there! This is the multiplayer, text-based version of the Experimental Publis current_room_name = players[id]["room"] print("[INSPECT] current room: ", current_room_name) - rooms[new_room]["description"] = description + rooms[new_room]["description"] = description + + with open("rooms.json", "w") as jsonFile: + json.dump(rooms, jsonFile) # some other, unrecognised command else: