Mapping a room based on a table entry

now the location is mapped direction entry of the door entry;

The above doesn’t work, but this does:

now the location is mapped south of the door entry;

Assuming nothing is wrong with the rest of my code or the table, why can’t I pass the direction stored in the table entry to mapping?

2 Likes

Relations can only relate two things, not three. So the relation isn’t X mapped Y of Z, but X mapped north of Y (and another relation for X mapped south of Y, and so on).

1 Like

I still am not sure what that means… in this case, I’m still trying to map the location to a door, just substituting explicitly stating the direction for a variable substitution of that direction.

Are you saying inform cannot put variable substitutions in relationship statements?

“now x is mapped north of y” to me looks exactly the same as “now x is mapped z of y” if z is a variable containing a direction. I’m not seeing this as a relationship between 3 things, it’s the same exact statement with a variable substitution for one of the words. I take it, this mapping relation is an edge case where inform just doesn’t understand this? I’ve never run into another case where “the whatever entry” can’t pass for the thing in the entry in other use cases before.

1 Like

If you look in the index you’ll see that each of the directions has its own relation and there’s no generic direction relation. So “mapped X” doesn’t match anything the compiler understands. Instead of storing the direction in the table you could store the relation, but I think instead it would be better to use the “change (direction) exit of (room) to (room)” phrase instead.

2 Likes

It’s like how you can define a phrase like this:

To decide whether (X - a thing) is very far north of (Y - a thing):

which would allow you to test things like “If the rock is very far north of the tree.” But the direction north isn’t actually an argument to this “to decide whether” phrase; it’s just something whose name happens to show up in the phrase you can call it. So you couldn’t test “if the rock is very far the way of the three” (even if the way is north) because Inform can only evaluate that phrase with the literal word “north” in it.

The “mapped north of” phrase is like that, except that there’s a different phrase (in fact these are verbs) for every direction. Almost – in fact the verbs for up and down are “to be mapped above” and “to be mapped below” rather than “to be mapped up of” and “to be mapped down of.” If you create new directions then the compiler automatically creates new relations and verbs somehow, but you still can’t use directions as variables in this phrase.

As Dannii says, the phrase “change (direction) exit of (room) to (room)” is designed so you can use variable directions, so you can use that.

ETA: I looked through some random dungeon generation code I have and it says, about the change direction phrase, “(I forgot about this formulation and it nearly drove me to distraction.)” As that comment says, you might want to look at section 8.5 of Writing with Inform.

1 Like

Wow, thank you! I had never found the change direction exit of room to room phrase before in my search, only the mapped phrases. I didn’t realize the mapped phrase was actually not truly referring to “north” in “mapped north of”, but that that the phrase could have been written “mapped whateveryouwant of” (in the original standard rules phrase) etc… I’m glad there is the change phrase instead, so that will work for me.

Although, do the mapped phrase and the change direction exit phrase actually do the same thing? If I were to go down the route of implementing a visual map in the game, would those be equivalent in actually “moving” the room? Also, if I made new directions, and wanted to use the “mapped” phrases, would I need to create my own phrases for each new direction also then? I’d imagine the answer to the second question is yes.

1 Like

Edit: Actually, I tried this, and the phrase doesn’t work when the room is mapped to a door instead of directly to a room. Do I need to investigate the change direction exit phrase and write my own that works for a room mapped to a door, or is there something already available that will work for that?

By default doors aren’t able to move, because their map connections are implemented in a special way. There’s an extension on GitHub called “Dynamic Doors” that should enable it.

I wasn’t able to find “Dynamic Rooms” but I was able to find “Mobile Doors by David Corbett”. I don’t know if I am misunderstanding the documentation, or if this extension perhaps doesn’t work with L602 though.

I tried this phrase:

replace north in myDoor with nothing;
replace north in myDoor2 with myRoom;

Where all the objects are valid in the rest of my code. This compiles, but when it is accessed during play, this phrase gives the error:

[** Programming error: tried to find the "." of (something) **]

[** Programming error: tried to read (something) **]

Is this the extension you were thinking of? If so, am I using it wrong or is the extension not compatible? Is there a different extension?

No, if I understand the question correctly; if you create “turnwise” and “widdershins” as directions then the verbs “is mapped turnwise of” and “is mapped widdershins of” will be automatically created for you, along with their respective relations. (I imagine this is a special case in the compiler; most things don’t automatically create new relations and relation verbs.) So you’ll be able to say “Now Ankh-Morpork is mapped widdershins of The Shades” and like that.

As for Mobile Doors, it does look as if it has some issues with 6L02; I tried the example phrases given in the documentation and they gave programming errors in 6L02 but not in 6G60.

By the way, how on earth do you download an extension from GitHub? After clicking on what seemed like every button on the page for Mobile Doors, I went to the raw source page and copy-pasted it into a new extension file in the Inform IDE, but that doesn’t seem like it can possibly be the best way.

1 Like

Right-click (ctrl-click) on the “raw” button and select your browser’s “download this” option.

(Github is oriented towards projects rather than files, so it assumes that most people will use the “Download ZIP” button on the main repository page.)

1 Like

Thanks!

So, I wanted to follow up on this thread… it seems the conclusion is that if I use a door on a room, that room becomes fixed to the map. It’s not the door I want to move, per se, but rather the room the door is/was connected to. Unless I am misunderstanding, this is impossible. If so, what are the chances I can rely on someone’s charity to make Moveable Rooms work again? Otherwise, I think I may need to reinvent the wheel and create my own doors in I7 using rules and function trickery to make it seem like doors, as I don’t know I6 to fix the doors or Mobile Doors up myself… but that’s a ton of work, and all the existing extensions and documentation about locks and keys, etc. would all be incompatible with my custom solution.

The extension’s author is Gorobay on the forum (I think); you could PM him to see if he can help.

I have updated Mobile Doors for 6L02. Please let me know if it doesn’t work. I know it doesn’t work for one-sided doors, because 6L02 broke them.