Counterfeit Monkey — 16 of 292

Emily Short

Release 5

Section 5 - Inventory Options

Inventory listing style is a kind of value. The inventory listing styles are tall, wide, and utilitarian. Current inventory listing style is an inventory listing style that varies. Current inventory listing style is utilitarian.

Understand "inventory [inventory listing style]" as requesting styled inventory. Requesting styled inventory is an action applying to an inventory listing style, out of world.

Carry out requesting styled inventory:

now current inventory listing style is the inventory listing style understood.

Report requesting styled inventory:

say "Inventory listing is now set to [current inventory listing style]."

[We begin by emulating the standard inventory listing style:]

Instead of taking inventory when current inventory listing style is tall:

if the number of things enclosed by the player is 0, say "[You] [are] empty-handed." instead;

say "[You] [are] carrying: [line break]";

list the contents of the player, with newlines, indented, giving inventory information, including contents, with extra indentation.

Instead of taking inventory when the current inventory listing style is wide:

if the number of things enclosed by the player is 0, say "[You] [are] empty-handed." instead;

say "[You] [are] wearing ";

now all things enclosed by the player are unmarked for listing;

now all things worn by the player are marked for listing;

if no things worn by the player are marked for listing, say "nothing special";

otherwise list the contents of the player, as a sentence, listing marked items only;

say ".[paragraph break]";

say "[You] [are] carrying ";

now all things carried by the player are marked for listing;

now all things worn by the player are unmarked for listing;

if no things carried by the player are marked for listing, say "nothing";

otherwise list the contents of the player, as a sentence, tersely, giving brief inventory information, including contents, listing marked items only;

say ".[paragraph break]".

Instead of taking inventory when the current inventory listing style is utilitarian:

now everything is not marked for listing;

let packed count be 0;

let unpacked count be 0;

if the number of things enclosed by the player is 0, say "[You] [are] empty-handed." instead;

now all essential things enclosed by the player are marked for listing;

unless the number of marked for listing things is 0::

if exactly one thing is marked for listing:

say "[You] [are] equipped with [a list of marked for listing thing] [--] an essential [you] mustn't part with.[paragraph break]";

otherwise:

say "[You] [are] equipped with the following essentials: [a list of marked for listing things].[paragraph break]";

now packed count is the number of marked for listing things which are packed;

now unpacked count is the number of marked for listing things which are unpacked;

now everything is not marked for listing;

now every not essential thing enclosed by the player is marked for listing;

now everything that is part of something is not marked for listing;

now the restoration gel is not marked for listing; [because the tub will already be a mentioned essential]

unless no things are marked for listing:

say "[You] [are] also carrying ";

repeat with item running through marked for listing things:

choose a blank row in the Table of Inventory Ordering;

let N be indexed text;

let N be "[item]";

let N be "[N in lower case]";

now the name appearance entry is N;

now the referent entry is the item;

if item is packed, increase packed count by 1;

else increase unpacked count by 1;

sort the Table of Inventory Ordering in name appearance order;

let count be 0;

let max be the number of filled rows in the Table of Inventory Ordering;

let near-max be max minus 1;

repeat through the Table of Inventory Ordering:

say "[a referent entry]";

increase count by 1;

if count is max:

say ".";

otherwise if count is near-max:

say ", and ";

otherwise:

say ", ";

blank out the whole row;

if the player carries the backpack:

say line break;

if packed count is greater than unpacked count:

if the unpacked count is 0:

say "Everything [you] carry is in the backpack, which is [if backpack is closed]closed for greater concealment[else]gaping wide open so everyone can see what's inside[end if]. [no line break]";

else:

say "Everything [you] carry is in the backpack except [the list of unpacked things which are enclosed by the player]. The backpack is [if backpack is closed]closed for greater concealment[else]gaping wide open so everyone can see what's inside[end if]. [no line break]";

else:

if packed count is 0:

say "None of that is in the backpack. [no line break]";

else:

say "Of that collection, [the list of packed things] [is-are] packed away in the backpack, which is [if backpack is closed]closed for greater concealment[else]gaping wide open so everyone can see what's inside[end if]. [no line break]";

if the player wears something:

if packed count is 0:

say line break;

say "We're wearing [the list of things worn by the player].";

else if the packed count is greater than 0:

say paragraph break.

Test newutility with "tutorial off / i / put all in backpack / i / wave l-remover at plans / put pans in backpack / i / put all in backpack / i / close backpack / i / x backpack / open backpack / x backpack / i / wear wig / i / wear monocle / i / drop backpack / i / x me" holding the backpack and the secret-plans and the lime and the cate and the wig.

Definition: a thing is packed if it is enclosed by the backpack and it is not part of something.

Definition: a thing is unpacked if it is not packed and it is not part of something and it is not the backpack.

Table of Inventory Ordering

name appearancereferent
indexed texta thing
with 100 blank rows.

After printing the name of something (called target) which is proffered by the secret-plans while taking inventory:

if the current inventory listing style is utilitarian and the target is not secret-plans:

say " (really the smuggled plans in disguise)".

After printing the name of the tub while taking inventory:

if the current inventory listing style is utilitarian:

say " of restoration gel".