salet.game_id = "8b0c371c-57f4-49b3-ae3c-cba07d1a9733" salet.game_version = "1.0" salet.beforeAction = (roomId, actionId) -> verbRe = /verb\_(?:\w+)\_(?:\w+)/ match = verbRe.exec(actionId) if match? and match[1] and match[2] verb = match[1] unit = match[2] salet.view.write(salet.rooms[roomId].units[unit][verb].fcall(salet.rooms[roomId])) return true # consume the action return false $.holdReady( true ) $.getJSON('game/translations/'+i18n.lang+'.json', (data) -> i18n.push(i18n.lang, data) $.holdReady( false ) ) switchTab = (tabid) -> $(".tab").removeClass("active") $("#"+tabid).addClass("active") $(document).ready(() -> window.addEventListener('popstate', (event) -> salet.goBack() ) $("body").on("click", '#night', () -> if (window.night) $("body").removeClass("night") $("#night").removeClass("active") window.night = false else $("body").addClass("night") $("#night").addClass("active") window.night = true ) $("body").on("click", "#storytab", (event) -> event.preventDefault() if not salet.here().canSave salet.goBack() return false ) $("body").on("click", ".tab", (event) -> switchTab(event.target.id) return true ) salet.beginGame() ) updateverb = (unit, verb) -> if unit[verb]? or salet.character.displayAll $("##{verb}list").append("
  • #{unit.display()}
  • ") ### 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 "#{content}" textlink = (content, ref) -> return "#{content}" actlink = (content, ref) -> return "#{content}" sysroom = (name, options) -> options.canSave = false options.enter = () -> $("#inventory").hide() options.exit = () -> salet.view.clearContent('#current-room') $("#inventory").show() options.dsc = () -> return @text.fcall()+"\n\n"+"""
    """ options.actions = { exit: () -> return salet.goBack() } return room(name, options) croom = (name, spec) -> spec.clear ?= true spec.optionColor ?= "" spec.optionText ?= () -> retval = """
    #{spec.title.fcall()}
    """ if (spec.subtitle?) retval += """
    #{spec.subtitle.fcall()}
    """ retval += '
    ' spec.enter = () -> salet.character.update_sidebar() if @onEnter? @onEnter() return room(name, spec) sysroom "inventory", text: () -> if salet.character.inventory.length == 0 text = "You are carrying nothing." else text = "You are carrying:\n\n" for thing in salet.character.inventory text += "* #{salet.character.listinv(thing.name)}\n" sysroom "settings", text: () -> nightclass = "" if window.night nightclass = "active" return "credits".l() + """ """