"use strict" let audioContext; const version = "pre-alpha"; let state = { player: { items: { keys: [ ] }, rooms: { } } } function print(lines) { (lines.concat([String.fromCharCode(160)])).forEach(line => { const log = document.querySelector("#log"); const div = document.createElement("div"); div.textContent = line; log.appendChild(div); }); log.scrollTop = log.scrollHeight; } function refresh() { updateRoom(state); updateWorldInfo(state); updatePlayerInfo(state); } // set up the game function init(story) { initWorld(story, state); initAudio(story, state); initGame(story, state); goToRoom("Home", state); } // set up the load screen function initStart() { const versionFields = document.querySelectorAll(".version"); const select = document.querySelector("#game-select"); const options = {}; versionFields.forEach(field => { field.textContent = "Version: " + version; }); stories.forEach(story => { const option = document.createElement("option"); option.value = story.id; option.textContent = story.name; select.appendChild(option); options[story.id] = story; }) const start = document.querySelector("#start-button"); start.addEventListener("click", (event) => { init(options[select.value]); document.querySelector("#pick").classList.remove("scene"); document.querySelector("#pick").classList.add("hidden-scene"); document.querySelector("#game").classList.remove("hidden-scene"); document.querySelector("#game").classList.add("scene"); }); } window.addEventListener("load", initStart);