Old timey "Use with" Inform7 command syntax

Totally unrelated to your question, but I’d never heard “banana palm” before now. Google turns up some hits, though. Is the name “banana palm” a regional thing?

The plants that bananas grow on are definitely not palms (I have both bananas and palms growing outside). If you’re talking about the same plant, you might want to get rid of “palm” there, unless “banana palm” is more familiar to your readers?

Oh, that’s an easy fix. Replace your “instead of taking…” rule with this:

Instead of taking the carcass:
    say "You can't take it with your bare hands, for whatever reason. You'll need to use something else."

Then maybe add some more syntaxes to help the players out:

Understand "use [something preferably held] to take [things]" as getting it with (with nouns reversed).
Understand "use [something preferably held] on [the carcass]" as getting it with (with nouns reversed).

I’ve made the second line specific to this object, so that it won’t catch all attempts to USE something. Alternately, remove that second line, and use this instead:

Using it on is an action applying to two things.
Understand "use [something preferably held] on [something]" as using it on.

Check using something on something: say "Please be more specific." instead.
Instead of using something on the carcass:
    say "(using [the noun] to lift [the carcass])[command clarification break]";
    try getting the carcass with the noun instead.

This creates a generic “use X on Y” verb that does nothing by default, but can be overridden with Instead rules that redirect to more useful actions.

So, like this…

Instead of taking the carcass:
	say "You can't take it with your bare hands, for whatever reason. You'll need to use something else."
	otherwise:
		say "It’s too rotted and begins to disintegrate when you touch it. The old banana leaves are browned and soft and they tear as you try to get a grip on them." instead.

Understand "use [something preferably held] to take [things]" as getting it with (with nouns reversed).
Understand "use [something preferably held] on [the carcass]" as getting it with (with nouns reversed).

Oh boy. It’s talking about it maybe being right but there being a tab problem. I’m fiddling at the moment.

Sorted!

I had an extra line in there and then some weird tabbing.

Thank you for your patience.

I’d recommend breaking out of the habit of using Instead rules to accomplish everything.


Check taking the carcass:
	say "You can't take it with your bare hands, for whatever reason. You'll need to use something else." instead;

Check getting the carcass with the banana leaves:
     say "It’s too rotted and begins to disintegrate when you touch it. The old banana leaves are browned and soft and they tear as you try to get a grip on them." instead.

Instead halts all other parsing Inform 7 may do, such as checking for light, or checking that the player can get the carcass with the banana leaves when it may be infeasible for another reason - say the banana leaves are in a locked box. An Instead rule will not allow the parser to interrupt for some other logical reason you might not have thought of within the game world.

You’re also using bracketed comments like [JUMP DEATH] - Inform has “headings” for this which you’ll find quite useful - you can narrow your source to specific headings to focus down on them, and also mark them “not for release” and include testing commands that will work if you release for testing, but will be disabled when you publish from the IDE.

  • Volume
  • Book
  • Part
  • Chapter
  • Section

(Remember “Very Bad People Choose Satan” as the heirarchy.)

That’s exactly the sort of tip I need. I want sleek clean code. If I understand correctly “check” is for situations where you want to react to a certain input which is wrong but you want to give a hint?

Is the line below is an appropriate use?

Instead of going south in the headland for the first time:
	say "It's a long way down and there are sharks waiting at the bottom. It doesn't seem very safe.";
	stop the action;

I’m reading about headings. That’s a really handy tip.

Looking at headings, in a long piece with complex plotting and areas you never return to they look very useful.

If I only have a relatively small number of locations, say 40, for a game and not distinct sections how do you think they’d help or is it more about developing good habits as the stories grow?

An Instead rule stops the action by default (Instead stops all other rules from firing, thus use with caution) otherwise, it’s legit.

Be aware that “for the first time” can be an issue if it’s involved in an action that can fail but needs to convey important information. “For the first time” is only true the first time the player tries the action whether successful or not:

After examining the very important rock for the first time: say "You find the secret word XYZZY written on it and it fades away. You commit it to memory, knowing you will never see this again."

If the first time the player examines the rock they are in a dark room, examining will fail per the standard darkness rule and they won’t get the description. If they then carry it into the light and examine it again, they are no longer examining it for the first time.

You can get around this with text variation:

The description of the very important rock is "[one of]You find the secret word XYZZY written on it and it fades away. You commit it to memory, knowing you will never see this again.[or]It's a normal rock with nothing special written on it.[stopping]"

Text variations only increment when the text actually displays.

Sectioning your source code is a good habit. It allows you to gate material “not for release”, and if you write an extension or “release along with a website and the source text” the sections will be neatly formatted hyperlinks on the website that is released - which may or may not matter to you!


I’ve exhausted my searching skills to solve this conundrum. I want the room Shallows to display something different when someone goes to it once they’ve fed the pig carcass to the sharks. This is my most recent attempt which is still not good. I have area51 as a room that players can’t get to but where items hide out.

The Shallows is a room. shallows is south of beach.
Before looking when area51 contains the pig carcass:
	say "The surface of the ocean, once dotted with sharp grey fins, is now clear and inviting, the GOSUB jet a leisurely swim away.";
	
