[INFORM] worn

0 views
Skip to first unread message

green_g...@my-dejanews.com

unread,
Sep 18, 1998, 3:00:00 AM9/18/98
to
I'd like to modify the way that inventory lists stuff that's being worn.
Instead of this (or something roughly resembling this):

>i
You are carrying a mint condition IF compiler manual, a shawl
(which is worn), an overcoat (which is worn), a pair of underwear
(which is worn), a cat, a pair of hiking boots (which are worn),
and a hat.

<I don't remember the exact wording of the (which is worn)>

I would like it to be more... together. Something more on the lines of:

>i

You are wearing a shawl, an overcoat (under which is a pair of
underwear), and a pair of hiking boots while carrying a mint
condition IF compiler manual, a cat, and a hat.

Any suggestions? I thought of list_together, but it didn't seem to quite fit
what I want to do here - at least by my understanding of it.

Kathleen

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum

Torbj|rn Andersson

unread,
Sep 19, 1998, 3:00:00 AM9/19/98
to
green_g...@my-dejanews.com wrote:

> I would like it to be more... together. Something more on the lines of:
>
> >i
>
> You are wearing a shawl, an overcoat (under which is a pair of
> underwear), and a pair of hiking boots while carrying a mint
> condition IF compiler manual, a cat, and a hat.
>
> Any suggestions? I thought of list_together, but it didn't seem to quite fit
> what I want to do here - at least by my understanding of it.

This sounds a lot like Exercise 52 (DoubleInvSub) in the "Listing and
grouping objects" section of the Inform Designer's Manual.

Torbjörn


Doeadeer3

unread,
Sep 19, 1998, 3:00:00 AM9/19/98
to
In article <6tuh1v$k3l$1...@nnrp1.dejanews.com>, green_g...@my-dejanews.com
writes:

>Any suggestions? I thought of list_together, but it didn't seem to quite fit
>what I want to do here - at least by my understanding of it.

Replace InvSub and write your own, using workflag to first group the clothing
together:

objectloop(i in player)
if (i has worn) give i workflag;

WriteListFrom(player, inventory_sytle + WORKFLAG_BIT); (something like that)

and then group non-clothing together:

objectloop(i in player)
if (i hasnt worn) give i workflag;

ditto WriteListFrom

Play around with WriteListFrom until you get what you want, you can also join
the two strings produced with and "and".

There should be a replace InvSub example in the DM. Also an example of using
the workflag.

Doe :-) I find the WORKFLAG_BIT quite useful, quite often.


Doe doea...@aol.com (formerly known as FemaleDeer)
****************************************************************************
"In all matters of opinion, our adversaries are insane." Mark Twain

Joe Mason

unread,
Sep 19, 1998, 3:00:00 AM9/19/98
to
In article <6tuh1v$k3l$1...@nnrp1.dejanews.com>,

<green_g...@my-dejanews.com> wrote:
>I'd like to modify the way that inventory lists stuff that's being worn.

<snip>

>I would like it to be more... together. Something more on the lines of:
>
> >i
>
> You are wearing a shawl, an overcoat (under which is a pair of
> underwear), and a pair of hiking boots while carrying a mint
> condition IF compiler manual, a cat, and a hat.
>

>Any suggestions? I thought of list_together, but it didn't seem to quite fit
>what I want to do here - at least by my understanding of it.

IIRC, this is described in the DM somewhere, but I had to do a little
fiddling to get it to work with both Tall and Wide inventory formats. From
my CWIP (current work in progress):

[ InvSub i count1 count2;

if (inventory_style & WORKFLAG_BIT == 0)
inventory_style = inventory_style + WORKFLAG_BIT;

print "You are carrying";
if (inventory_style & NEWLINE_BIT ~= 0) print ":^";
else print " ";

count1 = 0; count2 = 0;

objectloop (i in player)
{
if (i hasnt worn) { give i workflag; count1++; }
else { give i ~workflag; count2++; }
}

if (count1==0)
{
print "nothing";
if (inventory_style & NEWLINE_BIT ~= 0) new_line;
}
else
WriteListFrom(child(player), inventory_style);

if (inventory_style & ENGLISH_BIT ~= 0) print ".";

if (count2~=0)
{
if (inventory_style & ENGLISH_BIT ~= 0) print " ";
else new_line;

print "You are wearing";
if (inventory_style & NEWLINE_BIT ~= 0) print ":^";
else print " ";

objectloop (i in player)
{
if (i hasnt worn) give i ~workflag;
else give i workflag;
}

WriteListFrom(child(player), inventory_style);

if (inventory_style & ENGLISH_BIT ~= 0) print ".^";
}

AfterRoutines();

];

Result:


>inv tall
You are carrying:
nothing

You are wearing:
your coach-horn (hanging at your hip)
a cloak

>inv wide
You are carrying nothing. You are wearing your coach-horn (hanging at your hip)
and a cloak.


If you don't like the style, you can fiddly with it by adjusting where it
prints newlines and stuff.

Joe
--
I think OO is great... It's no coincidence that "woohoo" contains "oo" twice.
-- GLYPH

