CustomObjects(theGame) { game=theGame; Stick() { id="stick"; description="It's a stick"; return this; } Ball() { id="ball"; adjective="red"; description="A big red ball"; canBeTaken=true; scored=false; TAKE(theCommand) { if (!scored) { game.pc.incrementScore(5); scored = true; } return true; } return this; } DoorKnocker() { id="knocker"; description="A pewter door knocker with the inscription \"The Wadley's\""; synonyms = "doorknocker"; TAKE(theCommand) { game.output.insertStyledString("You can't take that; it's attached to the door\n", STYLE_ITALIC); game.output.insertLineBreak(); return false; } return this; }// end DoorKnocker() Nameplate() { id="nameplate"; description="A simple sign saying \"Max's Room\""; synonyms="plate,sign"; return this; } GenericDoor() { id="door"; description="A simple bedroom door with a sign on it."; EXAMINE(theCommand) { switch(game.currentLocation.roomId) { case "Front porch": game.output.insertString("A sturdy front door, complete with door knocker."); break; case "Hallway": case "MaxRoom": game.output.insertString("Your standard interior door. This one has a sign on it."); break; case "Foyer": if (isNotNull(theCommand.subjectAdjective) && !theCommand.subjectAdjective.trim().equals("")) { switch(theCommand.subjectAdjective) { case "FRONT": game.output.insertString("A sturdy front door, complete with door knocker."); return true; break; case "INTERIOR": case "BEDROOM": game.output.insertString("Your standard interior door. More than likely goes into a bedroom."); return true; break; default: game.output.insertStyledString("I don't see that door here", STYLE_ITALIC); return true; break; } } else { log.debug("Asking for more input"); game.output.insertStyledString("Which door, the interior door or the front door?\n", STYLE_ITALIC); game.output.insertLineBreak(); cmdString = game.waitForInput(); log.debug("Response is " + cmdString); if (cmdString.toUpperCase().matches("FRONT.*")) { game.output.insertString("A sturdy front door."); } else if (cmdString.toUpperCase().matches("BEDROOM.*|INTERIOR.*")) { game.output.insertString("Your standard interior door. More than likely goes into a bedroom."); } else { game.output.insertStyledString("I don't see that door here", STYLE_ITALIC); } //game.parser.callbackOnInput("customParser.DOOR_CALLBACK"); return true; } break; } return true; }// end EXAMINE() TAKE(theCommand) { game.output.insertStyledString("What are you going to do, put a door in your pocket?!? I don't think so.\n", STYLE_ITALIC); game.output.insertLineBreak(); return false; } return this; } return this; }// end CustomObjects(theGame)