Hiding Unnecessary Action Descriptions?

Probably quite simple, but it’s eluding me at the moment…

Here is the small bit of code I’m messing with (let’s ignore poor naming conventions and descriptions for the moment, I’m just getting the foundation down):

[code]A Sewer Grate is a kind of door. A Sewer Grate is usually closed. A Sewer Grate is usually openable. A Sewer Grate is lockable and locked.

Museum Sewer Grate is a Sewer Grate. Museum Sewer Grate is down from Gotham City Museum and up from Sewer Below Museum. The printed name of Museum Sewer Grate is “Sewer Grate”.

Check opening the Museum Sewer Grate:
if the Museum Sewer Grate is locked, say “It is far too heavy”.;
if the Museum Sewer Grate is unlocked, now the Museum Sewer Grate is open.[/code]

Now, this being my first time using “check/if” I’m quite excited it worked as expected, however, I think that I7 is saying just a little too much. This is it’s output in-game:

[code]>go down
(first opening Sewer Grate)
It is far too heavy
It seems to be locked.

open sewer grate
It is far too heavy
It seems to be locked.

unlock sewer grate
(with Sewer Grate)
(first taking Sewer Grate)
That’s fixed in place.[/code]

I really only need a bare minimum amount of output here. The lines “(first opening Sewer Grate),” “It seems to be locked,” “(with Sewer Grate),” and “(first taking Sewer Grate)” are entirely unnecessary. I could maybe put a stop action to prevent something from being said after “it is far too heavy,” but this approach would mess up the formatting and wouldn’t work with the “unlock” command.

Also, what is happening when I say “unlock sewer grate”? I have not yet defined a “key,” so what is I7’s response to trying to unlock something without having any items to unlock the door with? It seems that it by default tries to use the door to unlock itself, but why is the action of “taking Sewer Grate” carried out?

Thanks for any assistance!

Since lock/unlock is a door property built into Inform, I’d probably change it to something custom like…

A sewer grate is a kind of door. A sewer grate can be too heavy or not heavy. A sewer grate is usually too heavy.

Then you’d have to build an if or check conditional to keep the player from opening it if it was too heavy, but it should avoid the built-in locked messages that are applied to doors and containers.

You don’t need to say “now the Museum Sewer Grate is open” at this stage, the rest of the action will deal with it. You need to add instead to the end in order to stop the action at that point.

Try changing this:

To this:

Check opening the Museum Sewer Grate: if the Museum Sewer Grate is locked, say "It is far too heavy." instead.

That should do the trick.

Hope this helps.

I took another look through you code. You probably don’t need to create a kind of door for the sewer grate (I’m assuming there’s just one sewer grate). You just need to define the sewer grate as a locked door. Inform 7 automatically makes any locked door or locked container have the lockable, openable and closed properties so you don’t need to define them.

Also, Inform 7 automatically tries to unlock the sewer grate with the sewer grate because it’s the only item there. You can get a better response just by including the locksmith extension. Try this.

[code]Include Locksmith by Emily Short.

The Museum Sewer Grate is a locked door. Museum Sewer Grate is down from Gotham City Museum and up from Sewer Below Museum. The printed name of Museum Sewer Grate is “Sewer Grate”.

Check opening the Museum Sewer Grate: if the Museum Sewer Grate is locked, say “It is far too heavy.” instead.[/code]

Hope this helps.

@duodave

Thank you for your help. The solution looked quite elegant when you posted it, but I’m not quite sure it would do exactly what I needed it to do (or at least I don’t know how). It seems like it’d be simpler to treat the grate as a locked door like I have and have a crowbar (for example) be the key, than to try and create custom states for a door (maybe it’s just my inexperience talking though–I will certainly explore the solution you’ve offered).

@climbingstars

Thank you for your assistance. Actually, I do intend to have more than one sewer grate (how many exactly, I don’t know), which would each lead into a single sewer system. This is the reasoning for having a defined “sewer grate” and a separate, specifically-named sewer grate in the code. Your suggestion for reducing my initial code into one single line worked wonderfully–didn’t realize how well that could be phrased!

I’ve expanded my code a little bit to allow me to play around with the concept of using an item to open a locked door (and feeling brave, I did my best to code a custom action called “prying” as another subtlety to the “unlocking” process). This being my first go at a custom action, some input would be wonderful.