otherwise:
		say "The water laps at your ankles as you gaze out at the remains of the GOSUB jet, and beyond, to the open ocean.  The water’s cool but not cold. This would be the perfect spot to go for a swim if only it weren’t for all those circling grey fins. It's a miracle you made it to shore.";
sharks-fed is a truth state that varies. [truth states default to FALSE]

Carry out [feeding the pig carcass to the sharks - however this works]:
     now sharks-fed is true.

The Shallows is a room. "The water laps at your ankles as you gaze out at the remains of the GOSUB jet, and beyond, to the open ocean.  The water’s cool but not cold.[if sharks-fed is false] This would be the perfect spot to go for a swim if only it weren’t for all those circling grey fins. It's a miracle you made it to shore.[else]The surface of the ocean, once dotted with sharp grey fins, is now clear and inviting, the GOSUB jet a leisurely swim away.[end if]". shallows is south of beach.

What you’ve described as “Area51” sounds a lot like “off-stage” which is the built-in I7 term for the nebulous location where anything not enclosed by a game location is located before you bring it into the world.

Alternately (hopefully without confusing you) if you have an object or an NPC that represents the sharks, you can say

the school of sharks can be fed. [once again, 'can be' defaults to not true]

carry out [doing whatever the player does to feed the sharks]: now the school of sharks is fed.

The description of Shallows is "The ocean [if the school of sharks is not fed]teems with maneating sharks. Best not go in the water.[else]is placid and clear of any apex predators. A swim would be nice![end if]"

My eyes let me down!

I read several of your replies to other people and I couldn’t make the off_-_stage work. I missed the hyphen every time. Duh!

I understand the truth state piece. That’s really good. That else if is familiar territory and I’ll likely use that as it feels better.

Now,to be sure I understand the Carry out part. In the game, the player gets the leaves then uses them to carry the carcass and takes the carcass to the headlands where they throw it off feeding the sharks and making it possible to swim.

in a [truth states] section or whatever at the top i’d write-

the school of sharks can be fed.

So in the headland view section I’d write:

after dropping the pig carcass: now the school of sharks is fed

Then in the shallows I’d write-

The description of Shallows is "The ocean [if the school of sharks is not fed]teems with maneating sharks. Best not go in the water.[else]is placid and clear of any apex predators. A swim would be nice![end if]"

Finally in the off-stage section (I got the hyphen this time!) I'd write
`there is a school of sharks`

Then a step further:

Beach is a room. "You're on the beach. The ocean is south. [if school of sharks is in the Ocean]You probably don't want to go in the ocean due to that school of sharks swimming just offshore.[endif]"

The Ocean is an enterable container in Beach. "The ocean sparkles majestically to the south." The ocean is open. The ocean is unopenable. The ocean is fixed in place. Instead of going south in Beach: try entering the ocean. Instead of going north when the player is in the ocean: try exiting. [Instead rules here redirect the player’s NORTH and SOUTH commands, basically pretending the ocean is mapped to a direction, but actually putting them into and taking them out of the “ocean” container. GET OUT OF WATER/OCEAN and NORTH will both parse to the action EXIT (the container the player is in by default)]

Understand "water" as the ocean when the location is Beach.

The school of sharks is in the ocean. School of sharks is fixed in place. The description of school of sharks is "Vicious, apex predators."

Every turn when the player is in the ocean and school of sharks is in the ocean: end the story saying "You have been eaten alive by a school of maneating sharks!"

a pig carcass is in beach. "The carcass of a pig decomposes on the beach." The description is "Eew. Not appetizing at all, unless you're a shark, perhaps."

After inserting pig carcass into the ocean when school of sharks is in the ocean:
     now school of sharks is off-stage;
     say "You heave the grotesque carcass into the water where it is immediately and violently consumed by the sharks. Soon there is nothing left but the bones. The sharks must be quite full now."

As long as you have an actual item in the game world representing the sharks - then you can define adjectives for it like “fed”. (see my second example)

After dropping the pig carcass in Headland:
     Say "You heave the carcass over the edge. It lands in the water with the sharks. Too bad for the ex-pig!";
     now pig carcass is off-stage;
     now the school of sharks is fed.

Look at my other example. “There is a school of sharks.” alone without putting them in a location creates them off-stage which is fine if you want to just apply an adjective to them. But unless you’re going to create the sharks as an item (or scenery, or an NPC) that’s interactable in the game world, you might as well just use the truth state.

I’m not saying you have to do it the way I did, making the sharks in the ocean which is an enterable container, but (to me at least) that’s the best way to simply do what you’re wanting to accomplish using Inform’s built-in actions - “put carcass in ocean” works without much further fuss if the carcass is an object and the ocean is a container to insert it into.

(That was basically just a quick example without using your map design where I’m assuming the Headlands overlooks the beach and you want the player to drop the carcass there to trigger the sharks not being dangerous anymore.)

That’s a great explanation, and elegant too.

Is “school” causing a problem somehow?

Problem. You wrote ‘the school of sharks can be fed’ : but only a room, a thing or a kind can have such adjectives applied to it,

You might need to move that line down in the code to a point after the school of sharks has been defined. I wasn’t intending to write an entire example at first so I didn’t test it in the IDE. Whoops!

1 Like

That did the trick.