pass class Shirt(items.Item): pass class Dojo(items.Room): pass class Restaurant(items.Room): pass class Reception(items.Room): pass class PresentationRoom(items.Room): pass if __name__ == '__main__': try: game = game.createFromScript(open('script.xml'), locals()) game.actor = Player.inst interface.runGame(game) except (KeyboardInterrupt, EOFError): print("\nGoodbye.")
output.write("You finish hanging your cloak on the hook.") class Message(items.Item): def handle(self, sentence, output): if sentence == 'read *self' or sentence == 'examine *self': output.write('The message, neatly marked in the sawdust, reads...', False) self.game.end(output) '''End the game.''' def cloakMoved(self, event): '''This event handler is called to check if the cloak can be moved and return a response if not.''' if event.destination not in (Player, Hook, Cloakroom): if event.output: event.output.write("This isn't the best place to leave a smart cloak lying around.") class Cloak(items.Item): def init(self): '''Listen to move events.''' self.addEventListener(self.EVT_MOVED, (self, cloakMoved)) '''Create the game world based on our script.''' game = game.createFromScript(open('cod.script.xml'), locals()) '''Set Player instace as the actor.''' game.actor = Player.inst if __name__ == '__main__': '''Finally we need an interface so that you can actually play the game. ''' import pyf.interface pyf.interface.runGame(game)
class Rick(items.Actor): pass #################################### Items ##################################### class DocKey(items.Item): pass class DocCabinet(items.Item): pass class erZombieContainer(items.Item): pass class HosGown(items.Item): pass ##################### Create Game and Interface from brains.script.xml ######### game = game.createFromScript(open('brains.script.xml'), locals()) ##if whichGame=="Rick" or "Rick Grimes" or "rick" or "sweet" or "easy": game.actor = Rick.inst '''elif whichGame=="Brandon" or "Brandon Conchobhair" or "brandon" or "mild" or "normal" or "concho": game.actor = Brandon.inst elif whichGame=="Steve" or "Steve Butler" or "steve" or "medium" or "hard": game.actor = Steve.inst elif whichGame=="Zack" or "Zack Raver" or "zack" or "hot" or "hotasfuck" or "legendary": game.actor = Zack.inst''' interface.runGame(game)