A grapnel that can be tied to a rope and thrown upward, allowing the player to climb to an adjacent map

Ok, my check for untying the rope was redirecting to a check for taking the rope, because taking the rope is necessary to untie the rope. I got rid of the check for taking the rope, and tried to block the player from going in a direction from the alleyway while the rope is still attached to the spool. This isn’t working though. Nor does my check for untying the rope from the spool when the bucket is attached to the rope.

Section 4(f) - Alleyway

The Alleyway is northwest from the Village Square.
The description of the Alleyway is "Tucked in a corner of this alleyway is an old stone [well] with a [winch] at the top.[if the golden bucket is in the Alleyway and the hemp rope is attached to the golden bucket and the hemp rope is attached to the spool]  A [golden bucket] hangs from the [winch] by a piece of [hemp rope].[end if][paragraph break]The village square lies to the southeast."

Instead of going down in the Alleyway:
	say "You jump down into the well...";
	wait for any key;
	say "You fall for what seems like an eternity, then everything is dark and wet.  Consciousness fades and never returns.";
	end the story.

Check climbing the hemp rope:
	if the hemp rope is attached to the spool:
		say "Descending that rope will not end [i]well[/i].";
		stop the action.
	
Check going in a direction from the Alleyway:
	if T'sino carries the hemp rope:
		if the hemp rope is attached to the spool:
			say "The hemp rope is still attached to the winch.  You'll have to drop the rope if you want to go anywhere.";
			stop the action;
		otherwise:
			continue the action;
	otherwise:
		continue the action.
		

[WELL]
The well is in the Alleyway.
The well is fixed in place.
The description of the well is "This little stone well is the only source of water for the entirety of Drytown.  At the top of the well head is winch."

The winch is part of the well.
The description of the winch is "The well's simple winch consists of a spool that is turned by a crank."

The spool is part of the winch.
The description of the spool is "The winch has a cylindrical spindle[if the rope is attached to the spool], to which is attached a length of sturdy hemp rope.[end if][if the golden bucket is in the Abyss and the hemp rope is attached to the spool]  The hemp rope dangles into the well, and you can't see the other end.[end if][if the golden bucket is in the Alleyway and the golden bucket is attached to the hemp rope and the hemp rope is attached to the spool]  At the end of the hemp rope is a golden bucket.[end if]" 

The crank is part of the winch.
Understand "handle" or "hand crank" as the crank.
The description of the crank is "Attached to the spool of the winch is a hand crank, which can be turned to raise or lower the bucket.[if the crank is broken]  The hand crank seems to be broken."

Brokenness is a kind of value.  The brokennesses are unbroken and broken.  A thing has a brokenness.  A thing is usually unbroken.

After turning the crank:
	if the hemp rope is attached to the spool:
		if the golden bucket is in the Abyss:
			say "The crank seems a bit stiff, unable to turn the spool, so you force it with all your might.  Suddenly there's a loud snap, and the bucket rockets to the top of the winch with a metallic clang!  The crank appears to be broken now.";
			now the crank is broken;
			now the golden bucket is in the Alleyway;
		otherwise:
			say "The crank appears to be broken."
			
Check turning the crank:
	if the crank is broken:
		say "The crank appears to be broken.";
		stop the action;
	otherwise:
		continue the action.

Instead of turning the spool:
	try turning the crank.
	
Instead of turning the winch:
	try turning the crank.

[HEMP ROPE]
The hemp rope is a rope in the Alleyway.
Understand "rope" as the hemp rope.
The hemp rope is attached to the spool.
The hemp rope is attached to the golden bucket.
The description of the hemp rope is "A length of sturdy hemp rope."

[Check taking the hemp rope:
	if the hemp rope is attached to the spool:
		say "The hemp rope is still tied to the spool of the winch.";
		stop the action;
	otherwise:
		continue the action.]
		
Check untying the hemp rope from the spool:
	if the hemp rope is attached to the golden bucket:
		if the golden bucket is in the Abyss:
			say "If you untie the rope while the bucket is still in the well, the rope and bucket will be lost forever into the abyss.";
			stop the action;
		otherwise:
			say "You need to get the bucket off the rope first.";
			stop the action;
	otherwise:
		continue the action.

