Inform: Wearing something you don't carry

G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

So sorry if this message is a repeat, but I couldn't find the answer
anywhere. I would like to make an object that can be worn, But not
carried in your inventory. To be more a specific, a seatbelt.
Whenever I try to wear it, it says (first taking the seatbelt)

The 'Before' directive doesn't seem to be early enough, also i have
tried replacing the WearSub and DisrobeSub to no avail, it this
behaviour built into the interpreter?

Thanks for all your help,

Chad Elliott
 
Archived from groups: rec.games.int-fiction (More info?)

Like i said iny my first post

"The 'Before' directive doesn't seem to be early enough"

I use the before clause in the object, however, the parser still
prints:

>Wear the Seatbelt

(First taking the seatbelt)
That's hardly portable

>Remove the seatbelt
(first taking the seatbelt)
That's hardly portable
 
Archived from groups: rec.games.int-fiction (More info?)

Thanks for pointing me toward rec.arts.int-fiction This question was
already posted there, and it turns out that the "take before wear"
thing is built into the parser.

Thanks,

Chad Elliott
 
Archived from groups: rec.games.int-fiction (More info?)

damnit Zarf, do you -Always- have to be right? =)

I added a line to grammar.h and tweaked the story file a bit, then
Viola! no more (first taking the seatbelt)

--- snippet ---
Verb 'wear' 'don'
* 'seatbelt' -> Buckle
* held -> Wear;
--- end snippet ---
 
Archived from groups: rec.games.int-fiction (More info?)

Here is the solution I worked out after reading Zarf's brilliant (as
usual) advice:

Edited Grammar.h to like this:

--------Original--------
Verb 'shed' 'disrobe' 'doff'
* held -> Disrobe;
Verb 'wear' 'don'
* held -> Wear;
------------------------------

--------Edited--------
Verb 'shed' 'disrobe' 'doff'
* noun -> Disrobe;
Verb 'wear' 'don'
* noun -> Wear;
--------------------------

Then I added this to my seatbelt object in my inf file

--------Snippet--------
before
wear:
FastenSub();
return -1;
disrobe:
UnFastenSub();
return -1;
],
has scenery clothing;
---------------------------------

Everything seems to work perfectly now.

Thanks again to everyone!
 
Archived from groups: rec.games.int-fiction (More info?)

"Chad Elliott" <cewebdev@aol.com> wrote in message
news:1110662855.724991.83690@o13g2000cwo.googlegroups.com...
> So sorry if this message is a repeat, but I couldn't find the answer
> anywhere. I would like to make an object that can be worn, But not
> carried in your inventory. To be more a specific, a seatbelt.
> Whenever I try to wear it, it says (first taking the seatbelt)
>
> The 'Before' directive doesn't seem to be early enough, also i have
> tried replacing the WearSub and DisrobeSub to no avail, it this
> behaviour built into the interpreter?

WearSub is written specifically to act on objects with
the 'clothing' attribute, and to then give them the
additional attribute of 'worn' -- this makes WEAR COAT
work as expected for an item like an overcoat.
Various other parts of the library also pay special
attention to those attributes.

You don't want any of that. You want (and this is
just theory rather than a tested fact) to treat
WEAR BELT as a special case. So leave WearSub and
DisrobeSub alone to handle any general clothing items,
and put all of the special processing in the seatbelt
object. You do that by giving it a 'before' property
which handles the Wear and Disrobe actions. In outline:

is_being_worn false,
before [;
Wear:
if (self.is_buckled == false) {
self.is_buckled = true;
"You buckle up the seatbelt.";
Disrobe:
if (self.is_buckled ) {
self.is_buckled = false;
"You unbuckle the seatbelt.";
],
...

Of course, there's more to it than that -- you
need some more error messages, you need to
prevent movement when the belt is buckled,
etc, etc, but the principle is sound: handle the
special case right where it happens, and let the
library take care of the common stuff.

No, it's not built into the interpreter. And finally,
this is really a question for the authorship group
rec.arts.int-fiction.

Cheers, Roger
--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
You'll find all my IF pages at http://www.firthworks.com/roger
WARNING: aggressive spam deletion -- use a meaningful Subject!
 
Archived from groups: rec.games.int-fiction (More info?)

Here, Chad Elliott <cewebdev@aol.com> wrote:
> Thanks for pointing me toward rec.arts.int-fiction This question was
> already posted there, and it turns out that the "take before wear"
> thing is built into the parser.

No, it's built into the grammar. You can change the grammar for a
particular game. See the "Extend" directive.

--Z

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
*
I'm still thinking about what to put in this space.
 
Archived from groups: rec.games.int-fiction,rec.arts.int-fiction (More info?)

On or about 3/12/2005 7:00 PM, Chad Elliott did proclaim:

> Here is the solution I worked out after reading Zarf's brilliant (as
> usual) advice:
>
> Edited Grammar.h to like this:

a) This really should go to r.a.i-f, which I've cross-posted to. I'd
also set "replies to", but can't figure out how to do that with this
newsreader. So, anyone posting a follow-up to this, please delete
r.g.i-f. Thanks.

b) You don't have to modify grammar.h, instead do this:

#include 'grammar.h';
Extend 'shed' replace
* noun -> Disrobe;
Extend 'wear' replace
* noun -> Wear;