[spoiler][code]A manhole cover is a kind of door. A manhole cover is lockable and locked.

Museum Manhole Cover is a scenery manhole cover. Museum Manhole Cover is down from Gotham City Museum and up from Below Museum–Sewer. Understand “manhole”,“manhole cover”,“man hole”,“cover” as the manhole cover when the location is Gotham City Museum.

Below Museum–Sewer is below Museum Manhole Cover. The printed name of Below Museum–Sewer is “Sewer”.

Instead of examining the Museum Manhole Cover:
say “A seemingly standard manhole cover. It’s a circular shape, made of heavy steel and possesses a deep-graphite color. On the cover is a rivet design and the letters G.C.W.S.S., representing the Gotham City Waste and Sewage Service.[line break]”

Instead of examining down in the Gotham City Museum:
try examining the Museum Manhole Cover.

Check opening the Museum Manhole Cover:
if the Museum Manhole Cover is locked:
say “It is far too heavy.” instead.

The crowbar is undescribed in Gotham City Museum. The crowbar unlocks the Museum Manhole Cover.

Prying it open is an action applying to one visible thing and one carried thing.
Understand “pry [something] with [something]” as prying it open.
Understand “pry [something] open with [something]” as prying it open.
Understand “pry open [something] with [something]” as prying it open.

Instead of opening the museum manhole cover:
try prying open the museum manhole cover.

Check prying it open:
if the second noun is not carried:
say “You do not have a [second noun] to pry with.”;

Instead of prying open more than once:
say “You’ve already pried that open.[line break]” instead.

Carry out prying it open:
now the noun is unlocked.;
now the noun is open.

Report prying it open:
if the noun is the Manhole Cover:
say “Carefully you take the crowbar and pry the sewer grate free from the road. With all your might, you shove the surprisingly heavy grate away.”.;
otherwise:
say “You pry the [noun] with the [second noun].”

Instead of examining down when the Museum Manhole Cover is open and the location is Gotham City Museum:
say “You look down into the sewer. A ladder can be seen extending down into the blackness.”

Before going down to Below Museum–Sewer:
say “Though all that can be seen is blackness, you begin your descent down the slippery ladder. It’s a 25 foot climb, but the further down you go, the more light is available to you. Soon, you finally reach the bottom.”[/code][/spoiler]

EDIT: So I was going to post the above response yesterday, but it was getting late, so I held off. Well, what was code I was relatively happy with yesterday has somehow managed to become hell to get to work–I could swear it’s acting different today then it was when I last edited it! I’m willing to bet there are a thousand problems associated with my code, but I’m running out of ideas to fix them.

A few notes:

  • I’ve changed the name of the “sewer grate” to “manhole cover” as it’s more the more appropriate term for the item I had in mind.
  • “Below Museum–Sewer” is the new name for “Sewer Below Museum,” I did this to avoid I7 getting confused with something that also began with sewer (but I think I’ve since changed it again…).
  • The crowbar is “undescribed” so that it won’t be explicitly mentioned outside of the description of the room it’s in. For where I’m at currently in writing, it’s probably pointless to have it this way.

Some of the wonderful issues that occur:

  • If the crowbar is in the same room as the manhole cover, but the player is not carrying it, saying “open manhole with crowbar” will automatically make the player take the crowbar and use it. There’s probably a good reason that I7 does that, but since I’m unaware of it, it seems like it’s doing the player a favor (so to speak).

  • Speaking of “open manhole with crowbar,” I can’t seem to figure out how to make I7 think of “opening” as “prying.” You’ll notice the “instead of opening…” code I have, but it seems to be ineffective. Currently, if you say “open manhole with crowbar,” it will only respond with “You unlock the Museum Manhole Cover.” While this effectively “unlocks” the manhole cover but does not “open” it (somehow), it ignores the reporting that should execute from “prying.”

  • As a result of the above, a bug then occurs when the player tries going down after “opening” the manhole with the crowbar (and not prying). The output is:

[code]Though all that can be seen is blackness, you begin your descent down the slippery ladder. It’s a 25 foot climb, but the further down you go, the more light is available to you. Soon, you finally reach the bottom.

(first opening Museum Manhole Cover)
You must supply a noun.[/code]

As always, your help is greatly appreciated.