After untying the hemp rope from the spool:
	say "You untie the hemp rope from the spool and pocket the rope.";
	now the player carries the hemp rope.


[ABYSS]
The Abyss is down from the Alleyway.
The printed name of the Abyss is "abyss".

[GOLDEN BUCKET]
The golden bucket is a thing in the Abyss.
The golden bucket is unevenly shaped.
The description of the golden bucket is "An open-top cylindrical pail, apparently made of gold."

Check taking the golden bucket:
	if the golden bucket is attached to the hemp rope:
		if the hemp rope is attached to the spool:
			say "You need to untie the bucket from the rope first.";
			stop the action;
		otherwise:
			continue the action;
	otherwise:
		continue the action.

yields:

Alleyway
Tucked in a corner of this alleyway is an old stone well with a winch at the top.

The village square lies to the southeast.

The hemp rope runs down into the abyss.

>take rope
Taken.

>se

Village Square
You are standing in the Drytown village square.

A temple stands to the north, the sheriff's office to the northeast, an old tenement building to the southeast, an inn to the south, and the bazaar to the southwest.

A dirt road leads out of town to the east and west.

>i
You are carrying:
  one hundred shiny rocks
  a hemp rope (attached to the spool and the golden bucket)
  a work shirt (being worn)
  trousers (being worn)
  a raincoat (being worn)
  boots (being worn)

>nw

Alleyway
Tucked in a corner of this alleyway is an old stone well with a winch at the top.

The village square lies to the southeast.

>untie rope from spool
Untied.

>i
You are carrying:
  one hundred shiny rocks
  a hemp rope (attached to the golden bucket)
  a work shirt (being worn)
  trousers (being worn)
  a raincoat (being worn)
  boots (being worn)

>

Here’s my section on ropes, mostly taken from the Otranto example.

[ROPES]

A rope is a kind of thing.

Definition: a thing is nonrope if it is not a rope.

Attachment relates things to each other in groups.  The verb to be attached to means the attachment relation.

Definition: a thing is tied if the number of things attached to it is greater than 1.

Definition: a thing is free if it is not tied.

Definition:  a rope is free if the number of nonrope things attached to it is less than 2.

Definition: a thing is hindering if it is attached to the noun and it is not within the location.

A thing can be round or unevenly shaped.  A thing is usually round.

Definition:  something is anchored if it is fixed in place or it is scenery or it is part of an anchored thing.

Definition:  something is draggable if it is not had by the player and it is not the player and it is not anchored.

Rule for writing a paragraph about a rope (called the coil):
	if the coil is attached to something which is in a room (called the next room) which is not the location:
		let the way be the best route from the location to the next room;
		if the way is up or the way is down:
			say "[The coil] runs [way] into [the next room].";
		otherwise:
			say "[The coil] snakes across the floor [way] towards [the next room].";
	otherwise:
		say "There is [a coil] here[if the coil is attached to a visible nonrope thing], tied to [the list of nonrope visible things which are attached to the coil][end if]."
		

To decide what room is the home of (item - a thing):
	if item is a door:
		let front cut be the number of moves from the location to the front side of the item;
		let back cut be the number of moves from the location to the back side of the item;
		if front cut is -1, let front cut be 999;
		if back cut is -1, let back cut be 999;
		if the location encloses the item, decide on the location;
		if front cut is greater than back cut, decide on the back side of the item;
		decide on the front side of the item;
	decide on the location of the item.
	

Rule for writing a paragraph about a nonrope thing (called the anchor) which is attached to a rope (called the coil):
	if the coil is in an adjacent room:
		let the next room be the home of the coil;
		let the way be the best route from the location to the next room;
		if the way is up or the way is down:
			say "[The coil] runs [way] from [the anchor] into [the next room].";
		otherwise:
			say "From [the anchor] runs [a coil], heading off toward [the way].";
	otherwise:
		if the coil is attached to something which is not visible,
			say "[The coil] is tied to [the anchor][if the coil is attached to something in an adjacent room (called the next room)], and from there runs off towards [the next room][end if]."
			

After printing the name of a rope (called the tied object) while taking inventory:
	if something nonrope is attached to the tied object:
		say " (attached to [the list of nonrope things which are attached to the tied object])";
	otherwise:
		say " (with both ends free)".
		

