Created
May 5, 2014 02:40
-
-
Save Blecki/92872b72a8ac7dad14a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Include "world-model.txt" | |
Include "map.txt" | |
Include "links.txt" | |
Include "standard-output.txt" | |
Include "system.txt" | |
Include "standard-actions.txt" | |
Global main-window-width:number; | |
Global radio-acquired:boolean = false; | |
Global inventory-created:boolean = false; | |
Global radio-created:boolean = false; | |
global hydro-spanner:object = new object { | |
let printed-name = "hydro spanner"; | |
}; | |
global hand-held-radio:object = new object { | |
let printed-name = "hand held radio"; | |
}; | |
global sonar:object = new object { | |
let printed-name = "sonar device"; | |
}; | |
global fire-extinquisher:object = new object { | |
let printed-name = "extinquisher"; | |
let description = "A yellow and red fire extinquisher."; | |
}; | |
Rule can (actor:object) use (fe:object) : boolean when fe == fire-extinquisher with low priority { | |
Select window named "main"; | |
Respond "There's nothing on fire here!"; | |
return false; | |
} | |
global opening-cabin:room = new room { | |
let printed-name = "A converted cargo bay"; | |
let description = "You are in the small cargo bay that serves as your quarters aboard this ship."; | |
}; | |
global opening-galley:room = new room { | |
let printed-name = "A circular galley"; | |
let description = "This is the central chamber where all parts of the ship connect. It's the galley, and the rec room, and everything else too."; | |
}; | |
global opening-cargo:room = new room { | |
let printed-name = "A small cargo bay"; | |
}; | |
global opening-engines:room = new room { | |
let printed-name = "A crowded engine room"; | |
}; | |
Rule write paragraph about (o:object) : boolean when o == hydro-spanner { | |
Write [word wrap $"\nThere is a [[write take hydro-spanner]] sitting right in the middle of the floor." at column text-width]; | |
return true; | |
} | |
Macro initialize game world { | |
move player to opening-cabin; | |
#move hydro-spanner to opening-cabin; | |
#move sonar to opening-cabin; | |
move fire-extinquisher to opening-cabin; | |
Open link from opening-cabin northwest to opening-galley; | |
Open link from opening-galley east to opening-engines; | |
Open link from opening-galley northeast to opening-cargo; | |
} | |
macro begin game { | |
let main-window-width = screen-width - (MAPSIZE * 3 + 2); | |
#Create window named "map"; | |
#Resize window to (MAPSIZE * 3 + 2) by (MAPSIZE * 3 + 2); | |
#Set window title to "map"; | |
#Position window at (screen-width - (MAPSIZE * 3 + 2)) 1; | |
Select window named "main"; | |
Clear window; | |
Resize window to main-window-width by screen-height; | |
Position window at [floor ((screen-width - main-window-width) / 2)] 0; | |
Enable window border; | |
Set window title to "SPACE: Chapter 0 - Dust in the air"; | |
Write [word wrap " You aren't sure what happened. You expected the discontinuity, but expecting it and experiencing it are two very different things. No amount of reading about it could have prepared you for that leap through unreality. And then you emerged from the absolute order of interstellar travel into chaos. Shouting. The crew had recovered faster than you. Of course they had, they'd done this before.\n\nYou are strapped into a flight couch, surrounded by netting and foam. The flight couch is in a small cargo bay that has been converted into a sort of living quarters for you. Converted is a strong word. They really just threw down a rug and bolted this couch in. Bare metal girders arc about the ceiling and the floor is highly polished steel, with little grates set in. You imagine the grates have something to do with the air circulation, or maybe the artificial gravity, which seems to be off. You can hear the hiss of escaping gas behind you, but the couch won't let you turn around far enough to see what's causing it.\n\nSomething is trickling down your face. Is that.. <fBLUE|<opening blood detail|blood?>>" at column text-width]; | |
} | |
Macro opening blood detail { | |
Clear window; | |
Write [word wrap "You put your hand up to your forehead and find something red and sticky. It's definitely blood, though you can't feel any head injuries. You're just going to have to assume it's your own.\n\nThings seem to have calmed down. At least, the ship has stopped shaking. It should be safe to <fBLUE|<opening exit couch|get off the couch>> now." at column text-width]; | |
} | |
Macro opening exit couch { | |
Resize window to main-window-width by (screen-height - 1); | |
Create window named "command bar"; | |
Resize window to screen-width by 1; | |
Disable window border; | |
Position window at 0 (screen-height - 1); | |
Update basic commands; | |
Select window named "main"; | |
Clear window; | |
Write [word wrap "You disentangle yourself from the flight couch.\n\n" at column text-width]; | |
print locale description of opening-cabin; | |
} | |
Rule (actor:object) takes (item:object) when actor == player ORDER FIRST { | |
if inventory-created == false { | |
let inventory-created = true; | |
Select window named "main"; | |
Position window at 0 0; | |
Create window named "inventory"; | |
Resize window to (MAPSIZE * 3 + 2) by 13; | |
Set window title to "inventory"; | |
Position window at (screen-width - (MAPSIZE * 3 + 2)) 0; | |
} | |
Update inventory listing; | |
Respond $"You take the [item.printed-name]."; | |
return continue; | |
} | |
Rule (actor:object) takes (item:object) when actor == player && item == hand-held-radio { | |
if radio-created == false { | |
let radio-created = true; | |
Select window named "main"; | |
Position window at 0 0; | |
Create window named "radio"; | |
Resize window to (MAPSIZE * 3 + 2) by 6; | |
Set window title to "radio"; | |
Position window at (screen-width - (MAPSIZE * 3 + 2)) 13; | |
} | |
Move hand-held-radio to nowhere; | |
Update inventory listing; | |
return continue; | |
} | |
Rule (actor:object) takes (item:object) when actor == player && item == sonar { | |
Select window named "main"; | |
Position window at 0 0; | |
Create window named "sonar"; | |
Set foreground to "TAN"; | |
var sonar-dim = MAPSIZE * 3 + 2; | |
Resize window to sonar-dim by sonar-dim; | |
Set window title to "sonar"; | |
Position window at (screen-width - sonar-dim) (screen-height - sonar-dim - 1); | |
Select window named "main"; | |
Move sonar to nowhere; | |
Update sonar display; | |
Update inventory listing; #Because it likely got re-drawn with the sonar device listed already. | |
return continue; | |
} | |
Rule (actor:object) uses (item:object) when actor == player { | |
Respond "That doesn't seem to do anything here."; | |
} | |
Macro respond (message:string) { | |
Select window named "main"; | |
Clear window; | |
Write $"<fRED|[message]>\n\n"; | |
Print locale description of player.location:room; | |
} | |
Rule (actor:object) moves (direction:number) when actor == player ORDER LAST { | |
Select window named "main"; | |
clear window; | |
print locale description of player.location:room; | |
update sonar display; | |
return continue; | |
} | |
Rule print locale description of (room:room) when (room == opening-cabin) && (radio-acquired == false) ORDER LAST { | |
Write [word wrap "\n\nYou should probably <fBLUE|<acquire radio|find>> out where that hissing noise is coming from." at column text-width]; | |
return continue; | |
} | |
Macro acquire radio { | |
let radio-acquired = true; | |
Select window named "main"; | |
Clear window; | |
Write [word wrap "The sound seems to be coming from behind the flight couch. It's not the hiss of air escaping. You'd recognize that sound. You pull the flight couch out a few inches, and sitting behind it is a little hand held radio." at column text-width]; | |
Move hand-held-radio to opening-cabin; | |
Write $"\n\nTake the [[write take hand-held-radio]]."; | |
} | |
Macro teletype (s:string) { | |
foreach character in s { | |
write character; | |
if character != 32 { | |
wait for 0.05 seconds; | |
} | |
} | |
} | |
Rule startup { | |
Initialize game world; | |
Create window named "main"; | |
Set foreground to "steelblue"; | |
Resize window to 40 by screen-height; | |
Position window at [floor ((screen-width - 40) / 2)] 0; | |
Disable window border; | |
#Teletype "\n\nSpace..\n\n"; | |
#Wait for 1 seconds; | |
#Teletype [word wrap "Is really quite boring, when you get right down to it. Most of space is.. well, space.\n\n It's the things in space that are #interesting. Those little bits of fire and rock floating around that aren't space at all..." at column 40]; | |
#Wait for 1 seconds; | |
Write "\n\n<fGREEN|<continue|Continue...>>"; | |
Continue with (lambda _ { begin game; }); | |
} | |
Macro update basic commands { | |
Select window named "command bar"; | |
#Clear window; | |
Write "<fGREEN|<look|LOOK>>"; | |
Select window named "main"; | |
} | |
Macro look { | |
Select window named "main"; | |
Clear window; | |
Print locale description of player.location:room; | |
} | |
Macro update inventory listing { | |
Select window named "inventory"; | |
Clear window; | |
var listing = ""; | |
foreach index from 0 to ([length of player.contents] - 1) { | |
var item = (player.contents@index):object; | |
let listing = listing + $"<fGREEN|<handle inventory click [index]|[item.printed-name]>>\n"; | |
} | |
Write [word wrap listing at column text-width]; | |
} | |
Macro handle inventory click (index:number) { | |
var item = (player.contents@index):object; | |
player uses item; | |
} | |
Macro update sonar display { | |
Select window named "sonar"; | |
Clear window; | |
Draw player.location:room on map; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment