First tilde projects commit

This commit is contained in:
RussellChamp committed 2015-01-02 16:59:08 +00:00
1 parent 9bcadfc4a7
commit 726861fae6
40 files changed
+20890

No files matched your search

+185
View File
@@ -0,0 +1,185 @@
:: Start
[[Start Adventure|krowbar-start]]
Visited <<print visited("Start")>> times.
<<set $items = {} >>
<<set $events = {} >>
<<set $stats = {} >>
<<set $stats['health'] to 10 >>
<<set $stats['health_max'] to 10 >>
<<set $stats['mana'] to 5 >>
<<set $stats['mana_max'] to 5 >>
<<set $stats['intelligence'] to 3 >>
<<set $stats['strength'] to 1 >>
<<set $skills = {} >>
<<set $skills['adventuring'] = 2 >>
<<set $items['gold'] to 0 >>
:: krowbar-start [start inv]
<<if visited("krowbar-start") is 1>>Welcome to the adventure!<<endif>>
There is a door on the wall.
<<if not visited("Get McGuffin")>>You see a McGuffin<<endif>>
<<if not visited("Get Coins")>>You see a few coins on the floor<<endif>>
<<actions "Get McGuffin" "Get Coins">>\
<<if $items['McGuffin'] is true>><<actions "Use McGuffin on door">><<endif>>\
<<if visited("Use McGuffin on door")>>[[Go through door|Room2]]<<endif>>
[[PlayerProfile]]
<<display "INVALID">>
:: Get McGuffin
You pick up the McGuffin.
<<set $items['McGuffin'] to true>>
[[Return|previous()]]
:: Get Coins
You pick up the coins.
<<set $items['gold'] += 3>>
[[Return|previous()]]
:: Use McGuffin on door
You use the McGuffin on the door.
The McGuffin crumbles and the door opens.
<<set $items['McGuffin'] to false>>
[[Return|previous()]]
:: Room2 [inv]
This is room2. There is a cake on the ground.
The door ahead is blocked.
<<actions "Eat cake">>
<<if $stats['strength'] gte 3>>[[Break through the door|Room3]]
<<else>>You are not strong enough to break this door.<<endif>>
::Eat cake
You feel incredibly stronger!
Strength increased to <<$stats['strength'] += 3>>
[[Return|previous()]]
:: Room3 [inv]
Seriously, nothing here.
:: Inventory
<br>
<strong>Inventory:</strong>
<<Inventory>>
:: ShowInventory [script]
try {
version.extensions['Inventory'] = {
major:0, minor:1, revision:0
};
macros['Inventory'] =
{
handler: function(place, macroName, params, parser)
{
var msg = "";
var items = state.history[0].variables.items;
if (items == undefined) {
new Wikifier(place, "nothing");
return;
}
for(var name in items) {
if(!isNaN(parseFloat(items[name])) && isFinite(items[name])) {
msg += name + "(" + items[name] + "), ";
}
else if(items[name] != false) {
msg += name + ", ";
}
};
new Wikifier(place, msg.slice(0,-2));
},
init: function() { },
};
} catch(e) {
throwError(place,"Inventory Setup Error: " + e.message);
}
:: PlayerStats
<br>
<strong>Player Stats:</strong>
<<PlayerStats>>
:: ShowPlayerStats [script]
try {
version.extensions['PlayerStats'] = {
major:0, minor:1, revision:0
};
macros['PlayerStats'] =
{
handler: function(place, macroName, params, parser)
{
var msg = "";
var stats = state.history[0].variables.stats;
if (stats == undefined) {
new Wikifier(place, "no stats");
return;
}
for(var stat in stats) {
if(stat.slice(-4) == "_max") {
continue;
}
msg += stat + ": " + stats[stat];
if(stats[stat+"_max"] != undefined) {
msg += " / " + stats[stat+"_max"];
}
msg += "<br>";
}
new Wikifier(place, msg);
},
init: function() { },
};
} catch(e) {
throwError(place,"PlayerStats Setup Error: " + e.message);
}
:: PlayerSkills
<br>
<strong>Player Skills:</strong>
<<PlayerSkills>>
:: ShowPlayerSkills [script]
try {
version.extensions['PlayerSkills'] = {
major:0, minor:1, revision:0
};
macros['PlayerSkills'] =
{
handler: function(place, macroName, params, parser)
{
var msg = "";
var stats = state.history[0].variables.skills;
if (stats == undefined) {
new Wikifier(place, "no skills");
return;
}
for(var stat in stats) {
msg += stat + ": " + stats[stat]+"<br>";
}
new Wikifier(place, msg);
},
init: function() { },
};
} catch(e) {
throwError(place,"PlayerSkills Setup Error: " + e.message);
}
:: PlayerProfile
[[Return|previous()]]
-~-~-~-~-~-
<<display PlayerStats>>
<<display PlayerSkills>>
<<display Inventory>>
:: postrender [script]
postrender.tagInventory = function(place) {
var inv = tale.get("Inventory");
if (inv.id !== undefined && ~this.tags.indexOf("inv")) {
new Wikifier(place, inv.processText());
};
var stats = tale.get("PlayerStats");
if(stats.id !== undefined && ~this.tags.indexOf("stats")) {
new Wikifier(place, stats.processText());
};
var skills = tale.get("PlayerSkills");
if(skills.id !== undefined && ~this.tags.indexOf("skills")) {
new Wikifier(place, skills.processText());
};
}
+174
View File
@@ -0,0 +1,174 @@
:: Start
[[Start Adventure|krowbar-start]]
<<set $items = {} >>
<<set $events = {} >>
<<set $stats = {} >>
<<set $stats['health'] to 10 >>
<<set $stats['health_max'] to 10 >>
<<set $stats['mana'] to 5 >>
<<set $stats['mana_max'] to 5 >>
<<set $stats['intelligence'] to 3 >>
<<set $skills = {} >>
<<set $skills['adventuring'] = 2 >>
<<set $items['gold'] to 0 >>
:: krowbar-start [start inv stats skills]
<<if visited("krowbar-start") is 1>>Welcome to the adventure!<<endif>>
There is a door on the wall.
<<if not visited("Get McGuffin")>>You see a McGuffin<<endif>>
<<if not visited("Get Coins")>>You see a few coins on the floor<<endif>>
<<actions "Get McGuffin" "Get Coins">>\
<<if $items['McGuffin'] is true>><<actions "Use McGuffin on door">><<endif>>\
<<if visited("Use McGuffin on door")>>[[Go through door|Room2]]<<endif>>
[[PlayerProfile]]
:: Get McGuffin
You pick up the McGuffin.
<<set $items['McGuffin'] to true>>
[[Return|previous()]]
:: Get Coins
You pick up the coins.
<<set $items['gold'] += 3>>
[[Return|previous()]]
:: Use McGuffin on door
You use the McGuffin on the door.
The McGuffin crumbles and the door opens.
<<set $items['McGuffin'] to false>>
[[Return|previous()]]
:: Room2 [inv]
This is room2. There is nothing here.
[[Go to room3|Room3]]
:: Room3 [inv]
Seriously, nothing here.
:: Inventory
<br>
<strong>Inventory:</strong>
<<Inventory>>
:: ShowInventory [script]
try {
version.extensions['Inventory'] = {
major:0, minor:1, revision:0
};
macros['Inventory'] =
{
handler: function(place, macroName, params, parser)
{
var msg = "";
var items = state.history[0].variables.items;
if (items == undefined) {
new Wikifier(place, "nothing");
return;
}
for(var name in items) {
if(!isNaN(parseFloat(items[name])) && isFinite(items[name])) {
msg += name + "(" + items[name] + "), ";
}
else if(items[name] != false) {
msg += name + ", ";
}
};
new Wikifier(place, msg.slice(0,-2));
},
init: function() { },
};
} catch(e) {
throwError(place,"Inventory Setup Error: " + e.message);
}
:: PlayerStats
<br>
<strong>Player Stats:</strong>
<<PlayerStats>>
:: ShowPlayerStats [script]
try {
version.extensions['PlayerStats'] = {
major:0, minor:1, revision:0
};
macros['PlayerStats'] =
{
handler: function(place, macroName, params, parser)
{
var msg = "";
var stats = state.history[0].variables.stats;
if (stats == undefined) {
new Wikifier(place, "no stats");
return;
}
for(var stat in stats) {
if(stat.slice(-4) == "_max") {
continue;
}
msg += stat + ": " + stats[stat];
if(stats[stat+"_max"] != undefined) {
msg += " / " + stats[stat+"_max"];
}
msg += "<br>";
}
new Wikifier(place, msg);
},
init: function() { },
};
} catch(e) {
throwError(place,"PlayerStats Setup Error: " + e.message);
}
:: PlayerSkills
<br>
<strong>Player Skills:</strong>
<<PlayerSkills>>
:: ShowPlayerSkills [script]
try {
version.extensions['PlayerSkills'] = {
major:0, minor:1, revision:0
};
macros['PlayerSkills'] =
{
handler: function(place, macroName, params, parser)
{
var msg = "";
var stats = state.history[0].variables.skills;
if (stats == undefined) {
new Wikifier(place, "no skills");
return;
}
for(var stat in stats) {
msg += stat + ": " + stats[stat]+"<br>";
}
new Wikifier(place, msg);
},
init: function() { },
};
} catch(e) {
throwError(place,"PlayerSkills Setup Error: " + e.message);
}
:: PlayerProfile
[[Return|previous()]]
-~-~-~-~-~-
<<display PlayerStats>>
<<display PlayerSkills>>
<<display Inventory>>
:: postrender [script]
postrender.tagInventory = function(place) {
var inv = tale.get("Inventory");
if (inv.id !== undefined && ~this.tags.indexOf("inv")) {
new Wikifier(place, inv.processText());
};
var stats = tale.get("PlayerStats");
if(stats.id !== undefined && ~this.tags.indexOf("stats")) {
new Wikifier(place, stats.processText());
};
var skills = tale.get("PlayerSkills");
if(skills.id !== undefined && ~this.tags.indexOf("skills")) {
new Wikifier(place, skills.processText());
};
}
+194
View File
@@ -0,0 +1,194 @@
:: Start
[[krowbar-start]]
:: Set Globals [script]
try {
macros['SetGlobals'] =
{
handler: function(place, macroName, params, parser)
{
},
var gVars = state.history[0].variables;
gVars.items = {};
gVars.items['gold'] = 0;
gVars.events = {};
gVars.stats = {};
gVars.stats['health'] = 10;
gVars.stats['health_max'] = 10;
gVars.stats['strength'] = 1;
gVars.skills = {};
gVars.skills['adventuring'] = 2;
} catch(e) {
console.log("Error during Globals setup: " + e.message);
}
:: krowbar-start [start inv]
<<if visited("krowbar-start") is 1>>Welcome to the adventure!<<endif>>
There is a door on the wall.
<<if not visited("Get McGuffin")>>You see a McGuffin<<endif>>
<<if not visited("Get Coins")>>You see a few coins on the floor<<endif>>
<<actions "Get McGuffin" "Get Coins">>\
<<if $items['McGuffin'] is true>><<actions "Use McGuffin on door">><<endif>>\
<<if visited("Use McGuffin on door")>>[[Go through door|Room2]]<<endif>>
[[PlayerProfile]]
:: Get McGuffin
You pick up the McGuffin.
<<set $items['McGuffin'] to true>>
[[Return|previous()]]
:: Get Coins
You pick up the coins.
<<set $items['gold'] += 3>>
[[Return|previous()]]
:: Use McGuffin on door
You use the McGuffin on the door.
The McGuffin crumbles and the door opens.
<<set $items['McGuffin'] to false>>
[[Return|previous()]]
:: Room2 [inv]
This is room2. There is a cake on the ground.
The door ahead is blocked.
<<actions "Eat cake">>
<<if $stats['strength'] gte 3>>[[Break through the door|Room3]]
<<else>>You are not strong enough to break this door.<<endif>>
::Eat cake
You feel incredibly stronger!
Strength increased to <<$stats['strength'] += 3>>
[[Return|previous()]]
:: Room3 [inv]
Seriously, nothing here.
Return to [[the start|Start]]
:: Inventory
<br>
<strong>Inventory:</strong>
<<Inventory>>
:: ShowInventory [script]
try {
version.extensions['Inventory'] = {
major:0, minor:1, revision:0
};
macros['Inventory'] =
{
handler: function(place, macroName, params, parser)
{
var msg = "";
var items = state.history[0].variables.items;
if (items == undefined) {
new Wikifier(place, "nothing");
return;
}
for(var name in items) {
if(!isNaN(parseFloat(items[name])) && isFinite(items[name])) {
msg += name + "(" + items[name] + "), ";
}
else if(items[name] != false) {
msg += name + ", ";
}
};
new Wikifier(place, msg.slice(0,-2));
},
init: function() { },
};
} catch(e) {
throwError(place,"Inventory Setup Error: " + e.message);
}
:: PlayerStats
<br>
<strong>Player Stats:</strong>
<<PlayerStats>>
:: ShowPlayerStats [script]
try {
version.extensions['PlayerStats'] = {
major:0, minor:1, revision:0
};
macros['PlayerStats'] =
{
handler: function(place, macroName, params, parser)
{
var msg = "";
var stats = state.history[0].variables.stats;
if (stats == undefined) {
new Wikifier(place, "no stats");
return;
}
for(var stat in stats) {
if(stat.slice(-4) == "_max") {
continue;
}
msg += stat + ": " + stats[stat];
if(stats[stat+"_max"] != undefined) {
msg += " / " + stats[stat+"_max"];
}
msg += "<br>";
}
new Wikifier(place, msg);
},
init: function() { },
};
} catch(e) {
throwError(place,"PlayerStats Setup Error: " + e.message);
}
:: PlayerSkills
<br>
<strong>Player Skills:</strong>
<<PlayerSkills>>
:: ShowPlayerSkills [script]
try {
version.extensions['PlayerSkills'] = {
major:0, minor:1, revision:0
};
macros['PlayerSkills'] =
{
handler: function(place, macroName, params, parser)
{
var msg = "";
var stats = state.history[0].variables.skills;
if (stats == undefined) {
new Wikifier(place, "no skills");
return;
}
for(var stat in stats) {
msg += stat + ": " + stats[stat]+"<br>";
}
new Wikifier(place, msg);
},
init: function() { },
};
} catch(e) {
throwError(place,"PlayerSkills Setup Error: " + e.message);
}
:: PlayerProfile
[[Return|previous()]]
-~-~-~-~-~-
<<display PlayerStats>>
<<display PlayerSkills>>
<<display Inventory>>
:: postrender [script]
postrender.tagInventory = function(place) {
var inv = tale.get("Inventory");
if (inv.id !== undefined && ~this.tags.indexOf("inv")) {
new Wikifier(place, inv.processText());
};
var stats = tale.get("PlayerStats");
if(stats.id !== undefined && ~this.tags.indexOf("stats")) {
new Wikifier(place, stats.processText());
};
var skills = tale.get("PlayerSkills");
if(skills.id !== undefined && ~this.tags.indexOf("skills")) {
new Wikifier(place, skills.processText());
};
}
+45
View File
@@ -0,0 +1,45 @@
:: Start
<<display "krowbar-start">>
:: krowbar-start [start]
<<set $items = {} >>
<<set $items['gold'] to 5 >>
Here is the start page.
There is a door on the wall.
<<display "item_mcguffin">>
<<if visited("Get McGuffin") and $state_startDoor_isOpen neq true>>
<<actions "Use McGuffin on door">>
<<endif>>
<<if $state_startDoor_isOpen is true>>
[[Go through door|Room2]]
<<endif>>
<<display "Inventory">>
:: item_mcguffin
<<if not visited("Get McGuffin") >>
You see a McGuffin.
<<actions "Get McGuffin">>
<<endif>>
:: Get McGuffin
You pick up the McGuffin.
[[Return|previous()]]
:: Use McGuffin on door
You use the McGuffin on the door.
The McGuffin crumbles and the door opens.
<<set $state_startDoor_isOpen to true>>
[[Return|Start]]
[[Go through door|Room2]]
:: Room2
This is room2. There is nothing here.
[[Go back to the start|Start]]
:: Inventory
Inventory:
<<print $items['gold'] + " gold">>
<<if visited("Get McGuffin")>>
<<print "McGuffin">>
<<endif>>
+36
View File
@@ -0,0 +1,36 @@
Here are some of my thoughts on our Twine story guidelines
## The Player ##
* Should have global objects for $items, $events, $stats, and $skills that any
story could modify
## Player Inventory ##
* Global inventory items should be of the form
* Per-story inventory items should be of the form
* To pick up an item, use the <<action "Get {item}">>
* To check if a player has already retrieved an item, either check the
* $items['NAME'] value or check "visited("Get NAME")"
* An item can be added to the global items hash with the following
$items['NAME'] = VALUE
* A unique item, like "gearbox" or "sword", will have VALUE of true
* When a unique items is used up or destroyed, set its value to false
* Generic items that the player can have many of, like "gold" or "smallKey",
will have a numerical value
## Player Stats and Skills ##
* Are persistant between stories
* Are stored as
$stat.{name} = {value}
$skill.{name} = {value}
## The Hub ##
* Should heal the player
* Should be able to tell the player their stats/skills
## Rules for all stories ##
* All stories should have a path that leads back to the hub
* Stories can NOT kill the player
** Alternately, we could allow player death to 'port them to the Hub
* Stories should not cause the player to lose or use up global objects
** An exception to this could be gold or money
* Should not decrease a stat or skill