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

I am trying to implement a grapnel that can be tied to a rope and then thrown upward to let the player climb up a cliff face to an adjacent map.

I am working from Chapter 10.6 Ropes, example 228 Otranto. However this example is very long and involved and has more to do with pulling than climbing, so I’m struggling to figure out how to adapt it to my needs. I really don’t need to model every way a rope could conceivably be used. I just need to tie it to a grapnel, throw it, and climb up the rope to a different map.

Can anyone steer me in the right direction or point me to an example that would be more applicable?

EDIT:

I’m pretty sure I can figure out tying the grapnel to the rope. It’s the throwing it and making it climb-able that I’m not sure about.

EDIT AGAIN:

I was able to tie the rope to things using the example.

1 Like

As to throwing and climbing, part of it might be something like:

Attachment relates one thing to another.
The verb to be attached to means the attachment relation.

The futile to throw things at inanimate objects rule does nothing when the noun is the grapnel.
The block throwing at rule does nothing when the noun is the grapnel. 

Carry out throwing the grapnel at the railing when the grapnel is attached to the rope and the location is the lab: 
  now the lab is mapped below the balcony; 
  now the balcony is mapped above the lab; 

The block climbing rule does nothing when the noun is the rope and the rope is attached to the grapnel and the balcony is mapped above the lab.

before climbing the rope when the rope is attached to the grapnel and the balcony is mapped above the lab: instead try going up.

To climb is a verb.
Report going up from the lab: say "[We] [climb] the rope.".

but that’s in 10.1. 9.3/6M62 has a bug and you would have to say the mapping backwards.

Carry out throwing the grapnel at the railing when the grapnel is attached to the rope and the location is the lab: 
  now the lab is mapped above the balcony; 
  now the balcony is mapped below the lab; 

This leaves out climbing down the rope and many other things…

In a case like this, the game design issues of how this should work, especially coming up with the right words and commands and figuring out how to cue the player so they understand how they’re supposed to issue the commands to do the thing once they’ve figured out it’s the thing to do are more complicated than implementing it all once you know it.

  • what happens if one tries to tie the rope to things other than the grapnel?
  • what happens if one throws the grapnel without tying it to the rope?
  • what happens when throwing the grapnel at something other than the railing?
  • what happens if one tries taking the rope or grapnel after throwing it, and how does it differ depending on whether one’s in the room below or the room above?
  • what if one unties the rope from the grapnel when it’s hooked on the railing?
  • once it’s thrown, presumably the rope is still visible and touchable, i.e., in scope, and presumably the grapnel is not touchable… but is it visible?
  • I’ll guess that both up and climb rope should work to get to the room above… now what happens if someone takes the rope or grapnel?
  • Can something (like, say, the grapnel) be dropped from the room above down into the room below?
4 Likes

That should get me started. Thanks!

One problem so far…

The compiler takes some exception to

Before climbing the rope when the rope is attached to the grapnel and the High Cliff is mapped above the Foothills:
     instead try going up.

It doesn’t understand the rule taking effect starting with “when…”

1 Like

I edited my example to include the relationship and its verb, which is a different verb than Otranto used.

3 Likes
[FOOTHILLS]
The Foothills are north from the Desert Path.
The description of the Foothills is "A steep vertical cliff face juts up from the foothills here.  At the top of the cliff, you can just make out a rock that protrudes outward from the egde.[paragraph break]The desert path lies to the south.[if the hemp rope is attached to the grapnel and the grapnel is on the protruding rock]  A [hemp rope] leads up to the cliff above.[end if]"

The cliff face is scenery in the Foothills.
Understand "cliff" or "wall" as the cliff face.
The description of the cliff face is "A steep wall of rock juts straight up from the foothills towards the sky.  At the top of the cliff, you can just make out a rock that protrudes outward from the edge."

The protruding rock is a supporter in the Foothills.
The protruding rock is scenery.
Understand "rock" as the protruding rock.
The description of the protruding rock is "At the top of the cliff, you can just make out a rock that protrudes outward from the edge."