It looks to me like it’s executing your “before going down” before the parser tries to go down. Since the sewer is still locked, you get the message that you go down, but it’s false. You need to introduce a conditional in your before statement to check the status of the sewer before reporting that the player successfully goes down.

I’ve found quite a few issues with your code here.

  1. You’ve defined the prying action as “prying the noun open the second noun”, yet you say this.
try prying open the museum manhole cover

Here, Inform thinks the second noun is the museum manhole cover and doesn’t define the first. That’s why it says “You must supply a noun.”. I suggest you define the prying action as “prying the noun with the second noun” for simplicity.

  1. You say this.
Instead of examining the Museum Manhole Cover: say "(description)".

It’s much simpler and a lot easier to use the built in code for descriptions, like so.

The description of the Museum Manhole Cover is "(description)".
  1. This rule will never fire.

Check opening the Museum Manhole Cover: if the Museum Manhole Cover is locked: say "It is far too heavy." instead.

Because of this one.

Instead of opening the museum manhole cover: try prying open the museum manhole cover.

  1. This rule occurs too early.

Before going down to Below Museum--Sewer: say "Though all that can be seen is blackness, you begin your descent down the slippery ladder. It's a 25 foot climb, but the further down you go, the more light is available to you. Soon, you finally reach the bottom.".

The player appears to climb down the ladder, reach the bottom and then pry open the museum manhole cover. A report rule is best here, like so.

Report going down to Below Museum--Sewer: say "Though all that can be seen is blackness, you begin your descent down the slippery ladder. It's a 25 foot climb, but the further down you go, the more light is available to you. Soon, you finally reach the bottom.".

  1. This is a bad idea.

Instead of prying open more than once: say "You've already pried that open.[line break]" instead.

This will prevent prying more than once, even if the action failed the first time and the museum manhole cover is still closed and locked.

  1. I probably should have made this more clear from before. I don’t think you need to make a kind of door for the manhole cover here, even if there is more than one. You can define them all as locked doors, since they pretty much are doors in their own right. The only time you really need to create a kind of door is when you need a conduit between two rooms that doesn’t behave like a standard door like a hedge or a flight of stairs, which shouldn’t be lockable or openable.

Try this.

[code]A manhole cover is a kind of door. A manhole cover is lockable and locked.

Museum Manhole Cover is a scenery manhole cover. Museum Manhole Cover is down from Gotham City Museum and up from Below Museum–Sewer. Understand “manhole”,“manhole cover”,“man hole”,“cover” as the manhole cover when the location is Gotham City Museum.

The description of the Museum Manhole Cover is “A seemingly standard manhole cover. It’s a circular shape, made of heavy steel and possesses a deep-graphite color. On the cover is a rivet design and the letters G.C.W.S.S., representing the Gotham City Waste and Sewage Service.”.

Below Museum–Sewer is below Museum Manhole Cover. The printed name of Below Museum–Sewer is “Sewer”.

Instead of examining down in the Gotham City Museum: try examining the Museum Manhole Cover.

The crowbar is undescribed in Gotham City Museum. The crowbar unlocks the Museum Manhole Cover.

Prying it with is an action applying to one visible thing and one carried thing.
Understand “pry [something] with [something preferably held]” as prying it with.
Understand “pry [something] open with [something preferably held]” as prying it with.
Understand “pry open [something] with [something preferably held]” as prying it with.

Instead of opening the museum manhole cover: try prying the museum manhole cover with the crowbar.

Check prying it with:
if the second noun is not carried, say “You do not have a [second noun] to pry with.” instead.

Check prying it with:
if the noun is open, say “You’ve already pried that open.” instead.

Carry out prying it with:
now the noun is unlocked;
now the noun is open.

Report prying it with:
if the noun is the Manhole Cover begin;
say “Carefully you take the crowbar and pry the sewer grate free from the road. With all your might, you shove the surprisingly heavy grate away.”;
otherwise;
say “You pry the [noun] with the [second noun].”;
end if.

Instead of examining down when the Museum Manhole Cover is open and the location is Gotham City Museum: say “You look down into the sewer. A ladder can be seen extending down into the blackness.”.

Report going down to Below Museum–Sewer: say “Though all that can be seen is blackness, you begin your descent down the slippery ladder. It’s a 25 foot climb, but the further down you go, the more light is available to you. Soon, you finally reach the bottom.”.[/code]

Hope this helps.