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?
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])".
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 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.
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.
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ā.
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.