1
0
Fork 0
mirror of https://gitlab.com/Oreolek/salet.git synced 2024-07-07 01:04:25 +03:00

Something resembling a story..?

This commit is contained in:
Alexander Yakovlev 2016-01-17 00:24:02 +07:00
parent 4ca04bb658
commit c84a1c9def
3 changed files with 33 additions and 21 deletions

View file

@ -2,8 +2,6 @@ room "world",
tags: ["start"], tags: ["start"],
optionText: "Enter the world", optionText: "Enter the world",
ways: ["plaza"] ways: ["plaza"]
enter: () ->
bugg.put(@name)
content: """ content: """
### Rhinestone Room ### Rhinestone Room
@ -26,16 +24,19 @@ room "plaza",
"quirky", "distinct", "kooky", "crazy", "quaint" "quirky", "distinct", "kooky", "crazy", "quaint"
] ]
ways: ["shop"] ways: ["shop"]
before: () -> 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. 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. else
"You quickly find the central plaza."
You could ask a policeman #{textlink("for directions.", "mark")} 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: writers:
cyclewriter: (character) -> cycle(this, character) cyclewriter: (character) -> cycle(this, character)
mark: (character) -> mark: (character) ->
@ -60,17 +61,18 @@ room "shop",
room "lair", room "lair",
title: "The 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: """ content: """
The Lair of Yog-Sothoth is a very *n'gai* cave, full of *buggs-shoggogs* and *n'ghaa ng'aa*. The Lair of Yog-Sothoth is a very *n'gai* cave, full of *buggs-shoggogs* and *n'ghaa ng'aa*.
""" """
objects: {
bugg = obj "bugg-shoggog", bugg: obj "bugg",
dsc: "You see a particularly beautiful slimy {{bugg.}}" dsc: "You see a particularly beautiful slimy {{bugg.}}"
takeable: false takeable: false
act: () => act: () =>
here().drop(@name) here().drop(@name)
return "You eat the bugg mass. Delicious and raw." return "You eat the bugg mass. Delicious and raw. Perhaps it's a good lair to live in."
}
dialogue "Yes", "merchant", "merchant", """ dialogue "Yes", "merchant", "merchant", """
Yes. Yes.
@ -93,10 +95,16 @@ room "shop-inside",
return "" 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", lamp = obj "lamp",
dsc: "You see a {{lamp.}}" dsc: "You see a {{lamp.}}"
takeable: true takeable: true
lamp.put("shop-inside") lamp.put("shop-inside")
###
room "merchdialogue", room "merchdialogue",
choices: "#merchant", choices: "#merchant",

View file

@ -4,6 +4,8 @@ Implies that you don't mix up your tabs and spaces.
Copyright 2015 Bruno Dias Copyright 2015 Bruno Dias
### ###
normaliseTabs = (text) -> normaliseTabs = (text) ->
unless text?
return ""
lines = text.split('\n'); lines = text.split('\n');
indents = lines indents = lines
.filter((l) => l != '') .filter((l) => l != '')
@ -23,6 +25,8 @@ normaliseTabs = (text) ->
).join('\n') ).join('\n')
markdown = (text) -> markdown = (text) ->
unless text?
return ""
if typeof text is Function if typeof text is Function
text = text() text = text()
return marked(normaliseTabs(text), { return marked(normaliseTabs(text), {

View file

@ -46,7 +46,7 @@ RaconteurSituation.inherits(undum.Situation)
Undum API. Undum API.
### ###
RaconteurSituation.prototype.act = (character, system, action) => RaconteurSituation.prototype.act = (character, system, action) ->
actionClass = action.match(/^_(\w+)_(.+)$/) actionClass = action.match(/^_(\w+)_(.+)$/)
that = this that = this