bl791's picture
download
raw
5.3 kB
!! greenbacks.inf version 970331
!! Copyright 1997 Erik Hetzner
!! This file may be copied, modified and distributed freely, so long
!! as this notice remains. If it is modified, I ask that you change
!! the name somehow to indicate that changes have been made, and give
!! both you and me credit.
!! -- What is this? --
!! This is `greenbacks.inf', an example game for the `money.h' header
!! file, available on `ftp://ftp.gmd.de/if-archive/infocom/compilers/
!! inform6/library/contributions/money.h'. `greenbacks.inf' simulates
!! the American monetary system of dollars and cents, and `money.h'
!! provides a pretty generic system of money.
Constant Story "Greenbacks";
Constant Headline "^Copyright 1997 Erik Hetzner^";
Constant DEBUG;
Constant MONEY_TOTAL;
Constant MONEY_TOTAL_ON_GROUND;
Constant MONEY_SHOW;
Constant MONEY_SHOW_ON_GROUND;
Constant MONEY_TALL_LIST;
Include "parser";
Include "verblib";
Include "grammar";
Include "./money.h";
Object Cents
class MetaMoneyClass
with sing_name "cent",
plur_name "cents",
sing 'cent' 'cent',
plur 'cents' 'cents',
value 1;
Object Dollars
class MetaMoneyClass
with sing_name "dollar",
plur_name "dollars",
sing 'dollar' 'dollar',
plur 'dollars' 'dollars',
value 100;
Class PennyClass
class MoneyClass
with sing_name "penny",
plur_name "pennies",
sing 'penny',
plur 'pennies',
value 1;
Class QuarterClass
class MoneyClass
with sing_name "quarter",
plur_name "quarters",
sing 'quarter',
plur 'quarters',
value 25;
Class DimeClass
class MoneyClass
with sing_name "dime",
plur_name "dimes",
sing 'dime',
plur 'dimes',
value 10;
Class NickelClass
class MoneyClass
with sing_name "nickel",
plur_name "nickels",
sing 'nickel' 'nic',
plur 'nickels' 'nics',
value 5;
Class DollarBillClass
class MoneyClass
with sing_name "one dollar bill",
plur_name "one dollar bills",
sing 'one' 'dollar' 'bill',
plur 'one' 'dollar' 'bills',
value 100;
!Object Quarter2 "quarter"
! class QuarterClass;
!Object Penny3 "penny"
! class PennyClass;
!Object Penny4 "penny"
! class PennyClass;
!Object Penny5 "penny"
! class PennyClass;
Object MainRoom "Main"
with description "A room of little descript.",
s_to MoreRoom,
has light;
Object -> Wallet "wallet"
with name "wallet" "purse",
has container open transparent;
Object -> Penny "penny"
class PennyClass
with quantity 0;
Object -> Quarter "quarter"
class QuarterClass
with quantity 56;
Object MoreRoom "More"
with description "More room.",
n_to MainRoom,
has light;
Object -> Nickel "nickel"
class NickelClass
with quantity 7;
Object -> Penny1
class PennyClass
with quantity 23;
Object -> Dime
class DimeClass
with quantity 1;
Object -> DollarBills
class DollarBillClass
with quantity 5;
Object -> ChangeMachine "change machine"
with name 'change' 'machine' 'dial' 'large',
initial "There is a large change machine here.",
description "A large change machine, it looks like it's been \
through more than most war veterans.. A hand-painted \
sign reads `Put your money in, get your change out.' \
There is a slot for coins and one for bills. There is a \
large dial allowing you to choose any coin or bill you'd \
like, a coin release button and a make change button.",
before [;
Push:
"You'll have to specify whether you want to press the \
coin release or the make change button.";
Receive:
if (~~(noun ofclass MoneyClass))
"Perhaps you should try putting money in the change machine!";
else {
if ((noun ofclass DollarBillClass) && (random (10) < 3))
"The machine spits back ", (the) noun, ".";
else {
move noun to self;
"You put ", (the) noun, " into ", (the) self, ".";
}
}
SetTo:
switch (second) {
'dollar', 'dollars', 'bill', 'bills':
self.number = DollarBillClass;
"You set the machine to release dollar bills.";
'quarter', 'quarters':
self.number = QuarterClass;
"You set the machine to release quarters.";
'dime', 'dimes':
self.number = DimeClass;
"You set the machine to release dimes.";
'nickel', 'nickels':
self.number = NickelClass;
"You set the machine to release nickels.";
'penny', 'pennies':
self.number = PennyClass;
"You set the machine to release pennies.";
default:
"The machine can be set to dollars, quarters, dimes, \
nickels, or pennies.";
}
LetGo:
<<LetGo CM_slot second>>;
Search:
<<Search CM_slot>>;
],
number,
has static;
Object -> CM_slot "slot"
with name 'slot',
before [;
Receive:
<<Insert noun ChangeMachine>>;
],
has scenery concealed container open;
Object -> CM_release "coin release button"
with name 'coin' 'release' 'button',
before [;
Push:
while (child (ChangeMachine) ~= 0)
move child (ChangeMachine) to CM_slot;
"You press the button on the machine, releasing your \
money into the slot.";
],
has scenery concealed;
Object -> CM_make "make change button"
with name 'make' 'change' 'button',
before [;
Push:
"Funny, nothing happens. The machine must be busted.";
],
has scenery concealed;
[ Initialise;
Location = MainRoom;
print "^^^";
InitMoney ();
];

Xet Storage Details

Size:
5.3 kB
·
Xet hash:
7680b61e49e77d111d51befd5adf7657f14d5f1b34900a2047fec58854d5e265

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.