Small Question for a Big Map

Hiya!

[rant=“lots of code”][code]“thing that does not work like i want it to” by Wes Lesley

section make it work

Use MAX_STATIC_DATA of 500000.

section looking toward

Understand “look [direction]” as facing.

Facing is an action applying to one visible thing.

Carry out facing:
let the viewed item be the room noun from the location;
if the viewed item is not a room, say “You can’t see anything promising that way.” instead;
try looking toward the viewed item;

Understand “look toward [any adjacent room]” as looking toward. Understand “examine [any adjacent room]” as looking toward.

Looking toward is an action applying to one visible thing.

Carry out looking toward:
say “You make out [the noun] that way.”;

section where to go

Definition: a direction (called thataway) is viable if the room thataway from the location is a room.

after printing the name of the room while not constructing the status line:
say roman type;
say line break;
let count of exits be the number of viable directions;
if the count of exits is 0, say “Exit unknown.” instead;
if the count of exits is 1, say “Exit [list of viable directions].”;
otherwise say “Exits are [list of viable directions].”;

When play begins:
now left hand status line is “Nearby: [if a room is adjacent][the list of adjacent rooms][end if][if a room is adjacent and a door is visible] and [end if][if a door is visible][the list of visible doors][end if]”;
now right hand status line is “”;

After printing the name of an adjacent room (called the target) while constructing the status line:
let aim be the best route from the location to the target;
say " ([aim])";

Rule for printing the name of a direction (called the aim) while constructing the status line:
choose row with a heading of the aim in the Table of Abbreviation;
say “[shortcut entry]”;

Table of Abbreviation
heading shortcut
north “N”
northeast “NE”
northwest “NW”
east “E”
southeast “SE”
south “S”
southwest “SW”
west “W”
up “U”
down “D”
inside “in”
outside “out”

section locations

There is a room called Town Square.

There is a room called West Street.

There is a room called East Street.

There is a room called North Street.

There is a room called South Street.

There is a room called Second Avenue East.

There is a room called First Avenue East.

There is a room called First Avenue West.

There is a room called Second Avenue West.

There is a room called Bascule Bridge.

There is a room called South Bridge Operation Booth.

There is a room called North Bridge Operation Booth.

There is a room called Lighthouse.

There is a room called Dockyard.

There is a room called Power Station.

There is a room called Dockyard Maintanance.

There is a room called Docks.

There is a room called Customs Office.

There is a room called Cave.

North of Town Square is North Street.
South of Town Square is South Street.
East of Town Square is East Street.
West of Town Square is West Street.
East of North Street is First Avenue East.
West of North Street is First Avenue West.
East of South Street is Second Avenue East.
West of South Street is Second Avenue West.
East of Second Avenue East is North Bridge Operation Booth.
Southeast of Second Avenue East is Bascule Bridge.
Southeast of Bascule Bridge is Dockyard.
East of South Bridge Operation Booth is Dockyard.
Southwest of Lighthouse is Dockyard.
North of Dockyard is Customs Office.
East of Dockyard is Dockyard Maintanance.
Southeast of Dockyard is Docks.
Southwest of Dockyard is Power Station.[/code][/rant]
Questions:

  • If you “look [direction]”, it will wreck the line by mentioning the exits - but it should only do that when printing the name of the player’s location. It’s because of the “after printing the name of the room while not constructing the status line:” but I don’t know how else to phrase it.
  • I want to bind this into a command that goes “look around” and then it will give you the overview of what room is where (and where which doors lead). Any help there would also be welcome.
  • This isn’t the actual full room list. However, the upper code is what I will be using (of course). Thing is, in my real, huge map, the “nearby:” starts with an empty space, then a comma, then the real list. I don’t know why. The error does not appear here and the map is already so huge that it will spoil a lot of fun things by just listing the location names… so I’d prefer not to show off those things. And I’d love to get rid of that empty space and the comma. Or just the comma.

Printing the room name and printing the description of the room are individual, named rules in the carry out looking rulebook, so instead of an after printing the name of rule you could handle it with a carry out looking rule and slip yours in between, like this:

[code]Carry out looking (this is the list exits in the room description heading rule):
let count of exits be the number of viable directions;
if the count of exits is 0, say “Exit unknown.” instead;
if the count of exits is 1, say “Exit [list of viable directions].”;
otherwise say “Exits are [list of viable directions].”;

The list exits in the room description heading rule is listed before the room description body text rule in the carry out looking rules.

The description of Town Square is “…and this is the town square. Nice, isn’t it?”[/code]

If you don’t want a blank line between the exit list and the room description, add “[no line break]” after the period in each of the possible responses in your rule.

What im looking for specifically is the game to say x is north, y is west, z is up, etc… automatically. But I cant get the game to behave the way I need it to.

Example 262 Tiny Garden in section §3.4. Continuous Spaces and The Outdoors of the Inform 7 recipe book demonstrates iterating over each adjacent room.

I’d recommend you set it up as an activity. That allows you to hang rules on “printing the name of” directions, while being very specific about when you want those rules to apply.

[code]Summarizing the exits of something is an activity.

Rule for summarizing the exits of a room:
if the number of viable directions is 0:
say “There are no obvious exits from this place.”;
otherwise:
say “[list of viable directions].”

Before printing the name of a direction (called thataway) while summarizing the exits of something:
if the door thataway from the location is a door (called the portal) [check for doors first, because checking for rooms will always return a room even if there is a door in the way]:
say "[the portal] leads ";
otherwise if the room thataway from the location is a room (called the destination):
say "[the destination] is ";

Carry out looking (this is the list exits in the room description heading rule):
carry out the summarizing the exits activity with the location.

The list exits in the room description heading rule is listed before the room description body text rule in the carry out looking rules.

The kiosk door is a door, inside from the Town Square and outside from the Kiosk Interior. [Added so we can test routes through doors.]

The description of Town Square is “…and this is the town square. Nice, isn’t it?” [Added so we can see how the exit list interacts with room descriptions.]
[/code]

Also, this makes it easy to call the activity from other actions. You could make your “look around” action like this:

[code]Exit-summarizing is an action applying to nothing. Understand “look around” as exit-summarizing.

Carry out exit-summarizing:
carry out the summarizing the exits activity with the location.[/code]

I can’t be sure what’s happening in your third bullet point without seeing the code, but my first guess would be you’ve got a room with a special “printing the name of” rule that’s preventing its name from being printed at all. So it’s showing up in the list, but its “name” is just a blank space.