" + a + ""); top.working.document.close(); } function showInventory () { var doc = top.inventory.document; var i, visibleObject = new Array(); doc.open("text/html", "replace"); doc.writeln(""); for (i=0; i 0) { doc.writeln("You have the "); for (i=0; i"); doc.close(); } function showRoom () { var doc = top.room.document; var i; var visibleObject = new Array(); doc.open("text/html", "replace"); doc.writeln("\n" + currentRoom.description.charAt(0) + "" + currentRoom.description.slice(1) + ""); for (i=0; i 0) { doc.writeln("You can see the "); for (i=0; i"); doc.close(); } //////////////////////////////////////////////////// // Commands // command = new Array(); //of verbs command[0] = new gameCommand("help", helpCommand) function helpCommand() { writeWA(currentRoom.help); return true; } command[1] = new gameCommand("turns", turnsCommand) var turns = 0; var startTime = new Date(); function turnsCommand() { var hours, minutes, seconds, time = "", now = new Date(); seconds = Math.floor((now.getTime() - startTime.getTime()) / 1000); hours = Math.floor(seconds / 3600); seconds = seconds % 3600; minutes = Math.floor(seconds / 60); seconds = seconds % 60; if (hours > 1) { time += hours + " hours"; } else if (hours == 1) { time += "1 hour"; } if (minutes > 1) { time += " " + minutes + " minutes"; } else if (minutes == 1) { time += " 1 minute"; } if (seconds > 1) { time += " " + seconds + " seconds"; } else if (seconds == 1) { time += " 1 second"; } var turnString = turns + " turn"; if (turns != 1) { turnString += "s"; } writeWA("You have wasted " + turnString + " in your " + time + " of play."); return true; } //////////////////////////////////////////////////// // Transporters // function transporterVerbs(verb) { var theRoom, i; for (i=0; iYou might want to " + linkString("search") + " it.", true, false, "You stick it in your pocket but find you can't walk, so you put it back.", 0, 0, sofaVerbs); function sofaVerbs(verb) { switch (verb) { case "search": writeWA("You run your hands through the moldy cushions and find some change. And under the sofa you find a gun."); sofaChange.visible = true; sofaChange.canBeTaken = true; machineGun.visible = true; return true; } return false; } livingRoom.addObject(sofa); tv = new gameObject("tv", "A black and white tv. It seems to have some kind of advanced functionality. For example you can " + linkString("turn on") + " and " + linkString("turn off") + " this tv.", true, false, "It is where it is, and there it will stay.", 0, 0, tvVerbs); tv.isOn = false; function tvVerbs(verb) { switch (verb) { case "on": if (!this.isOn) { if (!breaker.tripped) { writeWA("As you turn on the tv you feel the need to eat popcorn."); this.isOn = true; } else { writeWA("The tv doesn't come on. Hmmm... maybe the power is out or something."); } } else { writeWA("It's already on!"); } return true; case "off": if (this.isOn) { writeWA("You wisely turn off the tv to prevent premature brain rot."); this.isOn = false; } else { writeWA("The tv is already in a state of not being on."); } return true; } return false; } livingRoom.addObject(tv); //////////////////////////////////////////////////// // Kitchen // kitchen = new gameRoom("kitchen", "You are now in a beautiful kitchen with tapestries and gothic windows.", "This is were you make popcorn. Check the fridge."); kitchen.addObject(livingRoomTransporter); kitchen.addObject(laundryRoomTransporter); kitchen.addObject(garageTransporter); windows = new gameObject("windows", "The soaring million dollar stained glass gothic windows add a nice touch to the kitchen.", true, false, "You can't even reach them!", 0, 0, noVerbs); kitchen.addObject(windows); tapestries = new gameObject("tapestries", "The tapestries portray the history of popcorn and popcorn making.", true, false, "Hey! Don't touch the fine art with your grubby hands!", 0, 0, noVerbs); kitchen.addObject(tapestries); fridge = new gameObject("fridge", "The stainless steel fridge matches the stonework. There is a coupon and a recipe on it.", true, false, "You try to budge it, but break your back instead.", 0, 0, fridgeVerbs); function fridgeVerbs(verb) { switch (verb) { case "look": coupon.visible = true; recipe.visible = true; return false; case "open": writeWA("There is no butter in the fridge. There is nothing of any use in the fridge (except green beans [or are they hotdogs? - Carrie]) so you close it again."); return true; } } kitchen.addObject(fridge); coupon = new gameObject("coupon", "This is a coupon for 50 cents off any popcorn at the Tiny Sparrow unsupermarket.", false, true, "You have broadened your popcorn horizons.", 0, 0, couponVerbs); function couponVerbs(verb) { switch (verb) { case "give": if (currentRoom.has("cashier")) { writeWA("He won't take it, he says it is out of date."); } else { writeWA("Give the coupon what? Are you nuts?"); } return true; } return false; } kitchen.addObject(coupon); recipe = new gameObject("recipe", "This is a recipe for melting butter.", false, false, "The last time you took the recipe off the fridge you lost it. In the butter.", 0, 0, recipeVerbs); function recipeVerbs(verb) { switch (verb) { case "read": writeWA("50 seconds in microwave."); return true; } return false; } kitchen.addObject(recipe); microwave = new gameObject("microwave", "The microwave is helpful in " + linkString("melt") + "ing butter.", true, false, "You're afraid of the radiation, so you shy away.", 0, 0, noVerbs); kitchen.addObject(microwave); cabinet = new gameObject("cabinet", "The cabinet is where you keep popcorn and salt. It is closed right now.", true, false, "The cabinet is screwed to the wall you dummy.", 0, 0, cabinetVerbs); cabinet.open = false; function cabinetVerbs(verb) { switch (verb) { case "open": if (this.open) { writeWA("It's already open!"); } else { writeWA("The cabinet is now open."); this.description = "The cabinet were you would keep you popcorn and salt is open."; this.open = true; if (currentRoom.has("no popcorn")) { noPopcorn.visible = true; } if (currentRoom.has("absence of salt")) { absenceOfSalt.visible = true; absenceOfSalt.canBeTaken = true; } if (currentRoom.has("popcorn bowl")) { popcornBowl.visible = true; popcornBowl.canBeTaken = true; } } return true; case "close": if (!this.open) { writeWA("The cabinet is closed already, all right?"); } else { writeWA("You close the cabinet."); this.description = "The cabinet where you keep popcorn and salt is closed."; this.open = false; if (currentRoom.has("no popcorn")) { noPopcorn.visible = false; } if (currentRoom.has("absence of salt")) { absenceOfSalt.visible = false; absenceOfSalt.canBeTaken = false; } if (currentRoom.has("popcorn bowl")) { popcornBowl.visible = false; popcornBowl.canBeTaken = false; } } return true; } return false; } kitchen.addObject(cabinet); noPopcorn = new gameObject("no popcorn", "This is a tribute to D.N.A.", false, false, "What!? You think I'm just going to plagiarize the HHGTTG Infocom game?", 0, 0, noVerbs); kitchen.addObject(noPopcorn); absenceOfSalt = new gameObject("absence of salt", "This is a joke gone to far.", false, false, "You want what!? Ok, you can have it if you want it that bad.", 0, 0, noVerbs); kitchen.addObject(absenceOfSalt); virtualPopcornPopper = new gameObject("popcorn popper", "This is a Super Duty F-450 XL Virtual Popcorn Popper.", true, false, "Leave it alone.", 0, 0, noVerbs); kitchen.addObject(virtualPopcornPopper); popcornBowl = new gameObject("popcorn bowl", "This is a ceramic bowl dating to the third century that you use as a popcorn bowl.", false, false, "You remove the bowl from the cabinet.", 0, 0, noVerbs); kitchen.addObject(popcornBowl); //////////////////////////////////////////////////// // Laundry room // laundryRoom = new gameRoom("laundry room", "The laundry room has the overpowering smell of dirty laundry.", "Show me the money!"); laundryRoom.addObject(livingRoomTransporter); laundryRoom.addObject(kitchenTransporter); laundryRoom.addObject(bedroomTransporter); washer = new gameObject("washer", "The modern front loading washer is an ultra efficient cleaning machine. The door is closed.", true, false, "Are you kidding? The thing weighs a ton!", 0, 0, washerVerbs); washer.open = false; function washerVerbs(verb) { switch (verb) { case "open": if (this.open == true) { writeWA("It's already open.") return true; } else { if (clothes.wet) { writeWA("You see a bunch of clean, but wet, clothes in the washer. They need to be dried so you will have something to wear."); this.open = true; this.description = this.description.replace(/closed/, "open"); clothes.visible = true; return true; } else { writeWA("As you open the door you notice something in the washer."); this.open = true; this.description = this.description.replace(/closed/, "open"); if (washChange.visible) { washChange.canBeTaken = true; washChange.takeDescription = "This time you wisely put your hand through the open washer door and snag the change."; } return true; } } break; case "close": if (this.open == false) { writeWA("It is closed!"); return true; } else { writeWA("You close the washer."); this.open = false; this.description = this.description.replace(/open/, "closed"); if (washChange.visible) { washChange.canBeTaken = false; washChange.takeDescription = "You reach for the change, but, because the washer is closed, conk your hand on the glass door. How dumb!"; } return true; } break; case "look": if (this.open && !clothes.wet) { writeWA("You can see some clean change inside the washer."); washChange.visible = true; washChange.canBeTaken = true; return true; } } } laundryRoom.addObject(washer); dryer = new gameObject("dryer", "It dries clothes. You know, a " + linkString("dry") + "er? Do I have to explain everything to you? The door to the dryer is closed.", true, false, "It's rather bulky, so leave it alone.", 0, 0, dryerVerbs); dryer.open = false; function dryerVerbs(verb) { switch (verb) { case "open": if (!clothes.wet) { writeWA("The clothes are drying, so you wisely leave the door to the dryer shut."); } else { if (this.open) { writeWA("The dryer door is already open."); } else { writeWA("You open the dryer and discover it conveniently empty."); dryer.open = true; this.description = this.description.replace(/closed/, "open"); } } return true; case "close": if (!this.open) { writeWA("The dryer door is already closed."); } else { writeWA("You sadly close the dryer door, knowing that no dry clean clothes will ever emerge."); this.open = false; this.description = this.description.replace(/open/, "closed"); } return true; } return false; } laundryRoom.addObject(dryer); clothes = new gameObject("clothes", "A bunch of wet clothes in the washer that need to be dried.", false, false, "You don't want to carry a bunch of wet clothes around. " + linkString("Dry") + " them instead.", 0, 0, clothesVerbs); clothes.wet = true; function clothesVerbs(verb) { switch (verb) { case "dry": if (this.wet == true) { if (dryer.open && washer.open) { dryer.verb("close"); writeWA("You put the wet clothes in the drier, close the door and turn it on. The washer is now mostly empty."); this.visible = false; this.wet = false; return true; } else { writeWA("To do this various doors need to be open that are currently closed. Unfortunately the author of this game is too lazy to open them for you, so you will have to open them yourself."); return true; } } } return false; } laundryRoom.addObject(clothes); washChange = new gameObject("clean change", "Some clean coins from the wash.", false, false, "You add to your purchasing ability.", 126, 0, noVerbs); laundryRoom.addObject(washChange); //////////////////////////////////////////////////// // Bedroom // bedroom = new gameRoom("bedroom", "The walls of you bedroom are covered with bookcases full of books. There is also a theater style THX surround sound system.", "Clean up and destroy."); bedroom.addObject(livingRoomTransporter); bedroom.addObject(laundryRoomTransporter); piggyBank = new gameObject("piggy bank", "The piggy bank contains your life savings.", true, false, "You can't take it. It's like a greased pig. It just slips through your fingers. Like money! You could try shaking it.", 0, 0, piggyVerbs); function piggyVerbs(verb) { switch (verb) { case "shake": writeWA("It's a grade A piggy bank. Nothing comes out! There isn't even a plug. Maybe you could break it."); return true; case "break": writeWA("You throw the piggy bank to the ground. It doesn't break, but it does squeal loudly in pain! Maybe you should put it out of it's misery."); return true; case "kill": writeWA("What objects in this game could you use to kill a piggy bank, or even a pig?"); return true; case "shoot": if (inventory.has("gun") || inventory.has("crossbow")) { writeWA("You blow the piggy bank to smithereens. There are a few coins inside, but what a mess!"); pigMoney.visible = true; pigMoney.canBeTaken = true; this.visible = false; } else { writeWA("You hold out your hand and say, \"Bang! Bang!\". But nothing seems to happen."); } return true; case "ax": if (inventory.has("ax")) { writeWA("You heft the great ax and split the piggy bank in two. There are a few coins inside, but what a mess!"); pigMoney.visible = true; pigMoney.canBeTaken = true; this.visible = false; } else { writeWA("You yell \"Judo chop!\" and bring down you open hand on the piggy bank like you're from the 60's. But nothing seems to happen."); } return true; case "lightsaber": case "slash": if (inventory.has("lightsaber")) { writeWA("You take out your frustrations of the pig. You slash with your saber and cut the pig open."); pigMoney.visible = true; pigMoney.canBeTaken = true; this.visible = false; } else { writeWA("How are you going to do that?"); } return true; } return false; } bedroom.addObject(piggyBank); pigMoney = new gameObject("pig money", "Many Bothan Pigs died to bring you this money. [apologies to George].", false, false, "You steal from the dead.", 502, 0, noVerbs); bedroom.addObject(pigMoney); bed = new gameObject("bed", "The four-poster unmade bed sits imposingly in center of the room.", true, false, "You grab the bed. And decide it's not such a good idea after all.", 0, 0, bedVerbs); bed.make = 0; function bedVerbs(verbs) { switch (verb) { case "make": switch (this.make) { case 0: writeWA("You really don't want to " + linkString("make") + " the bed. Even though you should."); this.make++; break; case 1: writeWA("You'd need hammer and nails to " + linkString("make") + " a bed! Ha! Ha! Ok, I know what you mean, it would look nice."); this.make++; break; case 2: writeWA("Are you really sure you want to " + linkString("make") + " the bed? I don't think so."); this.make++; break; case 3: writeWA("All right! All right already! You go and waste some time making the bed. Happy now? Oh, yeah. Now that you've made the bed you can see the messy area under the bed."); this.description = "The four-poster bed sits imposingly in the center of the room."; underBed.visible = true; this.make++; break; case 4: writeWA("The bed is already made! Go away!"); break; } return true; } return false; } bedroom.addObject(bed); underBed = new gameObject("under bed", "This is the rather messy area under the bed. I doubt there is anything useful there. Go away! Don't touch it! You could die!!!", false, false, "How much dirt is there in a hole?", 0, 0, underBedVerbs); underBed.clean = 0; function underBedVerbs(verb) { switch (verb) { case "clean": switch (this.clean) { case 0: writeWA("You back away from the stench."); this.clean++; break; case 1: writeWA("You start to clean it, but must run down the hall to puke in the bathroom. You come back vowing to never look under the bed again."); this.clean++; break; case 2: writeWA("No way."); this.clean++; break; case 3: writeWA("Remembering your earlier vow, you close your eyes, hold your nose and clean out under the bed. While you're at it you find some dirty money."); this.description = "The area under the bed is now spick and span sparkling clean. You can even " + linkString("go under the bed") + " now."; dirtyMoney.visible = true; dirtyMoney.canBeTaken = true; this.clean++; break; case 4: writeWA("The area under the bed is already clean as a whistle. (Toot, toot.)"); break; } return true; case "go": if (underBed.clean == 4) { if (lightsaber.visible == false && currentRoom.has("lightsaber")) { writeWA("Hmmm... there seems to be a loose board here on the floor... let me see if you can, ... hey! There's a secret area under the floorboards here! This wasn't supposed to be in the game! There's a lightsaber in here! That wasn't supposed to be in this game at all! What's going on here? Oh well, you crawl back out from under the bed."); lightsaber.visible = true; lightsaber.canBeTaken = true; } else { writeWA("You crawl under the bed and cower in fear for a while. Then decide to come out after the boogy men have gone away."); } } else { writeWA("There isn't enough room for you under there! It's packed!"); } return true; } return false; } bedroom.addObject(underBed); dirtyMoney = new gameObject("dirty money", "This is some stinky old cash you found under your bed.", false, false, "You hold your nose and take the money.", 200, 0, noVerbs); bedroom.addObject(dirtyMoney); lightsaber = new gameObject("lightsaber", "It has an inscription on the side that says this was your father's lightsaber. Cool! " + linkString("Slash") + " something! I want to see it work!", false, false, "You take the elegant weapon.", 0, 0, noVerbs); bedroom.addObject(lightsaber); mothersNote = new gameObject("mothers note", "It seems to be a note from your mother. You should probably " + linkString("read") + " it. But I wouldn't recommend it.", true, true, "For some reason you pick up your mother's note.", 0, 0, mothersNoteVerbs); function mothersNoteVerbs(verb) { switch (verb) { case "read": writeWA("While the rest of the family is on vacation in Hawaii I want you to " + linkString("make") + " your bed and " + linkString("clean") + " up under it. You should then make popcorn and watch tv until we get back.

Insincerely,
Your mother"); return true; } return false; } bedroom.addObject(mothersNote); //////////////////////////////////////////////////// // Garage // garage = new gameRoom("garage", "The garage is like a dungeon complete with skeletons in shackles hanging from the walls.", "Power means more than just electricity."); garage.addObject(kitchenTransporter); garage.addObject(storeTransporter); ax = new gameObject("ax", "This is not a standard wood ax. This is the ax of Gimli. [apologies Tolkien]", true, true, "You arm yourself with the great weapon of middle-earth.", 0, 0, noVerbs); garage.addObject(ax); breakerBox = new gameObject("breaker box", "This box contains the circuit breakers for the house. It is closed.", true, false, "It's stuck to the wall. Besides, if you ripped it out, you would have no power.", 0, 0, breakerBoxVerbs); breakerBox.open = false; function breakerBoxVerbs(verb) { switch (verb) { case "open": if (this.open) { writeWA("It's already open."); } else { writeWA("You open the breaker box. Inside is a circuit breaker."); this.open = true; breaker.visible = true; this.description = this.description.replace(/closed/, "open"); } return true; case "close": if (!this.open) { writeWA("It's already closed."); } else { writeWA("You close the breaker box."); this.open = false; breaker.visible = false; this.description = this.description.replace(/open/, "close"); } return true; } return false; } garage.addObject(breakerBox); breaker = new gameObject("breaker", "This is a circuit breaker. It is currently tripped and needs to be " + linkString("reset") + ".", false, false, "You could rip it out, but why? Besides, you'd probably just electrocute yourself.", 0, 0, breakerVerbs); breaker.tripped = true; function breakerVerbs(verb) { switch (verb) { case "reset": if (this.tripped) { writeWA("You reset the circuit breaker. Maybe stuff will work now."); this.description = "This circuit breaker seems to be in good working condition."; this.tripped = false; } else { writeWA("What is the point to that? It already works."); } return true; } return false; } garage.addObject(breaker); car = new gameObject("car", "Ok, so it isn't really a car. It's called a car because it's easier to type. I mean if you had to type \"F-1 McLarren\" just to look at it, would you?", true, false, "You don't even want to touch it. It's like a work of art.", 0, 0, noVerbs); car.location = "home"; garage.addObject(car); //////////////////////////////////////////////////// // fruits/vegetables // fruits = new gameRoom("fruits", "This is the fruits and vegetables aisle. Nothing of any use seems to be here.", "These aren't the droids... um, I mean, foods you're looking for, move along."); fruits.addObject(meatTransporter); fruits.addObject(homeTransporter); //////////////////////////////////////////////////// // meats // meats = new gameRoom("meats", "You stand in the midst of the meats aisle. If this game wanted you to make a hamburger, this would be an important room. But it isn't.", "Keep going."); meats.addObject(fruitTransporter); meats.addObject(breadTransporter); //////////////////////////////////////////////////// // breads // breads = new gameRoom("breads", "This is where the yucky american bread is kept. Why it is kept we do not know.", "You don't need bread."); breads.addObject(meatTransporter); breads.addObject(snackTransporter); //////////////////////////////////////////////////// // snack foods - popcorn // snackFoods = new gameRoom("snacks", "This is where the snack foods are in the Tiny Sparrow®.", "Go virtual!"); snackFoods.addObject(breadTransporter); snackFoods.addObject(petFoodTransporter); virtualPopcorn = new gameObject("Virtual Popcorn", "Virtual Popcorn! Pops best in virtual popcorn poppers in the Mozilla version 1.0 web browser. $2.75", true, true, "You pick up the most virtual popcorn ever.", 0, 275, popcornVerbs); virtualPopcorn.popped = false; virtualPopcorn.buttered = false; virtualPopcorn.salted = false; snackFoods.addObject(virtualPopcorn); poopcorn = new gameObject("Poopcorn", "Poopcorn! Needs no explanation! It's crude, it's disgusting, and belongs only in juvenile games.", true, true, "You pick up the stinky bag. $1.50", 0, 150, popcornVerbs); poopcorn.popped = false; poopcorn.buttered = false; poopcorn.salted = false; snackFoods.addObject(poopcorn); tinySparrowPopcorn = new gameObject("store brand popcorn", "Tiny Sparrow Maypop popcorn. Supposedly named after May, the daughter of the store's owner, Maypop is self describing. $1.25", true, true, "You pick up the bag of unreliable kernels.", 0, 125, popcornVerbs); tinySparrowPopcorn.popped = false; tinySparrowPopcorn.buttered = false; tinySparrowPopcorn.salted = false; snackFoods.addObject(tinySparrowPopcorn); unpopper = new gameObject("Orvile Redunpopper", "This brand of popcorn is greatly overpriced and doesn't pop at all.", true, true, "You pick up the overpriced popcorn kernels, but why, we will never know. How are you going to pay for them!?", 0, 3141, popcornVerbs); unpopper.popped = false; unpopper.buttered = false; unpopper.salted = false; snackFoods.addObject(unpopper); function popcornVerbs(verb) { switch (verb) { case "pop": if (currentRoom.has("popcorn popper")) { if ((currentRoom.has("popcorn bowl") || inventory.has("popcorn bowl")) && popcornBowl.visible) { writeWA("You pop the popcorn."); this.description = "The " + this.name + " in the virtual bowl needs " + linkString("butter") + "ed and " + linkString("salt") + "ed."; popcornBowl.visible = false; this.popped = true; } else { writeWA("You need a popcorn bowl in order to pop the popcorn."); } } else { writeWA("You need a virtual popcorn popper to pop " + this.name + ". Duh!"); } return true; case "butter": var butter = "none"; if (itsNotButter.melted && inventory.has(itsNotButter.name)) butter = itsNotButter; if (countryCrook.melted && inventory.has(countryCrook.name)) butter = countryCrook; if (marginalButter.melted && inventory.has(marginalButter.name)) butter = marginalButter; if (virtualButter.melted && inventory.has(virtualButter.name)) butter = virtualButter; if (this.popped) { if (butter != "none") { writeWA("You butter the popcorn with the " + butter.name + "."); if (this.salted) { this.description = "The " + this.name + " is ready to eat."; } else { this.description = "The " + this.name + " still needs " + linkString("salt") + "."; } this.buttered = true; butter.visible = false; } else { writeWA("You have no melted butter to use on the popcorn."); } } else { writeWA("Why would you want to butter unpopped popcorn!?"); } return true; case "salt": if (this.popped && inventory.has("salt")) { writeWA("You salt the popcorn.") if (this.buttered) { this.description = "The " + this.name + " is ready to eat."; } else { this.description = "The " + this.name + " still needs " + linkString("butter") + "ed."; } this.salted = true; } return true; case "eat": if (currentRoom.has("tv") && tv.isOn) { if (this.popped && this.buttered && this.salted) { writeWA("You sit down to watch tv until you parents get home. You win! Yea!"); } else { writeWA("The popcorn isn't quite ready yet..."); } } else { writeWA("Eating popcorn requires a tv to be watched."); } return true; } return false; } //////////////////////////////////////////////////// // pet foods // petFoods = new gameRoom("pet foods", "The aisle contains food more fit for dog, cat, and fish consumtion, not human.", "You don't have any pets in this game."); petFoods.addObject(snackTransporter); petFoods.addObject(coldFoodTransporter); //////////////////////////////////////////////////// // cold foods - butter // coldFoods = new gameRoom("cold foods", "This is where the frozen and refrigerated foods are kept.", "Go virtual."); coldFoods.addObject(petFoodTransporter); coldFoods.addObject(dryFoodTransporter); virtualButter = new gameObject("Virtual Butter", "100% ethereal, immaterial, fat free butter.", true, true, "You pick up some much needed butter.", 0, 316, butterVerbs); virtualButter.melted = false; coldFoods.addObject(virtualButter); itsNotButter = new gameObject("Its Not Butter", "\'I can believe it's not butter\' is sitting on the shelf.", true, true, "You snatch the rather odd smelling stuff from the shelf.", 0, 256, butterVerbs); itsNotButter.melted = false; coldFoods.addObject(itsNotButter); countryCrook = new gameObject("Country Crook", "The country crook company likes to project an image that matches its name. Some of the tubs with this butter substitute come with real live midget burglers.", true, true, "You pick up some much needed butter.", 0, 295, butterVerbs); countryCrook.melted = false; coldFoods.addObject(countryCrook); marginalButter = new gameObject("Marginal Butter", "This really does seem to be a rather marginal product.", true, true, "You pick up the marginally edible butter substitute.", 0, 213, butterVerbs); marginalButter.melted = false; coldFoods.addObject(marginalButter); function butterVerbs(verb) { switch (verb) { case "melt": case "microwave": if (currentRoom.has("microwave")) { if (!this.melted) { writeWA("You melt the butter in the microwave."); this.description += " It is now melted."; this.melted = true; } else { writeWA("But it's already melted. You could try burning it, or maybe toasting it, but that's never a good idea and this game won't do it. But you could try it in the real world. Just be sure to have adult supervision."); } } else { writeWA("You could melt the butter in your mouth, but that's gross. You need something else to melt it."); } return true; } return false; } //////////////////////////////////////////////////// // dry foods - salt // dryFoods = new gameRoom("dry foods", "All the stuff that comes out dry is here.", "Go virtual?"); dryFoods.addObject(coldFoodTransporter); dryFoods.addObject(drinkTransporter); dryFoods.addObject(checkoutTransporter); salt = new gameObject("salt", "Plain old Antinonununnonvirtual Salt. 6% better than virtual salt!", true, true, "You pick up the salt which may or may not be virtual.", 0, 378, noVerbs); dryFoods.addObject(salt); //////////////////////////////////////////////////// // drink - lemonade // drinks = new gameRoom("drinks", "You stand amidst the many ways invented to flavor water.", "You need something good and virtual to drink."); drinks.addObject(dryFoodTransporter); drinks.addObject(checkoutTransporter); //////////////////////////////////////////////////// // checkout // checkout = new gameRoom("checkout", "This is where you " + linkString("pay") + " for your purchases.", "In this game the line never gets shorter. You have to make it shorter yourself."); checkout.addObject(dryFoodTransporter); checkout.addObject(drinkTransporter); checkout.addObject(homeTransporter); cashier = new gameObject("cashier", "The cashier is the person who rings up your purchases and takes your money. Before you " + linkString("pay the cashier") + " you should make sure you have what you want, because there are no refunds in this game.", true, false, "The cashier is really cute, but you can't think of a pick-up line.", 0, 0, cashierVerbs); function cashierVerbs(verb) { var i; switch (verb) { case "pay": if (money < moneyOwed) { writeWA("You don't have enough money to pay for all the stuff you have!"); } else { if (butcher.isAlive || baker.isAlive || candlestickMaker.isAlive) { writeWA("There are people ahead of you in line. They seem to be waiting for a price check. You could be waiting a while."); } else { writeWA("You pay the cashier for your purchases."); for (i=0; i 0) { inventory.removeObject(inventory.object[i]) i--; } } money -= moneyOwed; moneyOwed = 0; change.worth = money; inventory.addObject(change); } } return true; case "shoot": case "ax": case "lightsaber": case "slash": writeWA("The cashier is invincible!"); return true; } return false; } checkout.addObject(cashier); change = new gameObject("change", "This is the change from your purchases at the Tiny Sparrow unsupermarket.", true, true, "You pick your change back up.", 0, 0, noVerbs); butcher = new gameObject("butcher", "It appears that the store's butcher is standing in line to purchase some items for himself.", true, false, "Hands off! But maybe you could get him out of your path another way...", 0, 0, butcherVerbs); butcher.isAlive = true; butcher.hasBeenSearched = false; function butcherVerbs(verb) { switch (verb) { case "kill": writeWA("Be more specific."); return true; case "shoot": if (inventory.has("gun")) { if (butcher.isAlive) { writeWA("You mercilessly use you AK-47 to lay waste to the butcher. You have now butchered the butcher. Animal rights activists the world over cheer."); butcher.isAlive = false; butcher.description = "The corpse of the butcher on the floor is riddled with bullets."; butcher.takeDescription = "What for? To dig the bullets out of him and use them again?"; } else { writeWA("You put a few more bullets into the butcher's body, just to be sure."); } } else { writeWA("You hold out your hand and say, \"Bang! Bang!\". But the butcher just look annoyed at you."); } return true; case "ax": if (inventory.has("ax")) { if (butcher.isAlive) { writeWA("You cleave the butcher in half from top to bottom."); butcher.isAlive = false; butcher.description = "The sum of the parts of the butcher is less than the whole."; butcher.takeDescription = "Yeah, right. Which part?"; } else { writeWA("You chop the butcher into ever smaller pieces."); } } else { writeWA("You use your hand to take a chop at his neck, but you miss."); } return true; case "lightsaber": case "slash": if (inventory.has("lightsaber")) { if (butcher.isAlive) { writeWA("You give in to your anger at waiting in line and use your lightsaber to slash the butcher to pieces."); butcher.isAlive = false; butcher.description = "The insignificant body of the butcher lies at your feet."; butcher.takeDescription = "The thought of death brings you pleasure, but see no reason to drag a dead body around."; } else { writeWA("Being controlled by the dark side, you taunt the lifeless form."); } } else { writeWA("What do you think this is? Star Wars®?"); } return true; case "search": if (!butcher.isAlive) { if (butcher.hasBeenSearched) { writeWA("You again search the remains of the butcher you butchered, but find nothing but dead meat."); } else { writeWA("You search the butcher and find some money."); checkout.addObject(butcherMoney); butcher.hasBeenSearched = true; } return true; } } return false; } checkout.addObject(butcher); butcherMoney = new gameObject("butcher money", "The now deceased butcher has been robbed.", true, true, "You pilfer the body.", 1067, 0, noVerbs); baker = new gameObject("baker", "The Tiny Sparrow bread maker is waiting in line to pay for his items.", true, false, "Don't touch him! He bites!", 0, 0, bakerVerbs); baker.isAlive = true; baker.hasBeenSearched = false; function bakerVerbs(verb) { if (butcher.isAlive) { writeWA("You can't get to the baker, the butcher is in the way."); return true; } switch (verb) { case "kill": writeWA("Be more specific."); return true; case "shoot": if (inventory.has("gun")) { if (baker.isAlive) { writeWA("You laugh maniacally as you bake the baker with round after round of ammunition."); baker.isAlive = false; baker.description = "The baker looks like swiss cheese."; baker.takeDescription = "He's too big to take, so you just pose the body so it look more contorted."; } else { writeWA("Wow. You are really violent."); } } else { writeWA("You hold out your hand and say, \"Bang! Bang!\". People look at you funny."); } return true; case "ax": if (inventory.has("ax")) { if (baker.isAlive) { writeWA("With a great war cry you slay the baker."); baker.isAlive = false; baker.description = "1/2 a baker + 1/2 a baker = no baker."; baker.takeDescription = "Why?"; } else { writeWA("You make sure he will never make that horrid bread again."); } } else { writeWA("You use your hand to take a chop at his neck, but you hit yourself instead."); } return true; case "lightsaber": case "slash": if (inventory.has("lightsaber")) { if (baker.isAlive) { writeWA("Your hate has made you strong. You destroy the detestable baker with one swift blow."); baker.isAlive = false; baker.description = "Your unworthy foe will nevermore make that yukky american bread."; baker.takeDescription = "You have no time for such frivolities."; } else { writeWA("Instead you use force throw to hurtle sticks of gum at the dead body."); } } else { writeWA("What ever."); } return true; case "search": if (!baker.isAlive) { if (baker.hasBeenSearched) { writeWA("The baked baker yields nothing more of use from his now crusty body."); } else { writeWA("You search the baker and find some money."); checkout.addObject(bakerMoney); baker.hasBeenSearched = true; } return true; } } return false; } checkout.addObject(baker); bakerMoney = new gameObject("baker money", "Some money you took from the cold, dead baker.", true, true, "You take the money.", 500, 0, noVerbs); candlestickMaker = new gameObject("candlestick maker", "You recognize this cutie from your Popcorn Anonymous support group. This is also the person holding up the queue.", true, false, "This person seems to be waiting for a price check. You seem to need a reality check.", 0, 0, candlestickMakerVerbs); candlestickMaker.isAlive = true; candlestickMaker.hasBeenSearched = false; function candlestickMakerVerbs(verb) { if (butcher.isAlive || baker.isAlive) { writeWA("You can't get at the cute candlestick maker. There are people in the way."); return true; } switch (verb) { case "kill": writeWA("Be more specific."); return true; case "shoot": if (inventory.has("gun")) { if (candlestickMaker.isAlive) { writeWA("This time you shoot the cute, but queue blocking, candlestick maker with just one bullet that just grazes the arm. The candlestick maker dies a horible slow death from the poison on the bullet."); candlestickMaker.isAlive = false; candlestickMaker.description = "The still cute candlestick maker lies cutely on the floor."; candlestickMaker.takeDescription = "You would like to, but after a while all dead bodies start to sink."; } else { writeWA("You can't bear to mar the cuteness."); } } else { writeWA("You hold out your hand and say, \"Bang! Bang!\". Nothing happens."); } return true; case "ax": if (inventory.has("ax")) { if (candlestickMaker.isAlive) { writeWA("You neatly remove the cute candlestick makers head from the shoulders."); candlestickMaker.isAlive = false; candlestickMaker.description = "The cute head lies to the right of the cute body."; candlestickMaker.takeDescription = "Aren't you disgusting enough?"; } else { writeWA("The candlestick maker is in pieces as it is."); } } else { writeWA("You use your hand to take a chop at the neck, but it dosn't seem to do the trick."); } return true; case "lightsaber": case "slash": if (inventory.has("lightsaber")) { if (candlestickMaker.isAlive) { writeWA("The puny candlestick maker cowers in fear before you. You turn off your lightsaber and the candlestick maker looks relieved. Then you smile and call up lightning from the dark abyss that flows from you fingertips until the candlestick maker looks like a burnt candle."); candlestickMaker.isAlive = false; candlestickMaker.description = "The charred remains of the candlestick maker attest to your mastery of the dark side of the force."; candlestickMaker.takeDescription = "There really isn't enough left to get ahold of."; } else { writeWA("You raise your lightsaber high in triumph and cut into the charred remains of the candlestick maker."); } } else { writeWA("What do you think this is? Star Wars®?"); } return true; case "search": if (!candlestickMaker.isAlive) { if (candlestickMaker.hasBeenSearched) { writeWA("The snuffed candlestick maker has nothing else of use."); } else { writeWA("You search the candlestick maker and find some money."); checkout.addObject(candlestickMakerMoney); candlestickMaker.hasBeenSearched = true; } return true; } } return false; } checkout.addObject(candlestickMaker); candlestickMakerMoney = new gameObject("candle stick maker money", "The money left behind by the candlestick maker.", true, true, "You observe that making candlesticks doesn't seem to be as profitable as it used to be.", 27, 0, noVerbs); //////////////////////////////////////////////////// // Final setup // var money = 0; var moneyOwed = 0; var currentRoom = livingRoom; var inventory = new gameInventory; showInventory(); showRoom(); writeWA(""); //-->