Instead of examining a rope (called the cord) when something is attached to the cord:
	say "[The noun] is tied to [the list of secondary things which are attached to the noun]."
	

After examining the player when the player is attached to something which is not the player:
	say "You're currently lashed to [the list of secondary things attached to the noun]."
	
After examining something held which is attached to something secondary:
	say "[The noun] is currently attached to [the list of secondary things attached to the noun]."
	

After deciding the scope of the player:
	if something attached to a rope (called the coil) is in the location, place the coil in scope.
	
[A reaching inside rule:
	if the noun is a rope:
		let the anchor be a random visible thing attached to the noun;
		if the anchor is touchable, allow access.]
		
Before tying something to a rope:
	if the noun is attached to the second noun, say "[The noun] and [the second noun] are already tied together." instead;
	if the second noun is not free, say "[The second noun] has no ends free." instead;
	if the noun is round, say "You might be able to tie the rope to [the noun], but you probably shouldn't." instead.
	
Instead of tying a rope to something:
	try tying the second noun to the noun.
	
Instead of tying something to a rope:
	now the noun is attached to the second noun;
	say "You loop [the second noun] around [the noun] and knot firmly."
	
Instead of tying something to a nonrope tied thing:
	let the coil be a random rope attached to the second noun;
	try tying the noun to the coil.
	
Instead of tying a nonrope tied thing to something:
	let the coil be a random rope attached to the noun;
	try tying the second noun to the coil.
	
Instead of tying a free nonrope thing to a free nonrope thing:
	if the player carries a free rope (called the coil):
		try tying the noun to the coil;
		if the noun is attached to the coil and the coil is free:
			try tying the second noun to the coil;
	otherwise:
		say "You lack the requisite spare rope."
		
Understand "untie [something] from [something]" as untying it from.  Understand "untie [something]" as untying it from.

Rule for supplying a missing second noun while untying something from:
	if the number of secondary things attached to the noun is 0, say "[The noun] is already entirely free." instead;
	if the noun is a rope:
		if the number of touchable nonrope things which are attached to the noun > 1:
			say "You'll have to say which thing you want to untie [the noun] from.";
			rule fails;
		otherwise:
			if the number of touchable nonrope things attached to the noun is 0, say "You can't reah [the random nonrope thing attached to the noun]." instead;
			let the tied object be a random touchable nonrope thing which is attached to the noun;
			say "(from [the tied object])[line break]";
			now the second noun is the tied object;
	otherwise:
		if the noun is attached to a rope (called the tied object):
			say "(from [the tied object])[line break]";
			now the second noun is the tied object.
			
Untying it from is an action applying to two things.

Before untying a rope from something: try untying the second noun from the noun instead.

Before untying something from a rope:
	if the second noun is not held:
		say "(first picking up [the second noun])[line break]";
		try taking the second noun.
		
Carry out untying it from:
	now the noun is not attached to the second noun.
	
Report untying it from:
	say "Untied."
	

After reading a command: now every thing is unmentioned.


[Before pulling something anchored: say "[The noun] is firmly anchored." instead.

Instead of pulling something tied:
	if the noun is unmentioned:
		say "The impulse is tramsmitted to [the list of pullable things attached to the noun].";
		repeat with item running through pullable things attached to the noun:
			say "[item]: [run paragraph on]";
			try pulling the item;
		if the noun is a rope and the noun is not within the location:
			if the number of nonrope hindering things is 0, move the noun to the location;
	otherwise:
		continue the action.
		
Before pulling something which is not visible:
	if the noun is anchored:
		say "[The noun] resists, for whatever reason." instead;
	otherwise:
		let space be the holder of the noun;
		let way be the best route from the space to the location;
		if the way is a direction:
			move the noun to the location;
			say "[The noun] [if the way is up]rises[otherwise]slides[end if] into view." instead;
		otherwise:
			move the noun to the location;
			say "[The noun] slides into view." instead.]
			
Definition: a thing is secondary if it is not the noun.  Definition: a thing is pullable if it is not the noun and it is not the player.

If you type ACTIONS and then go SE, the action will be displayed as: going southeast.

The corresponding check rule should not be:

