334 lines
26 KiB
HTML
334 lines
26 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
|
<html xmlns='http://www.w3.org/1999/xhtml'>
|
||
|
<head>
|
||
|
<title>WAH</title>
|
||
|
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
|
||
|
<style type='text/css'>
|
||
|
* {
|
||
|
margin: 0;
|
||
|
padding: 0;
|
||
|
}
|
||
|
|
||
|
body {
|
||
|
font-family: 'dejavu sans', arial, verdana;
|
||
|
font-size: 14px;
|
||
|
color: #000;
|
||
|
background-color: #fff;
|
||
|
}
|
||
|
|
||
|
#wrapper {
|
||
|
width: 80%;
|
||
|
margin: 10% auto 0 auto;
|
||
|
padding: 10px;
|
||
|
background-color: #99ffff;
|
||
|
}
|
||
|
|
||
|
h1 {
|
||
|
font-weight: normal;
|
||
|
font-size: 23px;
|
||
|
}
|
||
|
|
||
|
button {
|
||
|
margin: 5px 10px 5px 0;
|
||
|
}
|
||
|
|
||
|
span {
|
||
|
color: #3344ff;
|
||
|
background-color: #eee;
|
||
|
cursor: pointer;
|
||
|
}
|
||
|
|
||
|
span:hover {
|
||
|
color: #5566ff;
|
||
|
background-color: #fff;
|
||
|
}
|
||
|
|
||
|
hr {
|
||
|
margin: 0 0 5px 0;
|
||
|
border: 1px solid #333;
|
||
|
}
|
||
|
|
||
|
/* Feel free to modify this file without attributing anyone. */
|
||
|
|
||
|
</style>
|
||
|
<script type='text/javascript'>
|
||
|
/*
|
||
|
Template script for movact-convert: a JavaScript movact frontend
|
||
|
Copyright (C) 2009, 2010 Niels Serup
|
||
|
|
||
|
This program is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation, either version 3 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
// Maintained by Niels Serup <ns@metanohi.org>
|
||
|
/**********************************************************************/
|
||
|
|
||
|
function loadMovact() {
|
||
|
meta = {"load": "Choose file: ", "save command": "\/save", "prompt": "Go to: ", "open command": "\/open", "load-gui": "Choose file", "current command": "\/current", "loaded": "Savefile loaded.", "reset button": "Reset", "saved": "Savedata saved to file.", "again": "Try again.", "confirmed": ["y", "yes"], "reset command": "\/reset", "end": "This wonderful story has now come to an end. But do not worry! There are other ends as well.", "opened": "movact file opened.", "title": "WAH", "quit button": "Quit", "open": "Choose file: ", "save-gui": "Choose file", "version": "ZERO", "save": "Choose file: ", "start": "Welcome to WAH...\nAn interactive story featuring non-stop action.", "end-gui": "This wonderful story has now come to an end. But do not worry! There are other ends as well.", "start-gui": "Welcome to WAH...\nAn interactive story featuring non-stop action.", "back button": "Back", "load command": "\/load", "save button": "Save", "load button": "Load", "quit command": "\/quit", "open-gui": "Choose file", "back command": "\/back", "confirm": "Are you sure? (y\/N) ", "confirm-gui": "Are you sure?", "points": [["1. ", "1"], ["2. ", "2"], ["3. ", "3"], ["4. ", "4"], ["5. ", "5"], ["6. ", "6"], ["7. ", "7"], ["8. ", "8"], ["9. ", "9"]], "separator": "**********", "error": "Error.", "load error": "Contents are not savedata.", "open button": "Open"} // JSON meta data from movact-convert goes here
|
||
|
main = {"hell-start": [false, [true, "So, you're in hell. Or..? It seems that hell never existed. You realize that it doesn't even matter. You do not know what to do now."], [true, ""], [true, "If you are not aware of this, you have now ended up at an **open ending**."]], "43": [true, [true, "It seems that your mind has become unstable while you were mentally gone. Now you are only able to 5p34k 1n 1337 -- and 0nly in a v3ry n00b f0rm of 1337."], [true, ""], [true, "u haz n0 idea watz d0. r34l1ty ftw u fink. U 3vntully di54p3ar."], [true, ""], [true, "3 1337 cr4x0rz 4p34r. Tehm tellz u 2go2 1 of tehse pl4ces:"], [false, "heaven-start", "H34\\/3|\|"], [false, "hell-start", "H311"], [false, "limbo-start", "1_1|\\/||}0"]], "41b": [true, [true, "The cats seem to be dancing. They appear to be happy, though you can't even comprehend how they are able to breathe. You realize that it must be because of a source of oxygen."], [true, ""], [true, "You take off your helmet. Then you die."], [true, ""], [true, "Three beings appear. They tell you to go to one of these places:"], [false, "heaven-start", "Heaven"], [false, "hell-start", "Hell"], [false, "limbo-start", "Limbo"]], "24": [true, [true, "You are killed by an alien. Three beings approach you. They tell you to go to one of these places:"], [false, "heaven-start", "Heaven"], [false, "hell-start", "Hell"], [false, "limbo-start", "Limbo (somewhere in the middle)"]], "25": [true, [true, "Your mind wanders. This is, after all, the moon, somewhere only a few humans has been. You are taken back by the thought."], [false, "23", "Explore the moon."], [false, "24", "Think."]], "20": [true, [true, "You fall asleep."], [false, "36", "Sleep for a week."], [false, "37", "Sleep for a month."]], "21": [true, [true, "You look out a window. Noting the sky, you realize that this airport is strange. It's as if the airport is.. closed. The sky is blue and pretty, but there are no planes. There is nothing. When you think about it, currently you're actually doing something. You promised yourself to relax. Do you want to reconsider your choice?"], [false, "38", "Yes"], [false, "36", "No"]], "22": [true, [true, "You don't know what to do. However, to do something, you do not need to know what to do. You can just do something at random. And that is excactly what you do. A completely randomized act chosen by a random algorithm that randomly selects a number."], [true, ""], [true, "You jump."], [true, ""], [true, "Reflecting upon your action, nothing happens. The airport is completely empty. Suddenly it's just a big white space. You wonder why that is, considering the fact that just a while ago, everything was normal."], [true, "So, what to do?"], [false, "39", "Jump again."], [false, "40", "Run\/walk."]], "23": [true, [true, "You start exploring the moon. A lot of craters appear before you. One of the craters seems different."], [false, "41", "Examine it."], [false, "42", "Keep walking."]], "46": [true, [true, "It's like a western. You're the bad guy who robs banks as a hobby. With a gun in your right hand, you enter what you believe to be a bank. It is, however, a prison. You are arrested."], [false, "47", "Plead for forgiveness"], [false, "start", "Travel back in time"]], "47": [true, [true, "They don't care. You are put into a magical cell that automatically makes its prisoners vanish within a day or so. When you're gone, three beings approach you. They tell you to go to one of these places:"], [false, "heaven-start", "Heaven"], [false, "hell-start", "Hell"], [false, "limbo-start", "Limbo"]], "44": [true, [true, "The old man greets you. He telkjdndxdjuddchjudjcJJhzfjudfxjJJ"], [true, "JJJHYUjdjjfimrrj8iie4jjdu5mikdr5ieo4krk-asg:"], [false, "heaven-start", "Heaven"], [false, "hell-start", "Hell"], [false, "limbo-start", "Limbo"]], "45": [true, [true, "You're still not really sure what to do.."], [false, "44", "Go back."], [true, ""], [true, "But still, it would embarass you to go back.."], [false, "45", "Keep on walking."]], "42": [true, [true, "You walk on. It's funny how the surface of the moon do
|
||
|
|
||
|
// Create core elements
|
||
|
wrapper = document.getElementById('wrapper')
|
||
|
dyn = document.createElement('div')
|
||
|
wrapper.appendChild(dyn)
|
||
|
|
||
|
visitedParts = []
|
||
|
partName = 'start'
|
||
|
storyDone = false
|
||
|
cookieJustSat = false
|
||
|
|
||
|
if (autoload())
|
||
|
start()
|
||
|
else
|
||
|
appendLinkingText(meta.title, 'start', start)
|
||
|
// At this point the game will start when the user clicks on the element
|
||
|
}
|
||
|
|
||
|
function start() {
|
||
|
header = document.createElement('h1')
|
||
|
button_back = document.createElement('button')
|
||
|
button_back.appendChild(createText(meta['back button']))
|
||
|
button_back.onclick = function() {
|
||
|
back()
|
||
|
}
|
||
|
button_reset = document.createElement('button')
|
||
|
button_reset.appendChild(createText(meta['reset button']))
|
||
|
button_reset.onclick = function() {
|
||
|
reset()
|
||
|
}
|
||
|
|
||
|
// Remove stupid elements
|
||
|
while (wrapper.childNodes.length > 1) {
|
||
|
if (wrapper.firstChild != dyn)
|
||
|
wrapper.removeChild(wrapper.firstChild)
|
||
|
}
|
||
|
|
||
|
// Insert smart elements
|
||
|
wrapper.insertBefore(header, dyn)
|
||
|
wrapper.insertBefore(button_back, dyn)
|
||
|
wrapper.insertBefore(button_reset, dyn)
|
||
|
wrapper.insertBefore(separator(), dyn)
|
||
|
|
||
|
///////////\ /
|
||
|
run() //// \/
|
||
|
}
|
||
|
|
||
|
function separator() {
|
||
|
return document.createElement('hr')
|
||
|
}
|
||
|
|
||
|
function popParts() {
|
||
|
// Remove last element
|
||
|
var vpn = []
|
||
|
for (var i = 0; i < visitedParts.length-1; i++) {
|
||
|
vpn[i] = visitedParts[i]
|
||
|
}
|
||
|
visitedParts = vpn
|
||
|
}
|
||
|
|
||
|
function back() {
|
||
|
if (visitedParts.length > 1) {
|
||
|
popParts()
|
||
|
partName = visitedParts[visitedParts.length-1]
|
||
|
popParts()
|
||
|
run()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function reset() {
|
||
|
if (storyDone || confirm(meta['confirm-gui'])) {
|
||
|
partName = visitedParts[0]
|
||
|
visitedParts = []
|
||
|
clearCookie()
|
||
|
cookieJustSat = true
|
||
|
run()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function removeChilds(elem) {
|
||
|
while (dyn.childNodes.length > 0) {
|
||
|
dyn.removeChild(dyn.firstChild)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function createParagraph() {
|
||
|
return document.createElement('p')
|
||
|
}
|
||
|
|
||
|
function createText(text) {
|
||
|
return document.createTextNode(text)
|
||
|
}
|
||
|
|
||
|
function appendStaticText(text) {
|
||
|
var elem = createParagraph()
|
||
|
elem.innerHTML = text
|
||
|
dyn.appendChild(elem)
|
||
|
}
|
||
|
|
||
|
function appendLinkingText(text, reference, func) {
|
||
|
var elem = createParagraph()
|
||
|
var span = document.createElement('span')
|
||
|
span.reference = reference
|
||
|
if (func == undefined)
|
||
|
var func = goTo
|
||
|
span.onclick = function() {
|
||
|
func(this.reference)
|
||
|
}
|
||
|
elem.appendChild(span)
|
||
|
span.innerHTML = text
|
||
|
dyn.appendChild(elem)
|
||
|
}
|
||
|
|
||
|
function goTo(part_name) {
|
||
|
partName = part_name
|
||
|
run()
|
||
|
}
|
||
|
|
||
|
function run() {
|
||
|
var part, refsNum, text, i, p
|
||
|
removeChilds()
|
||
|
part = main[partName]
|
||
|
|
||
|
text = meta.title + ' ["' + partName + '"] (' + visitedParts.length + ')'
|
||
|
header.innerHTML = text
|
||
|
document.title = text
|
||
|
|
||
|
refsNum = 0
|
||
|
text = ''
|
||
|
for (var i = 1; i < part.length; i++) {
|
||
|
x = part[i]
|
||
|
if (x[0]) {
|
||
|
var txt = x[1]
|
||
|
if (txt == '')
|
||
|
txt = ' '
|
||
|
appendStaticText(txt)
|
||
|
}
|
||
|
else {
|
||
|
p = self.meta.points[refsNum]
|
||
|
appendLinkingText(p[0] + x[2], x[1])
|
||
|
refsNum += 1
|
||
|
}
|
||
|
}
|
||
|
|
||
|
storyDone = false
|
||
|
if (!part[0]) {
|
||
|
dyn.appendChild(separator())
|
||
|
appendStaticText(meta.end)
|
||
|
storyDone = true
|
||
|
}
|
||
|
|
||
|
if (visitedParts.length == 0) {
|
||
|
button_back.disabled = 'disabled'
|
||
|
button_reset.disabled = 'disabled'
|
||
|
}
|
||
|
else {
|
||
|
button_back.disabled = ''
|
||
|
button_reset.disabled = ''
|
||
|
}
|
||
|
|
||
|
visitedParts[visitedParts.length] = partName
|
||
|
if (!cookieJustSat)
|
||
|
autosave()
|
||
|
else
|
||
|
cookieJustSat = false
|
||
|
}
|
||
|
|
||
|
function setCookie(value, ms) {
|
||
|
try {
|
||
|
if (ms == undefined)
|
||
|
var ms = 63936000000 // In 740 days (a little over 2 years)
|
||
|
var date = new Date()
|
||
|
date.setTime(date.getTime()+ms)
|
||
|
date = date.toGMTString()
|
||
|
document.cookie = "movact_auto_save="+value+"; expires="+date+"; path=/"
|
||
|
} catch (e) {}
|
||
|
}
|
||
|
|
||
|
function clearCookie() {
|
||
|
setCookie('', -1468800000) // Deleted 17 days ago
|
||
|
}
|
||
|
|
||
|
function getCookie() {
|
||
|
try {
|
||
|
var name = "movact_auto_save="
|
||
|
var spl = document.cookie.split(';')
|
||
|
for (var i = 0; i < spl.length; i++) {
|
||
|
var current = spl[i]
|
||
|
while (current.charAt(0) == ' ')
|
||
|
current = current.substring(1)
|
||
|
if (current.indexOf(name) == 0)
|
||
|
return current.substring(name.length)
|
||
|
}
|
||
|
// Else:
|
||
|
return false
|
||
|
} catch (e) {
|
||
|
return false
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function autoload() {
|
||
|
var savedata = unescape(getCookie())
|
||
|
if (savedata) {
|
||
|
try {
|
||
|
eval("var vp = " + savedata)
|
||
|
var pn = vp[vp.length-1]
|
||
|
if (main[pn] == undefined)
|
||
|
return
|
||
|
|
||
|
visitedParts = vp
|
||
|
partName = pn
|
||
|
popParts()
|
||
|
return true
|
||
|
}
|
||
|
catch(e) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
// Else:
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
function autosave() {
|
||
|
// Transform visitedParts into a string that can be eval'd when loading it
|
||
|
var arrStr, tStr
|
||
|
arrStr = ''
|
||
|
for (x in visitedParts) {
|
||
|
tStr = visitedParts[x]
|
||
|
tStr = tStr.replace(/\'/g, "\\'")
|
||
|
arrStr += ",'" + tStr + "'"
|
||
|
}
|
||
|
arrStr = '[' + arrStr.substring(1) + ']'
|
||
|
setCookie(escape(arrStr))
|
||
|
}
|
||
|
|
||
|
////////////////////////////////////////////////////////////////////////
|
||
|
// Initialize data and start function chain
|
||
|
window.onload = function() {
|
||
|
loadMovact()
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<div id='wrapper'>
|
||
|
<h1>WAH</h1>
|
||
|
<p>Welcome to WAH...
|
||
|
An interactive story featuring non-stop action.</p>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|
||
|
<!--This was created using movact, a free hypertext fiction runner/converter.-->
|
||
|
<!--See http://metanohi.org/projects/movact/ for downloads and documentation.-->
|
||
|
<!-- Feel free to modify this HTML markup without attributing anyone. -->
|