Jonadab the Unsightly One

unread,
Sep 19, 1998, 3:00:00 AM9/19/98
to

green_g...@my-dejanews.com wrote in article
<6tuh1v$k3l$1...@nnrp1.dejanews.com>...

> I'd like to modify the way that inventory lists stuff that's being
worn.

> I would like it to be more... together. Something more on the


lines of:
>
> >i
>
> You are wearing a shawl, an overcoat (under which is a pair of
> underwear), and a pair of hiking boots while carrying a mint
> condition IF compiler manual, a cat, and a hat.
>
> Any suggestions? I thought of list_together, but it didn't seem
to quite fit
> what I want to do here - at least by my understanding of it.

I think there's an example of this in the designer's manual.
Do a search for "inventory" in the "answer" section.

--

Dyslexic email address: ten.thgirb@badanoj


LysseusD

unread,
Sep 26, 1998, 3:00:00 AM9/26/98
to

>From: jcm...@undergrad.math.uwaterloo.ca (Joe Mason)

>Result:
>
>
>>inv tall
>You are carrying:
>nothing
>
>You are wearing:
>your coach-horn (hanging at your hip)
>a cloak
>
>>inv wide
>You are carrying nothing. You are wearing your coach-horn (hanging at your
>hip)
>and a cloak.
>

I did something like this too. The only problem is that it looks bad if you
have

You are wearing:
a hat
a coat
a pair of binoculars
In your pocket you have:
a few gold coins
a piece of paper
You are holding:
a key
a guidebook to the galaxy

I tried borrowing the code from InvTall which adds a depth level to the
WriteListFrom(), but this routine ignores the WORKFLAG_BIT when using a depth
other than 0.

So basically it seems that double inventories are cleanest when using the
english style, rather than list style, as I haven't figured out how to indent a
list using this procedure.

Kevin

TenthStone

unread,
Sep 27, 1998, 3:00:00 AM9/27/98
to
green_g...@my-dejanews.com caused this to appear in our collective
minds on Fri, 18 Sep 1998 20:50:07 GMT:

>I'd like to modify the way that inventory lists stuff that's being worn.

>Instead of this (or something roughly resembling this):
>
> >i
> You are carrying a mint condition IF compiler manual, a shawl
> (which is worn), an overcoat (which is worn), a pair of underwear
> (which is worn), a cat, a pair of hiking boots (which are worn),
> and a hat.
>
><I don't remember the exact wording of the (which is worn)>
>

>I would like it to be more... together. Something more on the lines of:
>
> >i
>
> You are wearing a shawl, an overcoat (under which is a pair of
> underwear), and a pair of hiking boots while carrying a mint
> condition IF compiler manual, a cat, and a hat.

I'm not an Inform programmer, but since I play works written in Inform,
I'm obviously competent to make a reply here.

Ah, nevermind.

But if there are two things which I would like to note to Inform
programmers:

1. Wide inventories don't handle contents well. For eaxmple, a
display might, keeping in mind that this is all theory and not to
insinuate that any game actually exists with these items in it, read:
You are carrying a book of Twenties poetry, a romantic
novel, a canvas rucksack (which is open), in which are a guaranteed-
unbreakable medicine bottle with a child-proof lock (which is closed),
a bird whistle and a gift-wrapped parcel, an old striped scarf (being
worn) and an electric torch (providing light and closed).

Andrew Plotkin came up with a good fix to this, which is to add
parentheses to contents-lists (at least, so Jigsaw), but the Inform
libraries -- maybe only older versions; I'm really not sure -- appear
to still have this problem.

2. Let's say a command requires that an object be held in order to be
successful. If the player is not holding that object, the libararies
(rightly) automatically try to pick the object up. But it would seem that
whenever the taking of the object produces a special message (even when
successful), the command ceases to be further parsed. For instance, again
taking a theoretical game, (and if this game, in fact, existed -- Curses
upon that possibility! -- what follows might be considered a mild spoiler,
if it were not somewhat consored):

>Turn the x with the wrench.
(first taking the wrench)
It's a wrench, but you take it.

>Again.
You (and so on)...

I'm unsure whether either of these have been remedied in the newest
library releases; however, I've found both of these flaws in works more
recent-sounding than the fanciful game above.

-----------

The imperturbable TenthStone
tenth...@hotmail.com mcc...@erols.com mcc...@gsgis.k12.va.us

Brent VanFossen

unread,
Sep 28, 1998, 3:00:00 AM9/28/98
to
On 26 Sep 1998 11:05:04 GMT, lyss...@aol.com (LysseusD) wrote:
>
>I tried borrowing the code from InvTall which adds a depth level to the
>WriteListFrom(), but this routine ignores the WORKFLAG_BIT when using a depth
>other than 0.
>
>So basically it seems that double inventories are cleanest when using the
>english style, rather than list style, as I haven't figured out how to indent a
>list using this procedure.
>
>Kevin

From "She's Got a Thing for a Spring":

Replace InvTallSub;

