Taping (and untaping) two objects

I have a puzzle where the player need to tape an object to the end of another object in order to be able to open a hatch in the ceiling and I am at a total loss as to how to do this. If I were to limit the possible items involved to two (i.e. taping a bent fork to a stick) I could hack something together. But I am wanting to give the player some options on how to do this and thus need a more generalized solution.

This is my start to the problem:

Taping it to is a action applying to two visible things. Understand "tape [something] to [something preferably held]" as taping it to.

Check taping it to:
	if the player is not carrying duct tape:
		say "You don't have any tape." instead.
		
Carry out taping it to:
	now the noun is part of the second noun;
	say "You tape the [noun] to the [second noun]."

But then I run into the problem of the second noun (the bent fork from above) not being mentioned.

Am I on the right track or is there a better approach?

1 Like

By default, the parts of things are not mentioned.

It is helpful to give Inform a little more context about the situation. Relations are a good tool for this:

Taping it to is an action applying to two visible things. Understand "tape [something] to [something preferably held]" as taping it to.

Check taping it to:
	if the player is not carrying duct tape:
		say "You don't have any tape." instead.
		
Adhesion relates a thing (called affixee) to various things. The verb to adhere to means the reversed adhesion relation.

Carry out taping it to:
	now the noun is part of the second noun;
	now the noun adheres to the second noun;
	say "You tape [the noun] to [the second noun]."

Definition: a thing is duct-taped if something adheres to it.

After printing the name of something duct-taped (called base):
	unless taping something to:
		let glob be the list of things adhering to base;
		say " (to which [regarding the number of entries in glob][are] affixed [glob with indefinite articles])".
3 Likes

I was thinking relationships would be part of the solution. I’m still trying to wrap my head around relationships so this would just force the issue. Thank you.

I would strongly recommend reading Inform 7 Concepts and Strategies: Computational Approaches to Narrative as an initial orientation. (It’s one of many links available from the I7 documentation and resources pinned post.)

I wonder if you could just create new grammar for the existing tying it to action, then adapt the code from Writing With Inform ex 36 - Brown with a custom relation that basically re-uses all of the code for something being “part of” something else, but without making the second thing undescribed.

2 Likes

The way I’d do this is to use the method commonly used in point and click adventures, which is to replace the two items with a third item. I do this often enough that I have an extension that takes care of the heavy lifting and all you need to do is fill in a small table.

"Test"

Include Combining by Brent Worthington.

Use no deprecated features.

To tape is a verb. To untape is a verb.

Understand the command "tape" as "tie".

Understand the command "untape" as "untie".

The can't combine the noun with the second noun rule response (A) is "[We] [can't tape] [the noun] and [the second noun] into anything useful.".
The no need to combine the noun with the second noun rule response (A) is "[We] already [have] [an item built]!".
The standard report tying it to rule response (A) is "[We] [tape] [the noun] and [the second noun] together. [We] now [have] [an item built].".
The can't untie the noun rule response (A) is "[The noun] [can't be] untaped.".
The standard report untying rule response (A) is "[We] [untape] [the noun]. [We] now [have] [a first item] and [a second item].".
The check single object combining rule response (A) is "[We] [need] to tape [the noun] to something.".
The standard carry out combining rule response (A) is "[We] [can't tape] more than two things at a time.".

Table of Items (continued)
component list	finished item
{ stick, bent fork }	back scratcher

There is a back scratcher.

The Testing Room is A Room. The player carries a stick and a bent fork.

Test me with "i / tape stick to fork / i / untape back / i".

And here’s the extension needed to make this work.

Combining.i7x (6.4 KB)

Hope this helps.

1 Like

I am getting an error when I use the word “adhering”.

Problem. In the sentence ‘let glob be the list of things adhering to base’ , I was expecting to read a description of values, but instead found some text that I couldn’t understand - ‘things adhering to base’.

I was trying to match this phrase:

list of (things adhering to base - description of values)

But I didn’t recognise ‘things adhering to base’.

Most likely you did not include the previous few lines defining the adhesion relation.

Here is the entirety of the code I’m running:

Lab is a room

Some duct tape, a broom, and a hanger is carried by the player.

Taping it to is a action applying to two visible things. Understand "tape [something] to [something preferably held]" as taping it to.

Check taping it to:
	if the player is not carrying duct tape:
		say "You dont have any tape." instead.
		
Check taping it to:
	if the noun is duct tape or the second noun is duct tape:
		say "You can't tape tape." instead.

Adhesion relates a thing (called affixee) to various things. The verb to adhere to means the reversed adhesion relation.

Carry out taping it to:
	now the noun is part of the second noun;
	now the noun adheres to the second noun;
	say "You tape [the noun] to [the second noun]."

Definition: a thing is duct-taped if something adheres to it.

After printing the name of something duct-taped (called base):
	unless taping something to:
		let glob be the list of things adhering to base;
		say " (to which [regarding the number of entries in glob][are] affixed [glob with indefinite articles])".

And this is the error:

Problem. In the sentence ‘let glob be the list of things adhering to base’ , I was expecting to read a description of values, but instead found some text that I couldn’t understand - ‘things adhering to base’.

I was trying to match this phrase:

list of (things adhering to base - description of values)

But I didn’t recognise ‘things adhering to base’.


Problem. In the line ‘say " (to which [regarding the number o […] d [glob with indefinite articles])"’ , I was expecting that ‘regarding the number of entries’ would be something to ‘say’, but it didn’t look like any form of ‘say’ that I know. So I tried to read ‘regarding the number of entries’ as a value of some kind (because it’s legal to say values), but couldn’t make sense of it that way either.

Sometimes this happens because punctuation has gone wrong - for instance, if you’ve omitted a semicolon or full stop at the end of the ‘say’ phrase.


Problem. In the line ‘say " (to which [regarding the number o […] d [glob with indefinite articles])"’ , I was expecting that ‘glob’ would be something to ‘say’, but it didn’t look like any form of ‘say’ that I know. So I tried to read ‘glob’ as a value of some kind (because it’s legal to say values), but couldn’t make sense of it that way either.

Sometimes this happens because punctuation has gone wrong - for instance, if you’ve omitted a semicolon or full stop at the end of the ‘say’ phrase.

This seems to work:

let glob be the list of things that adhere to base;

Thank you so much.

A difference in allowed syntax between 9.3/6M62 and 10.1.

1 Like

Now I am needing help with untaping objects. Specifically removing the adheres condition.

You probably want something like:

Now the noun does not adhere to anything;

Boom, thank you.

1 Like