Changes to twine files

This commit is contained in:
Russell 2015-01-06 18:33:01 +00:00
parent 726861fae6
commit c4d80f0038
4 changed files with 207 additions and 8 deletions

5
ttitt/items.twee Normal file
View File

@ -0,0 +1,5 @@
:: cleaver-itemDescription [item]
This is a rusty old cleaver. It won't help you in a fight, but it could be useful
:: crowbar-itemDescription [item]
It feels like this crowbar has a history behind it...

View File

@ -1,5 +1,75 @@
:: krowbar-init [init]
<<set $items['crowbar'] to true>>
<<set $skills['adventuring'] to 1>>
:: krowbar-startDescription
Set in the wall, you see a large portal, twice your height, shining with a malevolent, pulsating, purple glow.
Despite its omnious aura, you feel a strange impulse that compels you to [[enter the portal|krowbar-start]].
:: krowbar-start [start inv]
<<Init>>
[[The Portal|krowbar-ExaminePortal]] you stepped through is in a forest of [[tropical trees|krowbar-ExamineTrees]].
The heat and humidity hit you in contrast to the cool, dry environment of the Hub.
As you listen, you hear the sounds of gunfire and muffled explosions in the distance.
There is [[a dirt path leading downward|krowbar-FollowPath1]].
<<if $events["krowbar-PortalRestored"]>>[[Enter the portal|Start]]<<endif>>
[[Player Profile|PlayerProfile]]
:: krowbar-ExaminePortal
<<if $events["krowbar-PortalRestored"]>>The portal is now the same purple color as when you first entered
<<else>>You examine the portal and note that it has lost the swirling purple luster that it had when you first came through.
<<endif>>
[[Return|previous()]]
:: krowbar-ExamineTrees
Upon closer examination, you find that these trees have strange orange bark and blue-tinted leaves.
You also notice small burn pock-marks on several of the trees.
How curious!
[[Return|previous()]]
:: krowbar-FollowPath1 [inv]
You are on a dirt path on a hill.
[[The path up|krowbar-start]] leads to the Portal.
The path [[continues downward|krowbar-FollowPath2]].
<<if not visited("krowbar-PressButton")>>You see a button on the ground
[[Press Button|krowbar-PressButton]]<<endif>>
:: krowbar-PressButton
After you press the button, you hear a 'click' and feel a thrum in the air.
[[Return|previous()]]
<<set $events["krowbar-PortalRestored"] to true>>
:: krowbar-FollowPath2 [inv]
You find yourself in a small clearing. In the center, you see [[a small, thatched-roof cottage|krowbar-EnterCottage]].
You see three dirt paths. One [[leads upwards|krowbar-FollowPath1]], one leads [[toward a lake|krowbar-FollowPath3]], and one leads [[toward rubble|krowbar-FollowPath4]]
[[Examine cottage|krowbar-ExamineCottage]]
:: krowbar-ExamineCottage
This cottage appears to be made from the native trees.
[[Enter cottage|krowbar-EnterCottage]]
[[Return|previous()]]
:: krowbar-EnterCottage [inv]
There is a thick layer of dust on everything within the cottage. Very little light is able to make its way inward.
<<if not visited("krowbar-CottageOpenWindows")>>The [[wooded window blinds|krowbar-CottageOpenWindows]] are closed.
<<else>>The windows are now letting in enough light to let you see [[some cubbards|krowbar-CottageSearchCubbards]].
<<endif>>
[[Leave cottage|krowbar-FollowPath2]]
:: krowbar-CottageOpenWindows
After a few moments of effort, you manage to yank open the old blinds.
[[Return|previous()]]
:: krowbar-CottageSearchCubbards
<<if visited("krowbar-CottageSearchCubbards") lte 1>>
After rummaging around the cubbards, you find a rusty cleaver and <<$krowbar_temp1 to random(2,5)>> coins.
[[Return|previous()]]
<<set $items['cleaver'] to true>>
<<set $items['gold'] += $krowbar_temp1>>
<<else>>You don't find anything else of value in the cubbards.
[[Return|previous()]]
<<endif>>
:: oldstart
<<if visited("krowbar-start") is 1>>Welcome to the adventure!<<endif>>
There is a sealed door on the wall.
<<if not visited("Get McGuffin")>>You see a McGuffin<br><<endif>>\

View File

