title: Test Game
command:
pattern: say #text#
script:
function(text) {
msg ("You say '" + text + "', but nobody replies.");
}
location: lounge
description: This is quite a plain lounge with an old beige carpet and peeling wallpaper.
south: kitchen
object: TV
switchable: true
alt:
["television", "telly"]
look: The TV is an old model, possibly 20 years old. {if TV.switchedon:It is currently showing an old western.}{else:It is currently switched off.}
watch: You watch for a few minutes. As your will to live slowly ebbs away, you remember that you’ve always hated watching westerns.
character: Bob
type: male
look: {if Bob.alive:Bob is sitting up, appearing to feel somewhat under the weather.}{else:Bob is lying on the floor, a lot more still than usual.}
use[defibrillator]:
function() {
if (get("Bob.alive")) {
msg ("Bob is alive so you don't need to use the defibrilltor again.")
}
else {
msg ("Miraculously, the defibrillator lived up to its promise, and Bob is now alive again. He says his head feels kind of fuzzy.");
set ("Bob.alive", true);
}
}
object: table
surface: true
object: newspaper
parent: table
take: true
takemsg: You fold the newspaper and place it neatly under your arm.
object: defibrillator
look: A heart defibrillator can magically revive a dead person, if all those hospital dramas are to be believed.
take: true
location: kitchen
description: Just an ordinary kitchen.
object: eggs
weight: 250
prefix: some
look:
function() {
msg ("A box of eggs, weighing " + get("eggs.weight") + " grams.");
}
command:
pattern: weigh #object#
script:
function(object) {
msg ("It weighs " + get(object, "weight") + " grams.");
}
object: fridge
container: true
closed: true
object: milk
parent: fridge
prefix: some
object: cheese
parent: fridge
prefix: some
object: beer
parent: fridge
prefix: some
title: Test Game
---
command:
pattern: "say #text#"
action:
script: |
function(text) {
msg ("You say '" + text + "', but nobody replies.");
}
---
location: lounge
description: This is quite a plain lounge with an old beige carpet and peeling wallpaper.
south: kitchen
---
object: TV
switchable: true
alt:
- television
- telly
look: The TV is an old model, possibly 20 years old. {if TV.switchedon:It is currently showing an old western.}{else:It is currently switched off.}
watch: You watch for a few minutes. As your will to live slowly ebbs away, you remember that you’ve always hated watching westerns.
---
character: Bob
type: male
look: "{if Bob.alive:Bob is sitting up, appearing to feel somewhat under the weather.}{else:Bob is lying on the floor, a lot more still than usual.}"
use[defibrillator]:
script: |
function() {
if (get("Bob.alive")) {
msg ("Bob is alive so you don't need to use the defibrilltor again.")
}
else {
msg ("Miraculously, the defibrillator lived up to its promise, and Bob is now alive again. He says his head feels kind of fuzzy.");
set ("Bob.alive", true);
}
}
---
object: table
surface: true
---
object: newspaper
parent: table
take: true
takemsg: You fold the newspaper and place it neatly under your arm.
---
object: defibrillator
look: A heart defibrillator can magically revive a dead person, if all those hospital dramas are to be believed.
take: true
---
location: kitchen
description: Just an ordinary kitchen.
---
object: eggs
weight: 250
prefix: some
look:
script: |
function() {
msg ("A box of eggs, weighing " + get("eggs.weight") + " grams.");
}
---
command:
pattern: "weigh #object#"
action:
script: |
function(object) {
msg ("It weighs " + get(object, "weight") + " grams.");
}
---
object: fridge
container: true
closed: true
---
object: milk
parent: fridge
prefix: some
---
object: cheese
parent: fridge
prefix: some
---
object: beer
parent: fridge
prefix: some
location: a city street
description: You are on a deserted city street in the dark of night.
location: a city street
description: {$if (GetValue("city.time") == "night") $}
You are on a deserted city street in the dark of night.
{$ else $}
You are on a busy city street in the dark of night.
{$ endif $}
{$ someFunction(); $}
macro: authorname
text: Jay Nabonne
macro: gametitle
text: My Special Game
location: about
description: This special game named "{$gametitle$}" is brought to you by {$ authorname $}
macro: sunset
description: {$ switch (GetValue("sunset.state")) $}
{$ case "approaching" $}
The sky outside is bathed in lovely colors as sunset approaches.
{$ end $}
{$ case "set" $}
The sun has set.
{$ end $}
{$ end $}
object: window
description: The window is grimy and in need of repair. {$ sunset $}
{$ switch (GetValue("sunset.state")) {
case "approaching": { $}
The sky outside is bathed in lovely colors as sunset approaches.
{$ }
case "set": { $}
The sun has set.
{$ }
} $}
location: TrickyRoom
onenter: You enter a dimly lot room with strange markings on the wall.
{firsttime}
{$
var markings = getRandomMarkings();
SetValue("TrickyRoom.marking1", markings[0]);
SetValue("TrickyRoom.marking2", markings[1]);
SetValue("TrickyRoom.marking3", markings[2]);
SetValue("TrickyRoom.marking4", markings[3]);
$}
{end}
The first is a {TrickyRoom.marking1}. Right beside it is one that looks like {TrickyRoom.marking2}. There are two more, {TrickyRoom.marking3} and {TrickyRoom.marking4}. There is an elevator button on the wall.
command:
pattern: push elevator button
description:
{$ if (!GetBoolean("button.pressed")) $}
{$ SetFlag("button.pressed") $}
You press the button, and it lights up.
{$ else $}
The button has already been pressed.
{$ end $}
if (!GetBoolean("button.pressed")) {
SetFlag("button.pressed");
msg("You press the button, and it lights up.");
} else {
msg("The button has already been pressed.");
}
command:
pattern: push elevator button
description:
@if (!GetBoolean("button.pressed"))
@SetFlag("button.pressed")
You press the button, and it lights up.
@else
The button has already been pressed.
@end
Alex wrote:Thinking about it more... I think it's fine not to be able to change the description definition at run-time. It means all the potential descriptions an object might show are defined by its original object definition, which is nice and straightforward.
Alex wrote:One thing that occurs to me, if all "look" descriptions were scripts, you wouldn't be able to change it at run-time. I wonder if that would be limiting?
location: forest
description: There are several exits leading away from this
location: west ans east
Pertex wrote:"Alex"
One thing that occurs to me, if all "look" descriptions were scripts, you wouldn't be able to change it at run-time. I wonder if that would be limiting?
Ähhmm,yes. Perhaps this feature is not used but the average Quest-User but I often change descriptions at runtime. I don't want to have a script testing lots of boolean values, I just change the description.
Pertex wrote:
Thinking about Jays suggestions: I am a bit confused. So you will have two scripting languages in Quest: Javascript and "Jayscript"? ( ) I don't think this would be a good idea. The normal Quest user has problems with asl, now he should know two languages?