[ InvTallSub i count1 count2;
inventory_style=0;
print "You are carrying";


objectloop (i in player)
{ if (i hasnt worn) { give i workflag; count1++; }
else { give i ~workflag; count2++; }
}

if (count1==0) print " nothing.^";
else
{print ":^";
WriteListFrom(child(player),
FULLINV_BIT + INDENT_BIT + NEWLINE_BIT +
CONCEAL_BIT + RECURSE_BIT + WORKFLAG_BIT,0,1);
}
if (count2==0) "^You are completely naked.";
print "^In addition, you are wearing";
if (count2==1) print " only:^"; else print ":^";


objectloop (i in player)
{ if (i hasnt worn) give i ~workflag; else give i workflag;
}
WriteListFrom(child(player),

INDENT_BIT + NEWLINE_BIT +
CONCEAL_BIT + RECURSE_BIT + WORKFLAG_BIT,0,1);
];

Result:

>i
You are carrying:
a bucket
a glass canning jar (which is closed)
a handful of washers
a note
a guidebook

In addition, you are wearing:
a pair of shorts
a shirt
a pair of flipflops


It took some doing, but it works the way I wanted it. Hope that
helps. (Have a nice day.)

Brent VanFossen

LysseusD

unread,
Sep 28, 1998, 3:00:00 AM9/28/98
to

I've experienced the same frustration with implicit commands, especially 'open
door with key' type of things. Very annoying.

Is there a fix for this?

Kevin

Jonadab the Unsightly One

unread,
Sep 29, 1998, 3:00:00 AM9/29/98
to
LysseusD wrote:

Yes. This isn't an explicit command, though. It's an example
of default grammar that may not be quite what you want.

The problem is that the library grammar treats "open foo with bar"
as merely a request to *unlock* foo with bar. Try this:

Extend "open" first
* noun "with" held -> OpenWith

Extend "close" first
* noun "with" held -> CloseWith

[ OpenWithSub;
<Unlock noun second>;
if (noun hasnt locked) <<Open noun>>;
];

[ CloseWithSub;
<close noun>;
if (noun hasnt open) <<Lock noun second>>;
];

In my game I've also changed the held tokens
above to HeldOrOnRing, a routine that allows
the key to be used if the player is holding it
or if it's on the player's keyring (assuming the
keyring is in the player's posession).

Brent VanFossen

unread,
Oct 2, 1998, 3:00:00 AM10/2/98
to
On Mon, 28 Sep 1998 02:19:26 GMT, vanf...@compuserve.com (Brent
VanFossen) wrote:

>On 26 Sep 1998 11:05:04 GMT, lyss...@aol.com (LysseusD) wrote:
>>
>>I tried borrowing the code from InvTall which adds a depth level to the
>>WriteListFrom(), but this routine ignores the WORKFLAG_BIT when using a depth
>>other than 0.
>>
>>So basically it seems that double inventories are cleanest when using the
>>english style, rather than list style, as I haven't figured out how to indent a
>>list using this procedure.
>>
>>Kevin

Kevin wrote me by email to say that the code I posted didn't quite
work. It wouldn't print the first indent. Upon reexamining my code,
I changed more than I at first remembered, and more than I posted.
Here is (I hope) the complete change I made in "She's Got a Thing for
a Spring":

Replace InvSub;
Replace InvTallSub;
Replace InvWideSub;

[ InvSub x;
if (inventory_style==0) return InvTallSub();
else return InvWideSub();
];

[ InvTallSub i count1 count2;
inventory_style=0;
print "You are carrying";
objectloop (i in player)
{ if (i hasnt worn) { give i workflag; count1++; }
else { give i ~workflag; count2++; }
}
if (count1==0) print " nothing.^";
else
{print ":^";
WriteListFrom(child(player),
FULLINV_BIT + INDENT_BIT + NEWLINE_BIT +
CONCEAL_BIT + RECURSE_BIT + WORKFLAG_BIT,0,1);
}
if (count2==0) "^You are completely naked.";
print "^In addition, you are wearing";
if (count2==1) print " only:^"; else print ":^";
objectloop (i in player)
{ if (i hasnt worn) give i ~workflag; else give i workflag;
}
WriteListFrom(child(player),
INDENT_BIT + NEWLINE_BIT +
CONCEAL_BIT + RECURSE_BIT + WORKFLAG_BIT,0,1);
];

[ InvWideSub i count1 count2;
inventory_style=1;


print "You are carrying ";
objectloop (i in player)
{ if (i hasnt worn) { give i workflag; count1++; }
else { give i ~workflag; count2++; }
}

if (count1==0) print "nothing.";
else
WriteListFrom(child(player),
FULLINV_BIT + ENGLISH_BIT + RECURSE_BIT + WORKFLAG_BIT);

if(count2==0) ". You are completely naked.";
if(count1==0) print " In addition, you are wearing ";
else print ". In addition, you are wearing ";
if (count2==1) print "only ";


objectloop (i in player)
{ if (i hasnt worn) give i ~workflag; else give i workflag;
}
WriteListFrom(child(player),

ENGLISH_BIT + RECURSE_BIT + WORKFLAG_BIT);
".";

Reply all
Reply to author
Forward
0 new messages