Check going in a direction from the Alleyway:

but rather, without the “in”:

Check going a direction from the Alleyway:

… which will yield the desired:

>take rope
Taken.

>se
The hemp rope is still attached to the winch.  You'll have to drop the rope if you want to go anywhere.

And when you enter “untie rope from spool”:

>untie rope from spool
[untying the hemp rope from the spool]
[(1) untying the spool from the hemp rope]
Untied.

Note that the action is converted into untying the spool from the rope. This is due to this rule from your code:

Before untying a rope from something: try untying the second noun from the noun instead.

This means that your other rule:

Check untying the hemp rope from the spool:

… will not kick in, because the action was converted by the Before rule into untying the spool from the rope.

So you need to write the check rule as:

Check untying the spool from the hemp rope:

… which will then yield the desired:

>untie rope from spool
If you untie the rope while the bucket is still in the well, the rope and bucket will be lost forever into the abyss.
4 Likes

Thank you so much! I was completely flummoxed by this, and of course the answers were relatively simple mistakes. Muchly, muchly, muchly appreciated!

1 Like

Another problem with this blasted rope.

[ROPES]

A rope is a kind of thing.

Definition: a thing is nonrope if it is not a rope.

Attachment relates things to each other in groups.  The verb to be attached to means the attachment relation.

Definition: a thing is tied if the number of things attached to it is greater than 1.

Definition: a thing is free if it is not tied.

Definition:  a rope is free if the number of nonrope things attached to it is less than 2.

Definition: a thing is hindering if it is attached to the noun and it is not within the location.

A thing can be round or unevenly shaped.  A thing is usually round.

Definition:  something is anchored if it is fixed in place or it is scenery or it is part of an anchored thing.

Definition:  something is draggable if it is not had by the player and it is not the player and it is not anchored.


Rule for writing a paragraph about a rope (called the coil):
	if the coil is attached to something which is in a room (called the next room) which is not the location:
		let the way be the best route from the location to the next room;
		if the way is up or the way is down:
			say "[The coil] runs [way] into [the next room].";
		otherwise:
			say "[The coil] snakes across the floor [way] towards [the next room].";
	otherwise:
		say "There is [a coil] here[if the coil is attached to a visible nonrope thing], tied to [the list of nonrope visible things which are attached to the coil][end if]."
		

To decide what room is the home of (item - a thing):
	if item is a door:
		let front cut be the number of moves from the location to the front side of the item;
		let back cut be the number of moves from the location to the back side of the item;
		if front cut is -1, let front cut be 999;
		if back cut is -1, let back cut be 999;
		if the location encloses the item, decide on the location;
		if front cut is greater than back cut, decide on the back side of the item;
		decide on the front side of the item;
	decide on the location of the item.
	

Rule for writing a paragraph about a nonrope thing (called the anchor) which is attached to a rope (called the coil):
	if the coil is in an adjacent room:
		let the next room be the home of the coil;
		let the way be the best route from the location to the next room;
		if the way is up or the way is down:
			say "[The coil] runs [way] from [the anchor] into [the next room].";
		otherwise:
			say "From [the anchor] runs [a coil], heading off toward [the way].";
	otherwise:
		if the coil is attached to something which is not visible,
			say "[The coil] is tied to [the anchor][if the coil is attached to something in an adjacent room (called the next room)], and from there runs off towards [the next room][end if]."
			

After printing the name of a rope (called the tied object) while taking inventory:
	if something nonrope is attached to the tied object:
		say " (attached to [the list of nonrope things which are attached to the tied object])";
	otherwise:
		say " (with both ends free)".
		

Instead of examining a rope (called the cord) when something is attached to the cord:
	say "[The noun] is tied to [the list of secondary things which are attached to the noun]."
	

After examining the player when the player is attached to something which is not the player:
	say "You're currently lashed to [the list of secondary things attached to the noun]."
	
After examining something held which is attached to something secondary:
	say "[The noun] is currently attached to [the list of secondary things attached to the noun]."
	

After deciding the scope of the player:
	if something attached to a rope (called the coil) is in the location, place the coil in scope.
	
[A reaching inside rule:
	if the noun is a rope:
		let the anchor be a random visible thing attached to the noun;
		if the anchor is touchable, allow access.]
		
