Two ways to open containers

i want the player to be able to either break a crate open with their fists or pry it open with a crowbar. how can i do this? here’s my code. i7 doesnt like it.

After breaking the crates:
say “OUCH! SPLINTERS! As you painstakingly pick them out, you see a Build-Your-Own torch kit and a backpack. The backpack looks suprisingly roomy.”
now Build-Your-Own Torch Kit is in the room. “It looks like a Gunpla box, honestly. Its a very well made box with shiny embossed letters. and an x ray of a hero carrying a torch.”
now Backpack is in the room. “A leather backpack. Need i say more?”

Understand “punch crates” as breaking the crates.

The Backpack is a player’s holdall. The backpack is wearable.

The carrying capacity of the player is 50.

Understand “prying open” as something new.

After prying open the crates:
say: “The crates come open. You see a 'Build-Your-Own Torch kit and a backpack. The Backpack looks surprisingly roomy.”
now Build-Your-Own Torch Kit is in the room. “It looks like a Gunpla, honestly. Its a very well made box with shiny embossed letters. and an x ray of a hero carrying a torch.”
now Backpack is in the room. “A leather backpack. Need i say more?”

1 Like

the descriptions are a little rough because this is the first draft of the dungeon test.

Okay, here’s a list of things that can help.

After rules
When writing after rules (and most rules), the standard format is to indent every line underneath it so that inform knows it ‘belongs’ to the after rule.

Also, inform rules act like a sentence, so if you end with a period, the rule is over. End each line with a semicolon (the last one could be a period but I like all semicolons). So you could have a rule like this:

After breaking the crates:
	say “OUCH! SPLINTERS! As you painstakingly pick them out, you see a Build-Your-Own torch kit and a backpack. The backpack looks suprisingly roomy.”;
	now Build-Your-Own Torch Kit is in the room;
	now Backpack is in the room;

Items

Inform allows for weird combinations of text, so it gets confused unless you lay things out in a logical order. You should define objects before you use them.

So, before the after rule, you should tell inform that these things are, well, things:

Mine is a room.

The crates are a plural-named thing in Mine.
The Build-Your-Own Torch Kit is a thing.
The backpack is a thing.

Notice that if you want something to be plural you have to say it’s plural, and if you want something to be in a room, you have to define the room and then say it’s in the room.

Now, you’ve included some text in quotes after each item. If you do that, it changes the ‘initial appearance’ of the item; that is, it changes how the game will display them. So if you included what you currently have, a room would like this:

Mine

You are in a mine.

It looks like a Gunpla box, honestly. Its a very well made box with shiny embossed letters. and an x ray of a hero carrying a torch.

A leather backpack. Need i say more?

I don’t think that’s what you want. It looks like you actually want to change the description of objects. So you can change those earlier lines to:

The Build-Your-Own Torch Kit is a thing. The description of the build-your-own-torch kit is "It looks like a Gunpla box, honestly. Its a very well made box with shiny embossed letters. and an x ray of a hero carrying a torch.".
The backpack is a thing. The description of the backpack is “A leather backpack. Need i say more?”

Verbs

You only need to say ‘as something new’ if you’re changing an old action. ‘Prying open’ doesn’t already exist, so you don’t need that line.

It’s best to use previous actions when possible. So instead of making a ‘punch’ action, you can just use the ‘attacking’ action which already exists.

So now you can just say:

After attacking the crates:

Similarly, instead of making a prying action, you can just use the opening command. And you can require them to have a crowbar. You can say something like:

The crowbar is a thing in Mine.

Before opening the crates:
	If the crowbar is not held by the player:
		say "You can't open the crates without a crowbar!" instead;

(Edit: Draconis below suggests using the ‘unlocking’ action, which would actually be perfect for this!)

Overall

It looks to me like you’re attempting several new things at once. While that’s possible, it’s much easier to try making a small room or small test game for each new concept. I’d recommend not trying to make something huge until you’ve mastered the small. But that’s just my advice! I would try making one room, then a room with an object, then a room with an object and a verb, etc.

4 Likes

It is helpful if you (a) report the errors you’re getting and (b) quote code with the </> button, not the quote button. (That will preserve indentation.)

4 Likes

i will right now, hold on

Inform is also particular about what you call your actions. By default, BREAK CRATE will map to the attacking action, and OPEN CRATE WITH CROWBAR will map to the unlocking it with action. (PRY isn’t recognized at all, but I would make it also map to unlocking it with, which is the general “use a tool to open something” action.)

4 Likes

As the error message indicates and as @mathbrush wrote above, you need to separate the sentences by putting a full stop or a semicolon (when you’re writing a rule containing several statements) between them.

And as mathbrush also said, the things and their descriptions should be defined beforehand, and then just be moved into the location at the right time.

Example:

The Cave is a room.

The crate is in the Cave.

The block attacking rule does nothing when attacking the crate.

The kit is a thing. The description of the kit is "A kit.".

The backpack is a thing. The description of the backpack is "A backpack.".

After attacking the crate:
	say "The crate breaks into small splinters.";
	now the kit is in the cave;
	now the backpack is in the cave;
	now the crate is nowhere;
4 Likes