Updating readme
This commit is contained in:
@@ -100,12 +100,7 @@ var saveAs=saveAs||navigator.msSaveBlob&&navigator.msSaveBlob.bind(navigator)||f
|
||||
<div id="init-lacking">Your browser lacks required capabilities. Please upgrade it or switch to another to continue.</div>
|
||||
<div id="init-loading"><div>Loading…</div></div>
|
||||
</div>
|
||||
<!-- UUID://BE18C022-A213-466C-8DD1-DCCD5CB1DF48// --><tw-storydata name="At the Duchess's Party" startnode="2" creator="Tweego" creator-version="2.1.0+9ea2fab" ifid="BE18C022-A213-466C-8DD1-DCCD5CB1DF48" zoom="1" format="SugarCube" format-version="2.30.0" options="debug" hidden><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style><script role="script" id="twine-user-script" type="text/twine-javascript">/* twine-user-script #1: "storymanager.js" */
|
||||
|
||||
// Choose one of an array
|
||||
var randomChoice = function(vals) {
|
||||
return vals[Math.floor(Math.random() * vals.length)];
|
||||
};
|
||||
<!-- UUID://BE18C022-A213-466C-8DD1-DCCD5CB1DF48// --><tw-storydata name="At the Duchess's Party" startnode="2" creator="Tweego" creator-version="2.1.0+9ea2fab" ifid="BE18C022-A213-466C-8DD1-DCCD5CB1DF48" zoom="1" format="SugarCube" format-version="2.30.0" options="" hidden><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style><script role="script" id="twine-user-script" type="text/twine-javascript">/* twine-user-script #1: "storymanager.js" */
|
||||
|
||||
// Set up the general narrative manager
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -114,11 +109,17 @@ StoryManager.storylets = {};
|
||||
|
||||
StoryManager.getAllStorylets = function(tag=null) {
|
||||
let allStorylets = [];
|
||||
let storylet, storylets, boundStorylet;
|
||||
for (let key in this.storylets) {
|
||||
let storylet = this.storylets[key];
|
||||
storylet = this.storylets[key];
|
||||
if (tag === null || ("tags" in storylet && storylet.tags.includes(tag))) {
|
||||
let storylets = storylet.generate();
|
||||
for (let i in storylets) allStorylets.push(storylets[i]);
|
||||
// TODO: If using yield, this part will change
|
||||
storylets = storylet.generate();
|
||||
for (let i in storylets) {
|
||||
boundStorylet = storylets[i];
|
||||
if (!("priority" in boundStorylet)) boundStorylet.priority = 0;
|
||||
allStorylets.push(storylets[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return allStorylets;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,51 @@
|
||||
:: StoryTitle
|
||||
Simple Space Example
|
||||
|
||||
:: StoryData
|
||||
{
|
||||
"ifid": "2EE3728E-B079-4539-9A9C-97CD8474B4C5"
|
||||
}
|
||||
|
||||
:: Story JavaScript [script]
|
||||
Config.passages.nobr = true; // No unspecified linebreaks.
|
||||
|
||||
State.variables.locations = ["Earth", "Mars", "Ganymede"];
|
||||
State.variables.currentLocation = "Deep space";
|
||||
|
||||
StoryManager.storylets["Go somewhere"] = {
|
||||
name: "Go somewhere",
|
||||
tags: ["in space"],
|
||||
generate: function() {
|
||||
let storylets = [];
|
||||
for (let loc of State.variables.locations) {
|
||||
if (loc == State.variables.currentLocation) continue;
|
||||
let storylet = {
|
||||
passage: "Orbit", // Name of the passage the storylet links to
|
||||
description: "Jump to " + loc, // Storylet link text
|
||||
planet: loc // Data associated with this storylet
|
||||
};
|
||||
storylets.push(storylet);
|
||||
}
|
||||
return storylets;
|
||||
}
|
||||
}
|
||||
|
||||
:: Start
|
||||
|
||||
You find yourself in $currentLocation. You should probably [[jump | Jump]].
|
||||
|
||||
:: Jump
|
||||
You prep your ship to jump.
|
||||
<<set _possibleStorylets = window.SM.getStorylets()>>
|
||||
<<ShowStoryletLinks _possibleStorylets>>
|
||||
|
||||
:: Orbit
|
||||
<<set $currentLocation = $currentStorylet.planet>>
|
||||
You orbit around $currentLocation.
|
||||
|
||||
[[Explore the surface]] or [[Jump]] somewhere else.
|
||||
|
||||
:: Explore the surface
|
||||
You take your shuttle down to the surface of $currentLocation.
|
||||
|
||||
Return to [[Orbit]]
|
||||
Reference in New Issue
Block a user