Before tying something to a rope:
	if the noun is attached to the second noun, say "[The noun] and [the second noun] are already tied together." instead;
	if the second noun is not free, say "[The second noun] has no ends free." instead;
	if the noun is round, say "You might be able to tie the rope to [the noun], but you probably shouldn't." instead.
	
Instead of tying a rope to something:
	try tying the second noun to the noun.
	
Instead of tying something to a rope:
	now the noun is attached to the second noun;
	say "You loop [the second noun] around [the noun] and knot firmly."
	
Instead of tying something to a nonrope tied thing:
	let the coil be a random rope attached to the second noun;
	try tying the noun to the coil.
	
Instead of tying a nonrope tied thing to something:
	let the coil be a random rope attached to the noun;
	try tying the second noun to the coil.
	
Instead of tying a free nonrope thing to a free nonrope thing:
	if the player carries a free rope (called the coil):
		try tying the noun to the coil;
		if the noun is attached to the coil and the coil is free:
			try tying the second noun to the coil;
	otherwise:
		say "You lack the requisite spare rope."
		
Understand "untie [something] from [something]" as untying it from.  Understand "untie [something]" as untying it from.

Rule for supplying a missing second noun while untying something from:
	if the number of secondary things attached to the noun is 0, say "[The noun] is already entirely free." instead;
	if the noun is a rope:
		if the number of touchable nonrope things which are attached to the noun > 1:
			say "You'll have to say which thing you want to untie [the noun] from.";
			rule fails;
		otherwise:
			if the number of touchable nonrope things attached to the noun is 0, say "You can't reach [the random nonrope thing attached to the noun]." instead;
			let the tied object be a random touchable nonrope thing which is attached to the noun;
			say "(from [the tied object])[line break]";
			now the second noun is the tied object;
	otherwise:
		if the noun is attached to a rope (called the tied object):
			say "(from [the tied object])[line break]";
			now the second noun is the tied object.
			
Untying it from is an action applying to two things.

Before untying a rope from something: try untying the second noun from the noun instead.

Before untying something from a rope:
	if the second noun is not held:
		say "(first picking up [the second noun])[line break]";
		try taking the second noun.
		
Carry out untying it from:
	now the noun is not attached to the second noun.
	
Report untying it from:
	say "Untied."
	

After reading a command: now every thing is unmentioned.


[Before pulling something anchored: say "[The noun] is firmly anchored." instead.

Instead of pulling something tied:
	if the noun is unmentioned:
		say "The impulse is transmitted to [the list of pullable things attached to the noun].";
		repeat with item running through pullable things attached to the noun:
			say "[item]: [run paragraph on]";
			try pulling the item;
		if the noun is a rope and the noun is not within the location:
			if the number of nonrope hindering things is 0, move the noun to the location;
	otherwise:
		continue the action.
		
Before pulling something which is not visible:
	if the noun is anchored:
		say "[The noun] resists, for whatever reason." instead;
	otherwise:
		let space be the holder of the noun;
		let way be the best route from the space to the location;
		if the way is a direction:
			move the noun to the location;
			say "[The noun] [if the way is up]rises[otherwise]slides[end if] into view." instead;
		otherwise:
			move the noun to the location;
			say "[The noun] slides into view." instead.]
			
Definition: a thing is secondary if it is not the noun.  Definition: a thing is pullable if it is not the noun and it is not the player.

Examining the rope shouldn’t reveal an object it’s tied to if that object isn’t visible, but it does anyway.

Any idea what’s going wrong?

What you posted isn’t a complete compilable example so it’s hard to be positive, but I suspect the issue comes from:

After examining something held which is attached to something secondary:
	say "[The noun] is currently attached to [the list of secondary things attached to the noun]."

Maybe something like:

After examining something held which is attached to a secondary visible thing:
say "[The noun] is currently attached to [the list of secondary visible things attached to the noun]."

would work.

1 Like

Thanks, I’ll try that.

THE CULPRIT:

Instead of examining a rope (called the cord) when something is attached to the cord:
	say "[The noun] is tied to [the list of secondary things which are attached to the noun]."

I’ll paste my solution into this thread for posterity the next time I transfer my code to this machine.

1 Like