From bf2a4d7645d9ff2a32859577873f4dcf85f0b2a6 Mon Sep 17 00:00:00 2001 From: Dinko Galetic Date: Tue, 08 Jun 2010 23:03:26 +0000 Subject: Added examine() and go() functions. examine() returns the description of what you're examining, and go() changes rooms. --- (limited to 'library') diff --git a/library/pippy/scholar/scholar.py b/library/pippy/scholar/scholar.py index c2c141b..0f50f65 100644 --- a/library/pippy/scholar/scholar.py +++ b/library/pippy/scholar/scholar.py @@ -95,3 +95,16 @@ def opposite_exit(side): else: return side + +def examine(player, obj): + # TODO: "If obj in player.inventory" - or something like that + if obj in player.position.contains or obj == player.position: + print obj.description + +# TODO: The option to move without typing "go", just "west", "up"... +def go(player, side): + if player.position.exits.has_key(side): + player.position = player.position.exits[side] + examine(player, player.position) + else: + print "No such exit." -- cgit v0.9.1