Browse files

Minor fixing

  • Loading branch information...
1 parent 06bae2e commit 638d872aad7c6b15350615dcf2aa0593209c3e6a @kallepersson kallepersson committed May 6, 2009
Showing with 9 additions and 9 deletions.
  1. +0 −4 Game.py
  2. +2 −1 Inventory.py
  3. +1 −0 Room.py
  4. +2 −2 Trigger.py
  5. +4 −2 main.py
View
4 Game.py
@@ -146,7 +146,3 @@ def do_quit(self, arg):
def do_dump(self, arg):
print self.inventory.items
-
- def debugmsg(self,str):
- if self.debug:
- print str
View
3 Inventory.py
@@ -10,7 +10,8 @@ def removeItem(self,object):
self.items.pop(object.name)
def hasItem(self,object):
- return object.name in self.items
+ print object
+ return object in self.items
def listItems(self):
if len(self.items) > 0:
View
1 Room.py
@@ -36,6 +36,7 @@ def setObjectVisibility(self,objectName,visible=True):
self.objects[objectName].visible = visible
def enter(self):
+ print 45*"\n"
print "Entering",self.name
def addTrigger(self,trigger,type,object):
View
4 Trigger.py
@@ -15,11 +15,11 @@ def run(self):
execString += "\""+argument+"\","
execString = execString[:-1]
execString += ")"
- print "###",execString
+ #debugmsg(execString)
exec(execString)
self.triggered = True
else:
- print "### FAILED TO RUN",self.type,"###"
+ exit("Trigger failed:",self.type)
def showObject(self,roomKey,objectKey):
self.action.object.room.game.rooms[roomKey].setObjectVisibility(objectKey,True)
View
6 main.py
@@ -29,21 +29,23 @@
RestroomSink.actions["look"].addTrigger(Trigger("showObject",["restroom","toothpaste"]))
Restroom.addObject(RestroomSink)
-RestroomToliet = Object("toilet",[Action("look","No. You do not want to do that.")])
+RestroomToliet = Object("toilet",[Action("look","No. You are not sure you want to do that.")])
+#RestroomToliet.actions["look"].addTrigger(Trigger("changeObjectResponse",["restroom","toilet","look","Not being able to resist, you lift the lid of the toilet. That was a bad idea."]))
Restroom.addObject(RestroomToliet)
RestroomToothpaste = Object("toothpaste",[Action("look","You can't make out the brand of the toothpaste, but from what you see it has done to the sink you understand that it must be very strong."),Action("take","You pick up the toothpaste while making very sure not to get anything on you."),Action("use","You put some toothpaste on the bars. They melt away like butter on a sunny day!")])
RestroomToothpaste.actions["take"].addTrigger(Trigger("changeObjectResponse",["restroom","sink","look","The sink is in a sorry state."]))
RestroomToothpaste.actions["use"].target = "bars"
RestroomToothpaste.actions["use"].addTrigger(Trigger("removeObject",["cellar","bars"]))
RestroomToothpaste.actions["use"].addTrigger(Trigger("changeObjectResponse",["cellar","window","look","It has no bars anymore."]))
+RestroomToothpaste.actions["use"].addTrigger(Trigger("changeObjectResponse",["cellar","default","look","The cellar is bathing in light coming from the window. With no bars, the [window] on the [south] wall has become an exit. There is also a door to the [east]"]))
RestroomToothpaste.actions["use"].addTrigger(Trigger("setRoomExit",["cellar","south","outside"]))
Restroom.addObject(RestroomToothpaste)
Restroom.exits["west"] = "cellar"
Outside = Room("the Outside")
-OutsideDefault = Object("default",[Action("look","Oh my lord, you seem to be in outside. That must mean you've won! GG!")])
+OutsideDefault = Object("default",[Action("look","Oh my lord, you seem to be outside. That must mean you've won! GG!")])
Outside.addObject(OutsideDefault)
Outside.exits["north"] = "cellar"

0 comments on commit 638d872

Please sign in to comment.