Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/pippy/scholar/scholar.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/library/pippy/scholar/scholar.py b/library/pippy/scholar/scholar.py
index 58a97f5..cc01b2f 100644
--- a/library/pippy/scholar/scholar.py
+++ b/library/pippy/scholar/scholar.py
@@ -121,3 +121,43 @@ def unalias(player, player_input):
if player_input in item.aliases:
return item
return None
+
+
+def game_loop():
+ rooms = create_some_rooms()
+ player = login()
+ print "Welcome,", player.name
+ print
+ load()
+ player.position = rooms[0]
+ command = ""
+ examine(player, player.position)
+ while True:
+ command = raw_input("> ")
+ if command == "quit":
+ break
+ command = command.split(" ")
+ # Currently, only two word inputs supported.
+ # This will need some major reworking.
+ if len(command) < 2 or len(command) > 2:
+ print "What?"
+ continue
+ verb = command[0]
+ obj = command[1]
+ # if an item is in the room, you can do it.
+ # TODO: also, if it's in the inventory.
+
+ if verb in player.known_commands:
+ real_obj = unalias(player, obj)
+ if real_obj == None:
+ print "No such thing here."
+ continue
+ if verb in real_obj.methods:
+ eval(verb)(player, real_obj)
+ else:
+ print "You can't", verb, obj
+ else:
+ print "You don't know how to \"" + verb + "\""
+
+ save()
+ print "Goodbye!"