diff --git a/game/story.coffee b/game/story.coffee index 0b24098..f79660b 100644 --- a/game/story.coffee +++ b/game/story.coffee @@ -2,8 +2,6 @@ room "world", tags: ["start"], optionText: "Enter the world", ways: ["plaza"] - enter: () -> - bugg.put(@name) content: """ ### Rhinestone Room @@ -26,16 +24,19 @@ room "plaza", "quirky", "distinct", "kooky", "crazy", "quaint" ] ways: ["shop"] - before: () -> - """ - You climb up the well and come out to a central plaza of a #{cyclelink("quaint")} little town. - A plaque nearby says it's the town of *Innsmouth,* wherever that is. - """ - content: """ - There are #{textlink("people shouting", "people")} nearby. - - You could ask a policeman #{textlink("for directions.", "mark")} - """ + before: (character, system, from) -> + if from == 'world' + """ + You climb up the well and come out to a central plaza of a #{cyclelink("quaint")} little town. + A plaque nearby says it's the town of *Innsmouth,* wherever that is. + """ + else + "You quickly find the central plaza." + content: (character, system) -> + retval = "There are #{textlink("people shouting", "people")} nearby." + unless character.sandbox.has_mark? + retval += "\n\nYou could ask a policeman #{textlink("for directions.", "mark")}" + return retval writers: cyclewriter: (character) -> cycle(this, character) mark: (character) -> @@ -60,17 +61,18 @@ room "shop", room "lair", title: "The Lair" - before: "Seems like you can't leave this just like that." + before: "Finding The Lair is easy. Leaving it is impossible. Your game ends here." content: """ The Lair of Yog-Sothoth is a very *n'gai* cave, full of *buggs-shoggogs* and *n'ghaa ng'aa*. """ - -bugg = obj "bugg-shoggog", - dsc: "You see a particularly beautiful slimy {{bugg.}}" - takeable: false - act: () => - here().drop(@name) - return "You eat the bugg mass. Delicious and raw." + objects: { + bugg: obj "bugg", + dsc: "You see a particularly beautiful slimy {{bugg.}}" + takeable: false + act: () => + here().drop(@name) + return "You eat the bugg mass. Delicious and raw. Perhaps it's a good lair to live in." + } dialogue "Yes", "merchant", "merchant", """ Yes. @@ -93,10 +95,16 @@ room "shop-inside", return "" } +### +I want to be able to do this but I can't because I'm lost in all the `this` and @objects and `new`. +The chain of calls is very weird and this puts an object IN EVERY ROOM for God's sake. +I need someone smarter than me to fix this. + lamp = obj "lamp", dsc: "You see a {{lamp.}}" takeable: true lamp.put("shop-inside") +### room "merchdialogue", choices: "#merchant", diff --git a/lib/markdown.coffee b/lib/markdown.coffee index 9b09980..8cfdea8 100644 --- a/lib/markdown.coffee +++ b/lib/markdown.coffee @@ -4,6 +4,8 @@ Implies that you don't mix up your tabs and spaces. Copyright 2015 Bruno Dias ### normaliseTabs = (text) -> + unless text? + return "" lines = text.split('\n'); indents = lines .filter((l) => l != '') @@ -23,6 +25,8 @@ normaliseTabs = (text) -> ).join('\n') markdown = (text) -> + unless text? + return "" if typeof text is Function text = text() return marked(normaliseTabs(text), { diff --git a/lib/situation.coffee b/lib/situation.coffee index 3c3cb1c..a433ae4 100644 --- a/lib/situation.coffee +++ b/lib/situation.coffee @@ -46,7 +46,7 @@ RaconteurSituation.inherits(undum.Situation) Undum API. ### -RaconteurSituation.prototype.act = (character, system, action) => +RaconteurSituation.prototype.act = (character, system, action) -> actionClass = action.match(/^_(\w+)_(.+)$/) that = this