1
0
Fork 0
mirror of https://gitlab.com/Oreolek/salet.git synced 2024-07-07 01:04:25 +03:00
salet/game/begin.coffee
Alexander Yakovlev 828962b1ff Documentation and API
Made enter() a redefinable function.
Updated Gulpfile to watch the libs.
Fixed a couple of bugs in Raconteur CoffeeScript port.
2016-01-15 15:10:12 +07:00

53 lines
1.6 KiB
CoffeeScript

markdown = require('../../lib/markdown.coffee')
room = require("../../lib/room.coffee")
obj = require('../../lib/obj.coffee')
dialogue = require('../../lib/dialogue.coffee')
oneOf = require('../../lib/oneOf.coffee')
require('../../lib/interface.coffee')
undum = require('../../lib/undum.js')
undum.game.id = "your-game-id-here"
undum.game.version = "1.0"
###
Element helpers. There is no real need to build monsters like a().id("hello")
because you won't use them as is. It does not make sense in context, the
author has Markdown and all utilities to *forget* about the markup.
###
way_to = (content, ref) ->
return "<a href='#{ref}' class='way'>#{content}</a>"
textlink = (content, ref) ->
return "<a href='./_writer_#{ref}' class='once'>#{content}</a>"
actlink = (content, ref) ->
return "<a href='./#{ref}' class='once'>#{content}</a>"
textcycle = (content, ref) ->
return "<a href='./_replacer_#{ref}' class='cycle' id='#{ref}'>#{content}</a>"
###
This function clears the screen.
The full backlog makes sense in dialogues but it's clunky when you exploring.
So this is manual cls
###
cls = () ->
document.getElementById("intro").innerHTML = ""
document.getElementById("content").innerHTML = ""
# usage: writemd( system, "Text to write")
writemd = (system, text) ->
text = markdown(text)
system.write(text)
# The first room of the game.
# For accessibility reasons the text is provided in HTML, not here.
room "start",
content: """
""",
choices: "#start"
# This function needs to go after the start room.
is_visited = (situation) ->
place = undum.game.situations[situation]
if place
return Boolean place.visited
return 0