Checking, carrying out, and reporting rules

Newbie trying to help his grandson here again.

I’m trying to construct a check, carry out and report rule set for the following:

Each of 10 rooms in a castle has a “requisite key,” each of which has a specific name depending on which room it is found in. I don’t want the player to leave the room until he has taken the key and put it in the “old sack.”

But I can’t get the rules right (I’ve gone through the manual and several examples). This is what we’re trying to do.

  1. Check if player has not taken taken the key and put it in the “old sack”, then say “Are you missing something?” and disallow leaving room.

  2. If player has carried out taken key and put in sack, deduct one from 10 (required keys). Once all 10 keys are in sack, say, “You got what you need. Return to…”

  3. Report list of key names if player examines (or looks in) sack.

Thank you.

1 Like
A torch is a kind of thing. A torch can be lit.  
A wall-mounted torch is a kind of torch. A wall-mounted torch is usually fixed in place.
The initial appearance of a wall-mounted torch is usually "A torch [if lit]blazes[otherwise]sits[end if] affixed to the wall here."

A key is a kind of thing. The initial appearance of a key is usually "[The item described] lies gleaming in the dust at your feet." 
The indefinite article of a key is "the".
A room has an object called the requisite key.

Lighting it with is an action applying to two things. Understand "light [something] with [something preferably held]" as lighting it with.

Instead of burning a torch, try lighting the noun with your torch.
Check lighting something which is not a torch with something: say "You don't think that will burn." instead.
Check lighting a lit torch with a lit torch: say "That's already on fire." instead.
Does the player mean burning a held torch: it is very unlikely.
Does the player mean lighting a wall-mounted torch with your torch: it is very likely.
Does the player mean taking something which is not fixed in place: it is very likely.

Carry out lighting an unlit torch with a lit torch: 
   now the noun is lit; 
   now the requisite key of the location is in the location.

Report lighting a torch with something: 
   say "You light [the noun] with [the second noun]. Now you can see some things in the chamber you couldn't see before. 
Maybe you should look at the chamber again."

The Chamber of Creatures is a room. The requisite key of the Chamber of Creatures is the Yesod Key.
There is a wall-mounted torch in the Chamber of Creatures.

The Yesod key is a key. The description of the Yesod key is "The Yesod Key is vitality for Galmi's pelvis."
The Wind Chamber is west from Chamber of Creatures. The requisite key of the Wind Chamber is the Tiferes key.
There is a wall-mounted torch in Wind Chamber.

The Tiferes key is a key.
The player holds a torch called your torch. Your torch is lit. Understand "your torch" as your torch.
The player holds an old sack. The old sack is an opaque openable closed container.

The Search is a scene. The Search begins when play begins. The Search ends when every key is in the old sack. 
When the Search ends, say "You got what you need. Return to..."

Check going when the requisite key of the location is not in the old sack:
	say "Are you missing something?" instead.

Test me with "w/light torch/get key/open sack/put key in sack/w/burn torch/put key in sack".

The third item is something that I7 does automatically, so I’m not sure how to help you there.

Scenes may be a not-so-obvious feature here. They’re useful for changing the world in response to conditions being met. I also added some flourishes to make the game flow a little smoother; your mileage may vary on that score. :slight_smile:

1 Like

Wow, you got the previous code in there as well. Impressive.

I think I understand how it all fits together. And you’re correct. I would not have thought of using “scene.”

I’ll give it all a try.

Thank you.

Happy to help! If you want a tester for the game (which is always recommended), I suggest posting it on the forum. Feedback is generally quick. :slight_smile:

So I Eleas, my grandson and I finally implemented the code you suggested above. The key in old sack code worked ok. But the follow code did not implement:

The Search is a scene. The Search begins when play begins. The Search ends when every key is in the old sack.
When the Search ends, say “You got what you need. Return to Clay Chamber.”

In other words, my grandson put all ten keys in the old sack (did an examine old sack to make sure), but the say… never fired.

What might be missing?

I haven’t seen the code, but I would surmise you may have accidentally created additional items of the “key” kind somewhere else. If you want, you could send the entire game source to me via PM, and I’ll see if I can help identifying the issue.

That is very kind of you. I am sending the code as we have it to date. They very might well be a key or other coding artifacts as my grandson’s “story” has evolved, as has our understanding of IF7s capabilities.

Despite the great responses, especially from “Eleas,” I don’t think we’ve got the hang of this. For example, right now the game is boring. Go to a room, light the torch, put the key in the sack, go to the next room. My grandson would like to add a small “puzzle” in each room. Something rudimentary, but slightly different each time. For example, in the Fire Room, when you light the torch, instead of the key “in the dust,” he wants it in a fire. Then he wants to make is necessary to take the key out of the fire with tongs (which are already in the room and visible).

He wants to do this sort of thing in each room. Basically, use some already visible object to do something to retrieve the key. It needn’t be complicated. In fact, given that its 3rd and 4th graders playing the game, it should be obvious. But we are not understanding how to use checking, carrying out, and reporting rules to accomplish what, in another coding language, I might do with if, then, otherwise.

Where should be look to learn these coding procedures, in their simplest forms?

Puzzle writing is a personal thing…we can suggest puzzles, but that mostly comes from playing games and seeing what has come before.

Understand that taking something out of a fire edges into advanced action creation.

[code]
Taking it with is an action applying to two things. Understand “take [something] with [something]” as taking it with.

Check taking:
if the noun is in the fire: [assuming you’ve created the fire as a container]
if the player does not carry the fire tongs:
say “The fire is too hot for you to take that!” instead;
otherwise:
say “Perhaps you ought to try taking it with the fire tongs so you don’t burn your hand…” instead;

Check taking it with when the noun is in the fire:
if the second noun is not the fire tongs:
say “[The second noun] won’t protect your hands from the heat of the fire.” instead.

Carry out taking something with the fire tongs:
say “You grasp [the noun] with the fire tongs carefully.”;
now the player carries the noun.

Report taking something with the fire tongs:
say “You’ve acquired [the noun] with the fire tongs.”[/code]

I may have missed some extra things, but you need to test these types of interactions carefully.

Got it. And here I thought it was a simple matter. Nonetheless, you’ve set forth a pattern I can play with.

Thank you.