So I’m currently testing a custom system I plan to implement and to start with i’m trying to find a way to generate a string that describes the exits out of a Room.
So far, I have this code:
Repeat with N running through adjacent rooms:
let the way be the best route from the location to N;
if the way is a direction:
Now RoomExitCode is "[RoomExitCode][way]";
say "The Generated Room Code is: [RoomExitCode]!";
That works fine, and creates a string that, depending on how many exits and and what they are, lists them out in a single line.
Example: The Generated Room Code is: northeastwest.
The issue is I want to compare the resulting string to a lookup entry in a table, but the string that gets built seems to find the rooms and get assembled in the order the exits were declared, thus can’t be relied upon to match a text comparison.
So if I defined the east exit before the north exit for example, then the string would be eastnorthwest, not northeastwest.
I need a way to tell Inform to repeat through rooms and exits but give them in a compass order N/E/S/W.
In essence, I have a single entry in my lookup table for those three directions, that is “northeastwest”, which that string should now be able to match with and then the other entries in that row can be used.
But unless the string gets built in that order, it won’t match and find that row.
I really don’t want to create however many combinations of north east west in the lookup table i’d need to cater for the order it builds that string, let alone the moment there is also a south…or an Up/Down too!.
Maybe Repeat through Adjacent Rooms is not the ideal way to list the exits for this purpose?