# [i7] automapping with non-opposite directions?

So I had an idea for a map for the 10-room contest. And apparently automapping is strongly encouraged.

Automap by Mark Tilford works very well in most cases. It helped me immediately do stuff like

[spoiler]include automap by Mark Tilford.

room 1 is a room.
room 2 is east of room 1.
room 3 is southeast of room 1. room 3 is southwest of room 2.

to decide what number is the distance (d - east) from (r - room 1): decide on 2.
to decide what number is the distance (d - west) from (r - room 2): decide on 2.

to decide what number is the distance (d - northwest) from (r - room 3): decide on 1.
to decide what number is the distance (d - southeast) from (r - room 1): decide on 1.

to decide what number is the distance (d - northeast) from (r - room 3): decide on 1.
to decide what number is the distance (d - southwest) from (r - room 2): decide on 1.[/spoiler]

But the extension (as I understand it) has trouble with the following:

``room y is west of room x. room x is northeast of room y. east of room y is room z. room z is southwest of room x.``

This is a reasonable limitation–but is there any simple way around this? Is there any way to program this so that you could have distances for two segments?

I have some ideas such as defining a distance1 and distance2. But I have little idea (at the moment) of how to code the core bits, or if I would tack on my own small extension…here’s some pseudocode.

``````room y is west of room x. room x is northeast of room y. east of room y is room z. room z is southwest of room x.
to decide what number is the distance1 from (r - room y) to (r - room x): decide on 1.
to decide what number is the distance2 from (r - room y) to (r - room x): decide on 1.
to decide what number is the distance1 from (r - room x) to (r - room y): decide on 1.
to decide what number is the distance2 from (r - room x) to (r - room y): decide on 1.

...distance1 and distance2 are usually 0. If they are 0, follow the rules before, if they are >1, then draw a line (in this case) 1 unit NE from room y to a non-room character (like a .) then bend and go 1 unit E. Or 1 unit W from X and 1 unit SW.``````

The result would be a map like
…±1
./ /
2-3

Is this a good way to start going about things? Is there any general order-of-magnitude time frame for learning to tack on stuff to extensions? Would I need to, or could I just define an overriding rule instead?

If it’s a one-shot, ad hoc edit, it’s probably doable quite quickly. Looking at the code in the phrase `To decide whether the map is drawn,'' I think you could probably splice in another conditional,`if the loop_room is …’’ under the directions that need exceptional handling, and then write your special cases as `place...'' and`draw a path…’’ phrases there. It would be somewhat more work to rewrite that code to handle two distances, but worth the effort if you plan on making these sorts of map connections often.

That works handily. I was able to make a few small changes quickly. Thanks!

For the curious…

[code]To decide what number is empty room: decide on 95.
To decide what number is thru room: decide on 97. [added]

a thru-room is a kind of room.

``````				otherwise if loop_room is location;
place full room of loop_room at temp_x and temp_y;
otherwise if loop_room is a thru-room; [added this & below]
place thru room of loop_room at temp_x and temp_y;

96 46 98 99 100 101 102 103 104 105 106 107 108 109 110 111 ! 96 - 111 [from 97]
``````

[/code]

Also some code to my main program…

[spoiler]every turn:
repeat with Y running through unvisited thru-rooms:
if room-b of Y is visited:
if room-a of Y is visited:
explore Y;

carry out going:
if location of player is a thru-room:
explore location of player;
let G be opposite of noun;
if room-a of location of player is the room G of location of player:
now player is in room-b of location of player;
otherwise:
now player is in room-a of location of player;[/spoiler]

Feels a bit sloppy but does the job.

What are the stipulations on using a modified version of an extension? Is there anything special we need to do to mention this, so that if we do have a bug, people know it’s not the author’s fault?

I similarly found it produced run-time errors when rooms were defined with new directions besides the standard 12. I think it would be worth reporting these problems to the author, at least.

For the attribution question, if you change the extension’s first line to Automap by Mark Tilford (modified by aschultz) it should preserve his primary author’s credit while noting that you’ve made some changes to it.

See Sections 25.3-25.4 in the manual for the best way to give this credit.

Thanks. I have to admit the later sections sort of intimidated me into just taking the easy bits and learning them. It’s neat to actually need to learn them–and to see why they can be useful. Feels like I’m getting somewhere with this programming.

Time to look at the other stuff I avoided at first, too.

I’ll definitely send Mark Tilford an email once I play around with the extension a bit more. I’ve had fun with it.

Alternate method (not tested):

Check whether the “doing automap work” activity is going on.

Phony room is a room. It is not mappable.

To decide what room is (d - north) of (r - room1) when the doing automap work activity is going on: decide on phony room.
To decide what room is (d - west) of (r - room2) when the doing automap work activity is going on: decide on phony room.

Each turn: place room2 at __ and __ from room1.

Yick, that’s disgusting. Will improve.

And please, don’t stop at playing with the extension. Release a game that uses it! (Has there been any released game that uses my
automapper, other than Goldilocks is a FOX!?)

Oops, so I forgot to email.

Well, your code looks much cleaner than my idea (which works. I just know I’ve committed several programming mistakes.) I’m sure you can find something that works best if you want to sleep on it.

I’m hoping that games will use your automap extension for David Cornelson’s 10-room competition. I had a lot of fun drawing up maps. I’ll be using a custom mapper for mine, but it’s pretty clear yours works better generally. And I probably took a lot from yours, anyway.

I don’t know if it counts as released (it seems to be in open beta), but there is this game. It uses Glimmr Automap, which means it uses your automapper, since Glimmr Automap (as you know) is just a graphical frontend to your extension.

Edited to add: There was also an entry in the 7-Day Roguelike Competition a year or two ago that used Automap: 256k.org/IFRL/.