Login
Remember
IF Answers
Ask a Question

# How to show unexplored map nodes at the start?

0 votes
167 views
asked Mar 31 in Authoring by anonymous

For example purposes, the player has a home, where they should be aware of the existence of all rooms on the map, without having to go there to reveal them.

Other locations may require exploring, but this one should be visible.
Some of the rooms have {once} text in them, so setting them to already visited might interfere with that.

- quest
- mapping

commented Apr 1 by mattweiner (121 points)
What system are you using?
commented Apr 1 by RobinMarx (38 points)
The question is tagged with Quest.
commented Apr 1 by Paul_Erdos (39 points)
Perhaps we could subcategory the different compilers in the authoring section, have a special box for it or something. This seems to happen frequently enough.

## 2 Answers

+1 vote
answered Apr 6 by jaynabonne

The following code will "visit" all the rooms connected to a starting room, drawing them into the map. You would typically call:

    VisitRoom(game.pov.parent)

in your start script, after adding this function to your game:

      <function name="VisitRoom" parameters="room">
        if (not GetBoolean(room, "genvisited")) {
          room.genvisited = true
          Grid_CalculateMapCoordinates (room, game.pov)
          Grid_DrawRoom (room, false, game.pov)
          foreach (exit, AllExits()) {
            if (exit.parent = room) {
              VisitRoom (exit.to)
            }
          }
        }
      </function>

Note that this does not changed the normal "visited" status for the rooms.

0 votes
answered Apr 1 by hegemonkhan (161 points)
edited Apr 1 by hegemonkhan

since the built-in 'visited' Boolean Attribute is already built to work (reveal map rooms) with the grid mapping, I'd instead make your own separate Boolean Attribute, that you check for, in whether to run a script(s) or not, instead of using the 'firsttime' Script~Function or nor the text processor's 'once' command, as they're tied to the 'visited' Boolean Attribute too, as well.

visited: leave as is, using it to determine what rooms you can see in~on the mapping grid

visited2: your newly created Attribute, for checking for what scripts to run.

(just a sample example, so the code design choice I used, is poor for actual implementation in a big game)

    <object name="room">
    </object>

    <object name="room2">
      <attr name="visited" type="boolean">true</attr>
      <attr name="visited2" type="boolean">false</attr>
    </object>

    <object name="player">
      <parent type="object">room</parent>
      <attr name="changedparent" type="script">
        if (this.parent.name = "room2" and this.parent.visited2 = false) {
          // script(s) 1
          this.parent.visited2 = true
        } else if (this.parent.name = "room2" and this.parent.visited2 = true) {
          // script(s) 2
        }
      </attr>
    </object>

## Related questions

- Is there any way to see the map of a story?
- I want to make a verb that requires to things at once. How do I do this this? [internet version]
- In Flexible Windows, is it acceptable to set, e.g., the window position at or after the start of play? (Inform 7)
- How To Disable Automatic Jumping To The Screen Bottom If Too Much Text?(Quest5)
- Using the Gamebook style game, how do I create game-wide variables to track?

...