Ropes, cords, etc., spanning multiple rooms

For instance, say we have a garden hose which can be hooked up to a faucet in the backyard, and then run to the front yard to water the grass. While working on a similar problem, it keeps devolving into a whole mess of exceptions and special cases. Has anyone written an extension or tackled this problem before? It’s harder than I expected to get it right.


I did something like this with the ball of yarn in You May Not Escape!, which just had its source code released publicly. I’d have to go back and look, but I think I just set a variable for each room (whether it was “beyarned” or not), and had descriptions of which way the yarn ran based on which adjacent rooms were beyarned.


In the standard rules, isn’t there also a rope example that @mathbrush used in NGUHD? He might be able to help.


Yeah, example 228, Otranto.

Charm’s idea isn’t bad, though. I did that with a beam of light that threads through things.

Otranto lets you pull things up cliffs and lower them, tug things from room to room, tie both ends of the rope to something different, etc. I put it in almost at the last minute and the complexity was awful. Rope has a reputation for being a very challenging thing to code, so much that I feel much of the high placement of Final Exam in 2015 was just due to it being able to handle rope well (and Tethered from Linus Akesson similarly showing off Dialog’s powers). I thought I knew what I was doing going in and that difficulties with rope were exaggerated, but it is so vastly complex unless you limit its function. So Charm’s idea should work well, as I imagine you won’t be using the hose to lift things up and down cliffs.


I remember, I was thinking about that. I liked that ball of yarn.


Otranto is perfect for what I’m doing, since it simulates being tethered by a rope, etc. Thanks!


A modified version of Otranto’s rope code is used in Scroll Thief too. Most of the changes are to deal with being able to anchor yourself.

Definition: something is anchored rather than unanchored if it is fixed in place or it is scenery [or it is a person] or it is part of an anchored thing.

Definition: something is securely anchored rather than not-securely-anchored if it is tied to something anchored [or the holder of the item is securely anchored].

Definition: something is draggable rather than undraggable if it is not had by the player and it is not a person and it is not anchored.

Definition: something is entrapping if it is anchored or it is a person and it is not the person asked.
1 Like