Help with digging

So far, my rules for digging are:

Rule for supplying a missing noun while digging:
now noun is the location.
Understand “dig” or “dig hole/here” or “dig in ground/dirt/earth” as digging. Digging is an action applying to one thing.
Instead of digging when the player does not carry the rusty spade:
say “You have nothing to dig with”.
A room can be either diggable or undiggable.
Instead of digging in a room which is undiggable, say “The floor here doesn’t exactly invite digging”.

What i want to do is have it like in the game LASH if you know it.

If you dig in a ‘diggable’ room, a hole appears. If you dig in a room which already has a hole, the hole gets bigger and becomes enterable. If you dig in a room that already has a large hole, it displays the message “When you find yourself in a hole…”

How would i do this?

Also, how would i have other objects appear in the holes if you dig in the right area?

Thanks in advance :slight_smile:

To get an object to appear in a hole after digging a few times, you could try something like this.

[code]“Test”

A diggable room is a kind of room. A diggable room has a number called the dig depth. The dig depth of a diggable room is usually zero.

Digging is an action applying to nothing. Understand “dig”, “dig hole/here” and “dig in ground/dirt/earth” as digging.

Check digging (this is the standard check digging rule):
if the location of the player is not a diggable room, say “The floor here doesn’t exactly invite digging.” instead;
if the dig depth of the location of the player is greater than four, say “You’ve already dug as deep as you possibly can here, you don’t need to dig again!” instead;
if the player does not hold the rusty spade, say “You have nothing to dig with.” instead.

Carry out digging (this is the standard carry out digging rule):
increment the dig depth of the location of the player;
if the dig depth of the location of the player is greater than four, move the chest to the location of the player.

Report digging (this is the standard report digging rule):
say “[if the dig depth of the location of the player is five]After all that digging, you finally find something. A treasure chest[otherwise if the dig depth of the location of the player is zero]You start digging[otherwise]You dig even further[end if].”.

The Forest is A Diggable Room. The description of the forest is “[if the dig depth of the forest is zero]The ground is smooth here[otherwise]You have dug a hole here[end if].”.

The rusty spade is in the forest. The treasure chest is a closed openable container. The map is in the chest.

Test me with “dig / take spade / dig / dig / dig / dig / dig / l / take chest / open chest / take map”.[/code]

Here you have to dig five times before you get to the treasure chest, which is moved into scope at the right time.

To have the hole become enterable, you can use a similar concept by moving an enterable container (such as a tunnel) into scope instead and then move the player upon entering it if necessary.

Hope this helps.

That’s great, but there are three problems:

  1. When i dig for the first time, it says “you dig even further”
  2. All rooms contain the treasure chest when you did far enough.
  3. The hole you make cannot be examined.

Any way of fixing these?

Try this.

[code]“Test”

Underlying relates various things to one room. The verb to underlie (he underlies, they underlie, he underlaid, it is underlaid, he is underlying) implies the underlying relation. The verb to be under implies the underlying relation. The verb to be beneath implies the underlying relation.

A diggable room is a kind of room. A diggable room has a number called the dig depth. The dig depth of a diggable room is usually zero.

Definition: A room is dug if it is a diggable room and the dig depth of it is not zero.

Digging is an action applying to nothing. Understand “dig”, “dig hole/here” and “dig in ground/dirt/earth” as digging.

Before digging (this is the set noun to player’s location rule): now the noun is the location of the player.

Check digging (this is the standard check digging rule):
if the noun is not a diggable room, say “The floor here doesn’t exactly invite digging.” instead;
if the dig depth of the noun is greater than four, say “You’ve already dug as deep as you possibly can here, you don’t need to dig again!” instead;
if the player does not hold the rusty spade, say “You have nothing to dig with.” instead.

Carry out digging (this is the standard carry out digging rule):
increment the dig depth of the noun;
if the dig depth of the noun is one, update backdrop positions.

After digging when something is under the noun and the dig depth of the location of the player is greater than four (this is the reveal hidden items rule):
say “You gather up [a list of things which underlie the noun] hidden underneath [the printed name of the noun in lower case].”;
now everything under the noun is in the noun;
now everything under the noun is not under the noun.

Report digging (this is the standard report digging rule):
say “[if the dig depth of the noun is one]You start digging[otherwise]You dig even further[end if].”.

When play begins (this is the set backdrop positions rule):
move the hole backdrop to all dug rooms.

The hole is a backdrop. The hole is not scenery. The initial appearance of the hole is “You have dug a hole here.”. The description of the hole is “A very holey hole.”.

The Forest is A Diggable Room. The description of the forest is “A very foresty forest.”.

The rusty spade is in the forest. The treasure chest is under the forest. The treasure chest is a closed openable container. The description of the chest is “A very chesty chest.”. The map is in the chest. The description of the map is “A very mappy map.”.

Test me with “dig / take spade / dig / l / x hole / dig / dig / dig / dig / x hole / l / take chest / open chest / take map”.[/code]

Hope this helps.

That second bunch of code flags up three problems:

Problem. You wrote ‘The verb to underlie (he underlies, they underlie, he underlaid, it is underlaid, he is underlying) implies the underlying relation’ : but new verbs can only be defined in terms of existing relations, all of which have names ending ‘relation’: thus ‘…implies the possession relation’ is an example of a valid definition, this being one of the relations built into Inform.


Problem. You wrote ‘The verb to be under implies the underlying relation’ : again, new verbs can only be defined in terms of existing relations.


Problem. You wrote ‘The verb to be beneath implies the underlying relation’ : again, new verbs can only be defined in terms of existing relations.

Do you have this line?

Underlying relates various things to one room.

Missing out this line would give those errors.

Hope this helps.