Quest map: why does it show hidden exits?

thanos
26 Apr 2019, 13:56

OK, I'm now convinced that it's a bug/overlooked issue. Quest map shows exits, even if they are hidden.

I guess it will need some kind of re-writing for the mapping module, making it more dynamic, but it is quite a common issue, having hidden exits, so it would be worth it. I would be willing to help with the programming, if sb orients me around the code.


Dcoder
26 Apr 2019, 15:33

Make the hidden exit's grid_length attribute 0, until it is visible and then make it 1 or whatever.


mrangel
26 Apr 2019, 22:55

Good point.

In the function Grid_CalculateMapCoordinates it checks to see if exits are look only, but doesn't check if they're hidden.

Right at the end of that function (inside the outermost foreach loop and the if statement) you want to override the grid_render property.

Changing:

         exit.to.grid_render = true
        }
      }
    }
    ]]>
  </function>

to

         exit.to.grid_render = true
        }
        if (not GetBoolean (exit, "visible")) {
          exit.grid_render = false
          // also hide the room the exit leads to, 
          if (not Grid_GetRoomBooleanForPlayer(game.pov, exit.to, "grid_isdrawn")) {
            exit.to.grid_render = false
          }
        }
      }
    }
    ]]>
  </function>

But you'd want to redraw an exit when it becomes visible.
I suggest the best way to do this would be by giving exits a changedvisible script.

To drawn an exit on the map when it becomes unhidden:

if (Grid_GetRoomBooleanForPlayer(game.pov, this.parent, "grid_isdrawn")) {
  this.grid_render = true
  Grid_DrawRoom (this.parent, true, game.pov)
}

or to show the now-visible exit on the map only when the player next visits that room:

if (Grid_GetRoomBooleanForPlayer(game.pov, this.parent, "grid_isdrawn")) {
  this.grid_render = true
  if (Contains (this.parent, game.pov)) {
    Grid_DrawRoom (this.parent, true, game.pov)
  }
  else {
    Grid_SetRoomBooleanForPlayer(game.pov, this.parent, "grid_isdrawn", false)
  }
}

(clearing the "we've already drawn this room" flag forces it to be redrawn when the player enters it, I think?)

I'd suggest putting either of these in a changedvisible script attribute for the defaultexit type; so that they apply to any exit whose visibility changes.


thanos
27 Apr 2019, 17:54

Woa. Thanks, I guess you did all the work, already. Mind putting that in the source code? ;)

Here is the previous discussion we had on the issue:

http://textadventures.co.uk/forum/quest/topic/hdobhw5ccuadimijerwnpg/map-how-to-show-newly-created-exit


The Pixie
29 Apr 2019, 06:57

If this was to go into the source code (and I am not sure when that would be updated), is that going to break existing games?

I think most authors would expect this behaviour anyway. Can anyone think of a situation where the author would desire the original behaviour?