The grapnel is a thing in the Foothills.
The grapnel is unevenly shaped.
The description of the grapnel is "A large metal hook with an eye hole for attaching it to something."

The futile to throw things at inanimate objects rule does nothing when the noun is the grapnel.
The block throwing at rule does nothing when the noun is the grapnel.

Carry out throwing the grapnel at the protruding rock when the location is the Foothills:
	if the grapnel is attached to the hemp rope:
		say "You hurl the grapnel at the protruding rock atop the cliff...  The hook catches on the rock, leaving the rope dangling down into the foothills.";
		now the grapnel is on the protruding rock;
		now the hemp rope is on the protruding rock;
		now the High Cliff is mapped below the Foothills;
		now the Foothills are mapped above the High Cliff;
	otherwise:
		say "You hurl the grapnel at the protruding rock atop the cliff...  You miss and the hook comes crashing back down to the ground.  This is fortunate, as otherwise you'd have no way to retrieve the grapnel.";
		now the grapnel is in the Foothills.

Check taking the hemp rope:
	if the hemp rope is attached to the grapnel:
		if the grapnel is on the protruding rock:
			say "It's best to leave that where it is.";
			stop the action;
		otherwise:
			continue the action;
	otherwise:
		continue the action.

Instead of taking something:
	if the noun is on the protruding rock:
		say "You'd better not.";
		stop the action;
	otherwise:
		continue the action.

Instead of putting something on the protruding rock:
	say "You can't reach the rock from here.";
	stop the action.

The block climbing rule does nothing when the noun is the hemp rope and the hemp rope is attached to the grapnel and the High Cliff is mapped below the Foothills.

To climb is a verb.

Before climbing the hemp rope when the hemp rope is attached to the grapnel and the High Cliff is mapped below the Foothills:
	instead try going up.
	

Report going up from the Foothills: say "[We] [climb] the rope.".



[HIGH CLIFF]
The High Cliff is a room.
The description of the High Cliff is "It's a long way down to the foothills.  You wouldn't want to slip here.[if the hemp rope is attached to the grapnel and the grapnel is on the protruding rock]  A [hemp rope] leads down to the foothills below.[end if]"

If i tie the rope to grapnel, throw grapnel at rock, and take rope, I get…

Glulxe fatal error: Stack overflow in function call.
1 Like

That means an infinite loop, which isn’t evident in the fragment you’ve posted. Name your rules, then try it with rules on to see where.

2 Likes

I’m not sure what my rules are or how to name them, but I typed rules before doing the thing and it says
Rule “After deciding the scope of the player” applies… over and over

1 Like

Scope is a complicated beast and I’d avoid interacting with it if you don’t need to.

I think, if you don’t care about pulling things via rope in general, a simpler solution may be best here.

Instead of putting the grapnel on the rope when the grapnel is not part of the rope:
    say "You tie the grapnel to the end of the rope.";
    now the grapnel is part of the rope.
Before throwing the grapnel when the grapnel is part of the rope:
    try throwing the rope instead.
Before throwing the grapnel at something when the grapnel is part of the rope:
    try throwing the rope at the second noun instead.

Before throwing the rope in the presence of the cliff face:
    try throwing the rope at the cliff face instead.
Instead of throwing the rope at the cliff face:
    if the grapnel is not part of the rope, say "You would need to attach something to it first." instead;
    say "Description here!";
    now the rope is in the High Cliffs;
    now the rope is fixed in place.

Before climbing or entering the rope when the rope is fixed in place:
    try going up instead.
Instead of going up in the High Cliffs when the rope is not fixed in place:
    say "You can't climb that with your bare hands!".
4 Likes

WWI §19.3

2 Likes

Naming rules is just a matter of, e.g.,

Report going up from the Foothills (this is the report climbing rope rule): say "[We] [climb] the rope.".

Have you added any After deciding the scope of the player rules, and do they maybe refer to whether something is in scope or something is visible?

3 Likes