@ -20,10 +20,20 @@ try {
}
for(var name in items) {
if(!isNaN(parseFloat(items[name])) && isFinite(items[name])) {
msg += name + "(" + items[name] + "), ";
if(tale.passages[name+"-itemDescription"]) {
msg += "[["+name+"|"+name+"-itemDescription]](" + items[name] + "), ";
}
else {
msg += name + "(" + items[name] + "), ";
}
}
else if(items[name] != false) {
msg += name + ", ";
if(tale.passages[name+"-itemDescription"]) {
msg += "[["+name+"|"+name+"-itemDescription]], ";
}
else {
msg += name + ", ";
}
}
};
new Wikifier(place, msg.slice(0,-2));
@ -103,8 +113,35 @@ try {
throwError(place,"PlayerSkills Setup Error: " + e.message);
}
:: GetPreviousNonItem [script]
try {
version.extensions['PreviousNonItem'] = {
major:0, minor:1, revision:0
};
macros['PreviousNonItem'] =
{
handler: function(place, macroName, params, parser)
{
var msg = "";
for(var h in state.history) {
if(state.history[h].passage.title == "PlayerProfile" ||
state.history[h].passage.title.slice(-16) == "-itemDescription")
continue; //skip all the inventory items
msg += state.history[h].passage.title;
break; //we only want the first instance of a non-item passage
}
new Wikifier(place, "[[Return|" + msg + "]]");
},
init: function() { },
};
} catch(e) {
throwError(place,"PreviousNonItem Setup Error: " + e.message);
}
:: PlayerProfile
[[Return|previous()]]
<<PreviousNonItem>>
-~-~-~-~-~-
<<display PlayerStats>>
<<display PlayerSkills>>
@ -124,6 +161,9 @@ postrender.tagInventory = function(place) {
if(skills.id !== undefined && ~this.tags.indexOf("skills")) {
new Wikifier(place, skills.processText());
};
if(~this.tags.indexOf("item")) {
new Wikifier(place, "\n[[Return|previous()]]");
};
}
:: core-init
@ -135,10 +175,7 @@ postrender.tagInventory = function(place) {
<<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 >>
<<endnobr>>
@ -152,10 +189,13 @@ try {
handler: function(place, macroName, params, parser)
{
var msg = "<<nobr>><<if visited(passage()) eq 1>>";
msg += "<<display \"core-init\">>"; //manually add core-init first
console.log("Initializing core-init");
for(var p in tale.passages) {
/%if(~tale.passages[p].tags.indexOf("init")) {%/
if(p.slice(-5) == "-init") {
if(p.slice(-5) == "-init" && p != "core-init") {
msg += "<<display \"" + p + "\">>";
console.log("Initializing " + p);
}
}
msg += "<<endif>><<endnobr>>";

84
ttitt/twineGuidelines.txt Normal file
View File

@ -0,0 +1,84 @@
Tilde.town shared Twine story guidelines
Written by ~krowbar, managed by ~jumblesale
## Reserved Passages ##
* These passages are reserved for use by the core shared system
:: Start - Acts as the core hub
:: core-init - Initializes core variables
:: GetInit - Provides the <<Init>> macro used by core
:: Inventory - Displays the player inventory
:: ShowInventory - Provides the <<Inventory>> macro
:: PlayerStats - Displays the player stats
:: ShowPlayerStats - Provides the <<PlayerStats>> macro
:: PlayerSkills - Displays the player skills
:: ShowPlayerSkills - Provides the <<PlayerSkills>> macro
:: PlayerProfile - Displays player stats, skills, and inventory
:: postrender - adds macros to tagged passages
## Magic Passages ##
* Some passages are automatically used to display information about your story
* or items.
:: NAME-start - the start page for your story
:: NAME-startDescription - an optional description for your story start
(~jumblesale todo)
:: NAME-init - initialize any values for your story
:: ITEM-itemDescription [item] - provide a description for your item
## Magic Tags ##
* Some tags have been set up to provide story writers with quick access to
* certain features
[inv] - will show ":: Inventory" at the bottom of the passage
[stats] - will show ":: PlayerStats" at the bottom of the passage
[skills] - will show ":: PlayerSkills" at the bottom of the passage
[playerProfile] - will show ":: PlayerProfile" at the bottom of the passage
[item] - will append a "[[Return|previous()]]" to the passage
## The Player ##
* Global objects are provided for $items, $events, $stats, and $skills that any
story can reference or modify
## Player Inventory ##
* The player has a global inventory of items that can be accessed in any story
* One way to pick up an item is to use <<action "Get {item}">>
* To check if a player has already retrieved an item, either check the
* $items['ITEM'] value or check "visited("Get NAME")"
* An item can be added to the global items hash with the following
$items['ITEM'] = 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['STAT'] = VALUE
$skill['SKILL'] = VALUE
* Skills and stats can be modified by events.
* eg "You eat the cake and feel much stronger! Strength increased to
<<$stat['strength'] += 2>>!"
* Skills checks can be made by checking the value against your threshold
* eg "<<if $skill['archery'] gt 3>>You hit the target!<<endif>>"
## The Hub ##
* Has links to all user stories
* Should heal the player (~jumblesale todo)
* Should be able to tell the player their stats/skills (~jumblesale todo)
## General Guidelines ##
* It is recomended (but not mandatory) to have separate .twee files
USERNAME.twee - contains all your core story passages
macros.twee - contains any macros and *-init passages you write
items.twee - contains *-itemDescription passages
- optionally contains item getting passages
## Story-telling Guidelines ##
* All stories should have a path that leads back to the Hub
** This path does not have to be made immediately upon entering, but should become available fairly soon
* 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 that
* were not acquired in that story
** An exception to this could be gold or money
* Should not decrease a stat or skill