There was some unneeded code leftover from the Otranto example causing problems. Seems to be working so far, but I need to keep testing edge cases.

1 Like

The Otranto code is great if you want to have a lot of ropes extending between rooms and being able to pull objects from one room to another. (That’s what you see in Scroll Thief, because I couldn’t resist rope puzzles.) But for most use cases, it’s serious, serious overkill.

2 Likes

I would humbly suggest that the answer to most game design issues when dealing with something very complicated to simulate, like a rope, is not to attempt a simulation at all but just stick closely to the narrative purpose of the object, politely shutting off all other avenues.

In this case, I assume, the narrative purpose is to solve a simple puzzle (bring together rope and grapnel, then throw it) in order to effectively create a doorway (the rope acting as that doorway) between 2 rooms. So unless, it’s important to your story to do otherwise (e.g. it’s important that the door can be closed again,or that the rope has multiple uses etc.), keep code simple so that solving the puzzle creates (or reveals) the door and then politely blocks all attempts to interfere with said door (i.e. the rope and grapnel) thereafter. The rope and grapnel wouldn’t need even to physically exist in-world as objects any more- they could be moved ‘nowhere’ and an 'Understand “rope” or “grapnel” as (your revealed doorway) when the rope is nowhere" ’ phrase used to redirect any mention of them elsewhere, e.g. to your revealed doorway.

5 Likes

I agree completely. My list was a bunch of ways that might occur to a player to try to interact with the situation presented. I didn’t mean to imply that one should simulate all the situations I referred to, rather that one should put thought into which possibilities one would block off and how. That would give someone a better idea of what they really needed to implement than considering just the expected case alone, plus remind them of blocking responses they might want to write.

5 Likes

No criticism intended, obvs. Comments not as rebuttal but as musings to a wider audience :slight_smile:

4 Likes

I can second this sentiment. Not saying you shouldn’t implement this a grappling hook in simulation if warranted, but for people who’d rather not, there are ways around it using the magic of narration and “if the player consents.”

Yes, parser gives the player lots of choices. But when you want to do something tricky it’s might be better to streamline and limit what’s possible and avoid combinatorial simulationist headaches.

For example, the player has both the grapnel and the rope in their inventory: pop them a yes-no question when they examine either:

“The grapnel has a handy eye that looks like you could tie the rope to it. Do you want to tie them together? y/n”

If the player consents, switch out the grapnel and rope with a different object altogether called “grappling hook” that has the description “You could probably throw this to climb to a high place.” It’s essentially now a key.

Instead of doing anything except examining to the grappling hook:
    if the player is in Rocky Chimney:
        say "Do you want to climb the rocky chimney with the grappling hook?";
        if the player consents:
            say "You throw the grappling hook and climb nimbly up to the top.";
            now the player is in Top of Cave;
        otherwise:
            say "Okay, you reserve acrobatics for later.";
    otherwise:
        say "It's a grappling hook. The only real good use for it would be to throw it and climb up or down if you were in a place with sturdy rocks it could catch onto.";
    end if.
2 Likes

Here’s a slightly less reductionist worked-up example implementing the rope as a hidden door. Rather than swapping out both rope and grapnel when the two are tied together, it swaps out the grapnel and melds it into the rope, before swapping the rope out and revealing the hidden ‘rope-door’ when the rope (with grapnel) is successfully thrown.

6 Likes

Amazing.

2 Likes
Check untying it from:
	now the noun is not attached to the second noun.
	
Report untying it from:
	say "Untied."

plus

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.

plus

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.

equals:

(first picking up the hemp rope)

The hemp rope is still tied to the spool of the winch.

Untied.

It seems the more general check rule is overruling the more specific check rule. How do I consolidate this? Do I add in the specific check rule as an IF condition within the more general rule? How would I word that?

Check untying it from:
	now the noun is not attached to the second noun.

Is this meant to be a carry out rule? That seems to be the natural solution, rather than doing complicated stuff to shift the order of your check rules.

2 Likes