Buggy as Bloody Heck upon Reload

Hi All,

I'm doing TA with offline editor, latest Quest version. I've just noticed at least 3 problems ([email protected]#$) with my game when reloading it (but everything works fine with new game):

  1. MAP WON'T DISPLAY
    New game: Map is turned on under "Interface" tab, but map display and map recording are then turned off in UserInitInterface ("Advanced Scripts" tab). Player starts in a non-mapable area. There is a mapable area elsewhere (where map display/recording are turned back on). I save the game in the non-mapable area and then reload it, then enter the mapable area. The map will not display (a blank map grid is displayed). This happens whether or not I entered the mapable area before the game was saved. However, if I save in a mapable area and reload, the map DOES show up. I made a barebones game to demonstrate this:
<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="MapTest">
    <gameid>f1511def-3569-40c0-9d6d-f59e7163e6d7</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>
    <feature_advancedscripts />
    <gridmap />
    <mapexitwidth type="int">1</mapexitwidth>
    <mapexitcolour>Black</mapexitcolour>
  </game>
  <object name="MapableRoom">
    <inherit name="editor_room" />
    <attr name="grid_width" type="int">3</attr>
    <attr name="grid_length" type="int">3</attr>
    <attr name="grid_borderwidth" type="int">3</attr>
    <attr name="grid_label">Mapable Room</attr>
    <attr name="grid_border">Black</attr>
    <beforeenter type="script">
      game.gridmap = True
      JS.eval ("$('#gridPanel').css('display', 'block')")
    </beforeenter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="south" to="NonMapableRoom">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="NonMapableRoom">
    <inherit name="editor_room" />
    <beforeenter type="script">
      game.gridmap = False
      JS.eval ("$('#gridPanel').css('display', 'none')")
    </beforeenter>
    <exit alias="north" to="MapableRoom">
      <inherit name="northdirection" />
    </exit>
  </object>
</asl>
  1. ATTRIBUTE NOT SAVED
    At least one string attribute (player.power) doesn't get saved on reload? At new game start, player.power = "off" (set inside the player object) . I have a turn script that prints this out for debugging purposes. I go somewhere that changes player.power = "on" (turn script verifies this). I save game, then reload. I type "wait" or "look" or whatever, and turn script shows that player.power = "off"! So I guess that attribute never got saved correctly. WTFreak? Most or all other attributes did get saved correctly. I never change the player object.

  2. DEFAULT ROOM "REDRAWN"
    When I save the game in a, say, 3x3 tile room and then reload, Quest will display the player in a 1x1 room (a default room) within the 3x3 room. This only happens in the starting room, and strangely, it happens inconsistently (bug methinks?). Actually, sometimes if I save in a 1x1 room with a white border and reload, I'll start in a 1x1 room with a black border (default room again -- just more noticeable in a 3x3 room). This might be related to problem #1 and turning the map display/recording on and off in-game.

Not to cast blame on the brilliant Pixie, but I've noticed a lot more of these types of reload issues have arisen since 5.7 came out. I've been able to fix several of these up to now, but now I'm stumped (and exhausted). I did try to separate my scripts properly to go under either the "Scripts" start tab or "Advanced Scripts" UI tab. I even did a complete uninstall and clean install of Quest, without effect.

Type here...help, hints, 411, 911, tear hair out, etc.


Wow, no one else has problems when reloading a game?


I would need to see more to know what is going on.

  1. I loaded up your barebones game, and in the first room the map can be seen, go south it disappears, go north it reappears. I did that a few times, and it seems to work fine.

  2. There are issues you need to be careful of with the interface initialisation script. Changing CSS values is generally fine, but, for example, printing to screen can mess it up. I would guess this is the issue, but would have to see the script (at least) to say more.


Thanks for the response, Pixie.

  1. The barebones game works until you save it in the area that is not mapable. When you reload it and enter the mapable area, the map will not display. I tried flipping the order of these scripts without effect:
game.gridmap = True/False
JS.eval ("$('#gridPanel').css('display', 'block/none')")
  1. I went through all of the interface initialization tab and don't see anything that is printing to screen. Anything that prints, I normally put under the Start tab. I tried changing "player.power" to a boolean attribute without effect.

I've had the map go crazy, but I thought it was just because I'm using PathLib. I just turned my map off (since I'm not very fond of it anyway). My problem was easy.

What do I do to recreate your error?

Just load it up, save, quit, and restart?


Hi KV,

Just make a new game, then replace the game's code with my code (above) in full code view. Run the game and go south into the non-mapable room. Then save and reload. When you go north back into the mapable room, the map won't display.

Pix: There's a script in my UI init tab that prints HTML -- could that be the problem? To answer my own question, just deleted that script but there's no difference. Deleted all other scripts that might cause printing problems but no effect.


Ok, just solved problem #2. My own stupidity (again). I found an obscure place in my UI init tab that made player.power = "off". It was in a script that called a function that called another function (thus i didn't see it). My bad.


For 1, I think the issue is that if game.gridmap is false, Quest does not bother to save the map, so when you reload, no map, and if does not add to the map when you go in the other room because that room is flagged as visited.

The solution would be to override the SAVE command to turn on game.gridmapbefore doing the save, but that is not ideal, as on reload the unmapped room will be mapped.

For 3, could you paste your script into a post? There are various gotchas, and printing stuff in there is definitely going to cause issues.


Issue #1 MAP WON'T DISPLAY -
Pixie: Did more testing and you are right about your explanation. However, the map doesn't display even if the mapable rooms have NOT been visited. Also, I've confirmed via debugging turn script that "game.gridmap = True" even when the map doesn't display but should.

Tried different solutions and none really worked:
a) Added "game.gridmap = True" before a save, but like you indicated, upon reload and entering mapable area, a slew of error messages shows up and the map gets distorted at the starting point.
b) Added "game.gridmap = True" before a save, and "game.gridmap = False" after the save, but on reload map doesn't display at all.
c) Under the UI Init tab, flagged all mapable rooms as visited = False. On reload, map still doesn't display.

I discovered something else though -- Start a new game in NonMapRoom1 and do a save #1, then reload and enter MapRoom2 (map doesn't display as previously mentioned). Then travel through the rest of the mapable rooms 3 and 4 (with the map not showing). Go back to NonMapRoom1 and do a save #2. Then reload and go to MapRoom2 and do a save #3 (map still not showing). Reload one last time and the map displays (as previously mentioned, because you're reloading in a mapable area), BUT NOTE THAT THE MAP DISPLAYS ALL OF THE MAPABLE ROOMS THAT YOU TRAVELED THROUGH EARLIER! (between save #1 and #2). You can see this in my new code:

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="MapTest">
    <gameid>f1511def-3569-40c0-9d6d-f59e7163e6d7</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>
    <feature_advancedscripts />
    <gridmap />
    <mapexitwidth type="int">1</mapexitwidth>
    <mapexitcolour>Black</mapexitcolour>
    <inituserinterface type="script">
      JS.setCommands ("save")
    </inituserinterface>
    <start type="script">
      JS.ShowGrid (0)
      game.gridmap = False
      JS.eval ("$('#gridPanel').css('display', 'none')")
    </start>
    <commandpane />
  </game>
  <object name="NonmapableRoom1">
    <inherit name="editor_room" />
    <beforeenter type="script">
      JS.ShowGrid (0)
      game.gridmap = False
      JS.eval ("$('#gridPanel').css('display', 'none')")
    </beforeenter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="south" to="MapableRoom2">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="MapableRoom2">
    <inherit name="editor_room" />
    <attr name="grid_width" type="int">3</attr>
    <attr name="grid_length" type="int">3</attr>
    <attr name="grid_borderwidth" type="int">2</attr>
    <attr name="grid_label">Mapable 2</attr>
    <beforeenter type="script">
      JS.ShowGrid (300)
      game.gridmap = True
      JS.eval ("$('#gridPanel').css('display', 'block')")
    </beforeenter>
    <exit alias="north" to="NonmapableRoom1">
      <inherit name="northdirection" />
    </exit>
    <exit alias="south" to="MapableRoom3">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="MapableRoom3">
    <inherit name="editor_room" />
    <attr name="grid_width" type="int">3</attr>
    <attr name="grid_length" type="int">3</attr>
    <attr name="grid_borderwidth" type="int">2</attr>
    <attr name="grid_label">Mapable 3</attr>
    <beforeenter type="script">
      game.gridmap = True
      JS.eval ("$('#gridPanel').css('display', 'block')")
    </beforeenter>
    <exit alias="north" to="MapableRoom2">
      <inherit name="northdirection" />
    </exit>
    <exit alias="south" to="MapableRoom4">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="MapableRoom4">
    <inherit name="editor_room" />
    <attr name="grid_width" type="int">3</attr>
    <attr name="grid_length" type="int">3</attr>
    <attr name="grid_borderwidth" type="int">2</attr>
    <attr name="grid_label">Mapable 4</attr>
    <beforeenter type="script">
      game.gridmap = True
      JS.eval ("$('#gridPanel').css('display', 'block')")
    </beforeenter>
    <exit alias="north" to="MapableRoom3">
      <inherit name="northdirection" />
    </exit>
  </object>
</asl>

This means that even when you save in a non-mapable area (with game.gridmap = False), Quest remembers all the mapped rooms that you were in, even when it the map display is blank. So the mapped info is stored somewhere -- how can I access this?

Issue #3 DEFAULT ROOM REDRAWN -
I'm letting this go for now, as I don't know how to demo this (it's inconsistent) and may be tied to issue #1.

There are various gotchas, and printing stuff in there is definitely going to cause issues.

Pix: if it's not too tedious, could you just list the various "gotchas" and I'll look at my UI Init tab to see if I've been "gotten".


This seems to have 'fixed' the map problem:

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="MapTest">
    <gameid>f1511def-3569-40c0-9d6d-f59e7163e6d7</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>
    <feature_advancedscripts />
    <gridmap />
    <mapexitwidth type="int">1</mapexitwidth>
    <mapexitcolour>Black</mapexitcolour>
    <commandpane />
    <inituserinterface type="script">
      JS.setCommands ("save")
      if (player.parent = NonmapableRoom1) {
        JS.ShowGrid (0)
        JS.eval ("$('#gridPanel').css('display', 'none')")
      }
    </inituserinterface>
    <start type="script">
      // JS.ShowGrid (0)
      // game.gridmap = false
      // JS.eval ("$('#gridPanel').css('display', 'none')")
    </start>
  </game>
  <command name="save">
    <pattern type="string">^save$</pattern>
    <script>
      game.gridmap = true
      request (RequestSave, "")
    </script>
  </command>
  <object name="NonmapableRoom1">
    <inherit name="editor_room" />
    <attr name="grid_borderwidth" type="int">0</attr>
    <attr name="grid_border">White</attr>
    <beforeenter type="script">
      JS.ShowGrid (0)
      game.gridmap = False
      JS.eval ("$('#gridPanel').css('display', 'none')")
    </beforeenter>
    <enter type="script">
      // JS.ShowGrid (0)
      // JS.eval ("$('#gridPanel').css('display', 'none')")
    </enter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="south" to="MapableRoom2">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="MapableRoom2">
    <inherit name="editor_room" />
    <attr name="grid_width" type="int">3</attr>
    <attr name="grid_length" type="int">3</attr>
    <attr name="grid_borderwidth" type="int">2</attr>
    <attr name="grid_label">Mapable 2</attr>
    <beforeenter type="script">
      JS.ShowGrid (300)
      game.gridmap = True
      JS.eval ("$('#gridPanel').css('display', 'block')")
    </beforeenter>
    <exit alias="north" to="NonmapableRoom1">
      <inherit name="northdirection" />
    </exit>
    <exit alias="south" to="MapableRoom3">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="MapableRoom3">
    <inherit name="editor_room" />
    <attr name="grid_width" type="int">3</attr>
    <attr name="grid_length" type="int">3</attr>
    <attr name="grid_borderwidth" type="int">2</attr>
    <attr name="grid_label">Mapable 3</attr>
    <beforeenter type="script">
      game.gridmap = True
      JS.eval ("$('#gridPanel').css('display', 'block')")
    </beforeenter>
    <exit alias="north" to="MapableRoom2">
      <inherit name="northdirection" />
    </exit>
    <exit alias="south" to="MapableRoom4">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="MapableRoom4">
    <inherit name="editor_room" />
    <attr name="grid_width" type="int">3</attr>
    <attr name="grid_length" type="int">3</attr>
    <attr name="grid_borderwidth" type="int">2</attr>
    <attr name="grid_label">Mapable 4</attr>
    <beforeenter type="script">
      game.gridmap = True
      JS.eval ("$('#gridPanel').css('display', 'block')")
    </beforeenter>
    <exit alias="north" to="MapableRoom3">
      <inherit name="northdirection" />
    </exit>
  </object>
</asl>

<inituserinterface type="script">
      JS.setCommands ("save")
      if (player.parent = NonmapableRoom1) {
        JS.ShowGrid (0)
        JS.eval ("$('#gridPanel').css('display', 'none')")
      }
    </inituserinterface>

<command name="save">
    <pattern type="string">^save$</pattern>
    <script>
      game.gridmap = true
      request (RequestSave, "")
    </script>
  </command>

I changed the grid_border to white so the little 1x1 doesn't show up on the map:

<object name="NonmapableRoom1">
    <inherit name="editor_room" />
    <beforeenter type="script">
      JS.ShowGrid (0)
      game.gridmap = False
      JS.eval ("$('#gridPanel').css('display', 'none')")
    </beforeenter>
    <enter type="script">
      JS.ShowGrid (0)
      JS.eval ("$('#gridPanel').css('display', 'none')")
    </enter>
    <attr name="grid_borderwidth" type="int">0</attr>
    <attr name="grid_border">White</attr>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="south" to="MapableRoom2">
      <inherit name="southdirection" />
    </exit>
  </object>

I commented out the start script, too, and it doesn't seem to effect anything:

<start type="script">
      // JS.ShowGrid (0)
      // game.gridmap = false
      // JS.eval ("$('#gridPanel').css('display', 'none')")
    </start>

Good job, KV. That works in the test game, but it doesn't quite work in the actual game. The problem being that there are rooms in the non-mapable area much further away from NonMapableRoom1 (and away from the mapable rooms). So if I don't have game.gridmap = False in the UI Init tab, when I enter the first mapable room, it will show a map leading all the way back from the start. But if I do have game.gridmap = False in the UI Init tab, when I enter the first mapable room, it will show a bunch of coordinate errors and the first mapable room will have its orientation distorted.

But good job, KV -- what you did helps because at least I get a map displayed now. Now what I need is a way to tell Quest what the x, y coordinates are when I enter the first mapable room.


Revised code
<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="MapTest">
    <gameid>f1511def-3569-40c0-9d6d-f59e7163e6d7</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>
    <feature_advancedscripts />
    <gridmap />
    <mapexitwidth type="int">1</mapexitwidth>
    <mapexitcolour>Black</mapexitcolour>
    <commandpane />
    <inituserinterface type="script">
      JS.setCommands ("save")
      borderCheck
      if ((HasAttribute(player.parent, "noMap")) and player.parent.noMap) {
        JS.ShowGrid (0)
        JS.eval ("$('#gridPanel').css('display', 'none')")
      }
    </inituserinterface>
    <start type="script">
      msg ("normal")
    </start>
  </game>
  <command name="save">
    <pattern type="string">^save$</pattern>
    <script>
      game.gridmap = true
      request (RequestSave, "")
    </script>
  </command>
  <object name="NonmapableRoom1">
    <inherit name="editor_room" />
    <attr name="grid_borderwidth" type="int">0</attr>
    <attr name="grid_border">Black</attr>
    <beforeenter type="script">
      JS.ShowGrid (0)
      game.gridmap = False
      JS.eval ("$('#gridPanel').css('display', 'none')")
    </beforeenter>
    <enter type="script">
      // JS.ShowGrid (0)
      // JS.eval ("$('#gridPanel').css('display', 'none')")
    </enter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="south" to="MapableRoom2">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="MapableRoom2">
    <inherit name="editor_room" />
    <attr name="grid_width" type="int">3</attr>
    <attr name="grid_length" type="int">3</attr>
    <attr name="grid_borderwidth" type="int">2</attr>
    <attr name="grid_label">Mapable 2</attr>
    <beforeenter type="script">
      JS.ShowGrid (300)
      game.gridmap = True
      JS.eval ("$('#gridPanel').css('display', 'block')")
    </beforeenter>
    <exit alias="north" to="NonmapableRoom1">
      <inherit name="northdirection" />
    </exit>
    <exit alias="south" to="MapableRoom3">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="MapableRoom3">
    <inherit name="editor_room" />
    <attr name="grid_width" type="int">3</attr>
    <attr name="grid_length" type="int">3</attr>
    <attr name="grid_borderwidth" type="int">2</attr>
    <attr name="grid_label">Mapable 3</attr>
    <beforeenter type="script">
      game.gridmap = True
      JS.eval ("$('#gridPanel').css('display', 'block')")
    </beforeenter>
    <exit alias="north" to="MapableRoom2">
      <inherit name="northdirection" />
    </exit>
    <exit alias="south" to="MapableRoom4">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="MapableRoom4">
    <inherit name="editor_room" />
    <attr name="grid_width" type="int">3</attr>
    <attr name="grid_length" type="int">3</attr>
    <attr name="grid_borderwidth" type="int">2</attr>
    <attr name="grid_label">Mapable 4</attr>
    <beforeenter type="script">
      game.gridmap = True
      JS.eval ("$('#gridPanel').css('display', 'block')")
      JS.ShowGrid (300)
    </beforeenter>
    <exit alias="north" to="MapableRoom3">
      <inherit name="northdirection" />
    </exit>
    <exit alias="south" to="NonmappableRoom2">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="NonmappableRoom2">
    <inherit name="editor_room" />
    <beforeenter type="script">
      JS.ShowGrid (0)
      game.gridmap = False
      JS.eval ("$('#gridPanel').css('display', 'none')")
    </beforeenter>
    <attr name="grid_borderwidth" type="int">0</attr>
    <attr name="grid_border">Black</attr>
    <enter type="script">
    </enter>
    <exit alias="north" to="MapableRoom4">
      <inherit name="northdirection" />
    </exit>
  </object>
  <function name="borderCheck">
    foreach (nmr, AllObjects()) {
      if (nmr.grid_borderwidth = 0) {
        nmr.noMap = true
      }
    }
  </function>
</asl>

Just change the border width to 0 on the rooms you don't want to show up on the map. (I had it where you'd have to set up an attribute, but I made a function that checks for border width then does that for you. I added another unmapped room on the end to check it. Seems to work.)


UPDATE

Oh! I see! I need to add a room in the middle to properly check!


I dropped an unmappable room in between mappable3 and mappable4, and, yeah... lots of errors...

We can probably just copy and adjust the function that adds to the dictionary...

Maybe...

(If not, Pixie will let us know.)


Here's everything I see in the save file:

MANY Details
  <function name="Grid_SetScale" parameters="scale">
    JS.Grid_SetScale (scale)
  </function>
  <function name="Grid_CalculateMapCoordinates" parameters="room, playerobject"><![CDATA[
    if (room.parent <> null) {
      if (room.grid_parent_offset_auto) {
        room.grid_parent_offset_x = (room.parent.grid_width - room.grid_width) /2.0
        room.grid_parent_offset_y = (room.parent.grid_length - room.grid_length) /2.0
      }
      Grid_SetGridCoordinateForPlayer (playerobject, room.parent, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") - room.grid_parent_offset_x)
      Grid_SetGridCoordinateForPlayer (playerobject, room.parent, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") - room.grid_parent_offset_y)
      Grid_SetGridCoordinateForPlayer (playerobject, room.parent, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z"))
      room.parent.grid_render = true
      Grid_CalculateMapCoordinates (room.parent, playerobject)
    }
    foreach (exit, AllExits()) {
      if (exit.parent = room and not GetBoolean(exit, "lookonly")) {
        if (DoesInherit(exit, "northdirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + room.grid_width/2.0 + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") - exit.to.grid_width/2.0)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", (Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") - exit.to.grid_length) - exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z"))
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x"))
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") - exit.grid_length)
          exit.grid_render = true
          exit.to.grid_render = true
        }
        else if (DoesInherit(exit, "eastdirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + room.grid_width + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + room.grid_length/2.0 + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") + exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") - exit.to.grid_length/2.0)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z"))
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") + exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y"))
          exit.grid_render = true
          exit.to.grid_render = true
        }
        else if (DoesInherit(exit, "southdirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + room.grid_width/2.0 + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + room.grid_length + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") - exit.to.grid_width/2.0)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") + exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z"))
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x"))
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") + exit.grid_length)
          exit.grid_render = true
          exit.to.grid_render = true
        }
        else if (DoesInherit(exit, "westdirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + room.grid_length/2.0 + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", (Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") - exit.to.grid_width) - exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") - exit.to.grid_length/2.0)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z"))
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") - exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y"))
          exit.grid_render = true
          exit.to.grid_render = true
        }
        else if (DoesInherit(exit, "northwestdirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", (Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") - exit.to.grid_width) - exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", (Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") - exit.to.grid_length) - exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z"))
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") - exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") - exit.grid_length)
          exit.grid_render = true
          exit.to.grid_render = true
        }
        else if (DoesInherit(exit, "northeastdirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + room.grid_width + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") + exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", (Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") - exit.to.grid_length) - exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z"))
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") + exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") - exit.grid_length)
          exit.grid_render = true
          exit.to.grid_render = true
        }
        else if (DoesInherit(exit, "southwestdirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + room.grid_length + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", (Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") - exit.to.grid_width) - exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") + exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z"))
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") - exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") + exit.grid_length)
          exit.grid_render = true
          exit.to.grid_render = true
        }
        else if (DoesInherit(exit, "southeastdirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + room.grid_width + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + room.grid_length + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") + exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") + exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z"))
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_x", Grid_GetGridCoordinateForPlayer(playerobject, exit, "x") + exit.grid_length)
          Grid_SetGridCoordinateForPlayer (playerobject, exit, "end_y", Grid_GetGridCoordinateForPlayer(playerobject, exit, "y") + exit.grid_length)
          exit.grid_render = true
          exit.to.grid_render = true
        }
        else if (DoesInherit(exit, "updirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + room.grid_width/2.0 - exit.to.grid_width/2.0 + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + room.grid_length/2.0 - exit.to.grid_length/2.0 + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z") + exit.grid_length)
          exit.grid_render = false
          exit.to.grid_render = true
        }
        else if (DoesInherit(exit, "downdirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + room.grid_width/2.0 - exit.to.grid_width/2.0 + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + room.grid_length/2.0 - exit.to.grid_length/2.0 + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z") - exit.grid_length)
          exit.grid_render = false
          exit.to.grid_render = true
        }
        else if (DoesInherit(exit, "indirection") or DoesInherit(exit, "outdirection")) {
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "x", Grid_GetGridCoordinateForPlayer(playerobject, room, "x") + room.grid_width/2.0 - exit.to.grid_width/2.0 + exit.grid_offset_x)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "y", Grid_GetGridCoordinateForPlayer(playerobject, room, "y") + room.grid_length/2.0 - exit.to.grid_length/2.0 + exit.grid_offset_y)
          Grid_SetGridCoordinateForPlayer (playerobject, exit.to, "z", Grid_GetGridCoordinateForPlayer(playerobject, room, "z"))
          exit.grid_render = false
          exit.to.grid_render = true
        }
      }
    }
  ]]></function>
  <function name="Grid_DrawPlayerInRoom" parameters="room">
    if (room.grid_render) {
      Grid_DrawRoom (room, false, game.pov)
      player_x = Grid_GetGridCoordinateForPlayer(game.pov, room, "x") + room.grid_width/2.0
      player_y = Grid_GetGridCoordinateForPlayer(game.pov, room, "y") + room.grid_length/2.0
      player_z = Grid_GetGridCoordinateForPlayer(game.pov, room, "z")
      JS.Grid_DrawPlayer (player_x, player_y, player_z, 5, "black", 2, "yellow")
    }
  </function>
  <function name="Grid_DrawRoom" parameters="room, redraw, playerobject"><![CDATA[
    if (room.grid_render) {
      if (redraw or not Grid_GetRoomBooleanForPlayer(playerobject, room, "grid_isdrawn")) {
        if (room.parent <> null) {
          Grid_DrawRoom (room.parent, redraw, playerobject)
        }
        JS.Grid_DrawBox (Grid_GetGridCoordinateForPlayer(game.pov, room, "x"), Grid_GetGridCoordinateForPlayer(game.pov, room, "y"), Grid_GetGridCoordinateForPlayer(game.pov, room, "z"), room.grid_width, room.grid_length, room.grid_border, room.grid_borderwidth, room.grid_fill, room.grid_bordersides)
        if (LengthOf(room.grid_label) > 0) {
          label_x = Grid_GetGridCoordinateForPlayer(game.pov, room, "x") + room.grid_width/2.0
          label_y = (Grid_GetGridCoordinateForPlayer(game.pov, room, "y") + room.grid_length/2.0) - 0.5
          JS.Grid_DrawLabel (label_x, label_y, Grid_GetGridCoordinateForPlayer(game.pov, room, "z"), room.grid_label)
        }
        foreach (exit, AllExits()) {
          if (exit.grid_render and exit.parent = room and exit.grid_length > 0) {
            Grid_DrawLine (Grid_GetGridCoordinateForPlayer(game.pov, exit, "x"), Grid_GetGridCoordinateForPlayer(game.pov, exit, "y"), Grid_GetGridCoordinateForPlayer(game.pov, exit, "end_x"), Grid_GetGridCoordinateForPlayer(game.pov, exit, "end_y"), game.mapexitcolour, game.mapexitwidth)
          }
        }
        Grid_SetRoomBooleanForPlayer (playerobject, room, "grid_isdrawn", true)
      }
    }
  ]]></function>
  <function name="Grid_ShowCustomLayer" parameters="visible">
    if (visible) {
      JS.Grid_ShowCustomLayer (true)
    }
    else {
      JS.Grid_ShowCustomLayer (false)
    }
  </function>
  <function name="Grid_ClearCustomLayer">
    JS.Grid_ClearCustomLayer ()
  </function>
  <function name="Grid_DrawLine" parameters="x1, y1, x2, y2, border, borderWidth">
    JS.Grid_DrawLine (x1, y1, x2, y2, border, borderWidth)
  </function>
  <function name="Grid_DrawArrow" parameters="id, x1, y1, x2, y2, border, borderWidth">
    JS.Grid_DrawArrow (id, x1, y1, x2, y2, border, borderWidth)
  </function>
  <function name="Grid_DrawGridLines" parameters="x1, y1, x2, y2, border">
    JS.Grid_DrawGridLines (x1, y1, x2, y2, border)
  </function>
  <function name="Grid_SetCentre" parameters="x, y">
    JS.Grid_SetCentre (x, y)
  </function>
  <function name="Grid_DrawSquare" parameters="id, x, y, width, height, text, fill">
    JS.Grid_DrawSquare (id, x, y, width, height, text, fill)
  </function>
  <function name="Grid_LoadSvg" parameters="data, id">
    JS.Grid_LoadSvg (data, id)
  </function>
  <function name="Grid_DrawSvg" parameters="id, symbolid, x, y, width, height">
    JS.Grid_DrawSvg (id, symbolid, x, y, width, height)
  </function>
  <function name="Grid_DrawImage" parameters="id, url, x, y, width, height">
    JS.Grid_DrawImage (id, url, x, y, width, height)
  </function>
  <function name="Grid_AddNewShapePoint" parameters="x, y">
    JS.Grid_AddNewShapePoint (x, y)
  </function>
  <function name="Grid_DrawShape" parameters="id, border, fill, opacity">
    JS.Grid_DrawShape (id, border, fill, opacity)
  </function>
  <function name="JS_GridSquareClick" parameters="parameterstring">
    parameters = Split(parameterstring, ";")
    x = ToInt(StringListItem(parameters, 0))
    y = ToInt(StringListItem(parameters, 1))
    GridSquareClick (x, y)
  </function>
  <function name="GridSquareClick" parameters="x, y">
  </function>
  <function name="Grid_Redraw">
    foreach (object, AllObjects()) {
      if (Grid_GetRoomBooleanForPlayer(game.pov, object, "grid_isdrawn")) {
        Grid_DrawRoom (object, true, game.pov)
      }
    }
  </function>
  <function name="Grid_SetGridCoordinateForPlayer" parameters="playerobject, room, coordinate, value">
    coordinates = Grid_GetPlayerCoordinatesForRoom(playerobject, room)
    if (DictionaryContains(coordinates, coordinate)) {
      dictionary remove (coordinates, coordinate)
    }
    dictionary add (coordinates, coordinate, value * 1.0)
  </function>
  <function name="Grid_GetGridCoordinateForPlayer" parameters="playerobject, room, coordinate" type="double">
    coordinates = Grid_GetPlayerCoordinatesForRoom(playerobject, room)
    return (DictionaryItem(coordinates, coordinate))
  </function>
  <function name="Grid_SetRoomBooleanForPlayer" parameters="playerobject, room, coordinate, value">
    datadictionary = Grid_GetPlayerCoordinatesForRoom(playerobject, room)
    if (DictionaryContains(datadictionary, coordinate)) {
      dictionary remove (datadictionary, coordinate)
    }
    dictionary add (datadictionary, coordinate, value)
  </function>
  <function name="Grid_GetRoomBooleanForPlayer" parameters="playerobject, room, attribute" type="boolean">
    coordinatedata = Grid_GetPlayerCoordinateDictionary(playerobject)
    if (not DictionaryContains(coordinatedata, room.name)) {
      return (false)
    }
    else {
      datadictionary = Grid_GetPlayerCoordinatesForRoom(playerobject, room)
      if (DictionaryContains(datadictionary, attribute)) {
        return (DictionaryItem(datadictionary, attribute))
      }
      else {
        return (false)
      }
    }
  </function>
  <function name="Grid_GetPlayerCoordinateDictionary" parameters="playerobject" type="dictionary">
    if (HasAttribute(playerobject, "grid_coordinates_delegate")) {
      return (Grid_GetPlayerCoordinateDictionary(playerobject.grid_coordinates_delegate))
    }
    else {
      if (not HasAttribute(playerobject, "grid_coordinates")) {
        playerobject.grid_coordinates = NewDictionary()
        Grid_SetGridCoordinateForPlayer (playerobject, playerobject.parent, "x", 0)
        Grid_SetGridCoordinateForPlayer (playerobject, playerobject.parent, "y", 0)
        Grid_SetGridCoordinateForPlayer (playerobject, playerobject.parent, "z", 0)
        playerobject.parent.grid_render = true
        Grid_CalculateMapCoordinates (playerobject.parent, playerobject)
      }
      return (playerobject.grid_coordinates)
    }
  </function>
  <function name="Grid_GetPlayerCoordinatesForRoom" parameters="playerobject, room" type="dictionary">
    coordinatedata = Grid_GetPlayerCoordinateDictionary(playerobject)
    if (not DictionaryContains(coordinatedata, room.name)) {
      dictionary add (coordinatedata, room.name, NewDictionary())
    }
    return (DictionaryItem(coordinatedata, room.name))
  </function>
  <function name="MergePOVCoordinates"><![CDATA[
    coordinateowner = GetCoordinateOwner(game.pov)
    foreach (obj, GetDirectChildren(game.pov.parent)) {
      if (obj <> game.pov and HasAttribute(obj, "grid_coordinates")) {
        objcoordinateowner = GetCoordinateOwner(obj)
        if (coordinateowner <> objcoordinateowner) {
          MapPOVCoordinates (objcoordinateowner, coordinateowner)
        }
      }
    }
  ]]></function>
  <function name="GetCoordinateOwner" parameters="playerobject" type="object">
    if (HasAttribute(playerobject, "grid_coordinates_delegate")) {
      return (GetCoordinateOwner(playerobject.grid_coordinates_delegate))
    }
    else {
      return (playerobject)
    }
  </function>
  <function name="MapPOVCoordinates" parameters="source, target">
    sourcecoordinates = Grid_GetPlayerCoordinateDictionary(source)
    targetcoordinates = Grid_GetPlayerCoordinateDictionary(target)
    xoffset = Grid_GetGridCoordinateForPlayer(target, game.pov.parent, "x") - Grid_GetGridCoordinateForPlayer(source, game.pov.parent, "x")
    yoffset = Grid_GetGridCoordinateForPlayer(target, game.pov.parent, "y") - Grid_GetGridCoordinateForPlayer(source, game.pov.parent, "y")
    zoffset = Grid_GetGridCoordinateForPlayer(target, game.pov.parent, "z") - Grid_GetGridCoordinateForPlayer(source, game.pov.parent, "z")
    foreach (roomname, sourcecoordinates) {
      coordinatedata = DictionaryItem(sourcecoordinates, roomname)
      if (not DictionaryContains(targetcoordinates, roomname)) {
        newroomdata = NewDictionary()
        dictionary add (targetcoordinates, roomname, newroomdata)
        MapPOVCoordinate (coordinatedata, newroomdata, "x", xoffset)
        MapPOVCoordinate (coordinatedata, newroomdata, "y", yoffset)
        MapPOVCoordinate (coordinatedata, newroomdata, "z", zoffset)
        MapPOVCoordinate (coordinatedata, newroomdata, "end_x", xoffset)
        MapPOVCoordinate (coordinatedata, newroomdata, "end_y", yoffset)
      }
      else {
        newroomdata = DictionaryItem(targetcoordinates, roomname)
      }
      if (DictionaryContains(coordinatedata, "grid_isdrawn")) {
        if (DictionaryContains(newroomdata, "grid_isdrawn")) {
          dictionary remove (newroomdata, "grid_isdrawn")
        }
        dictionary add (newroomdata, "grid_isdrawn", DictionaryItem(coordinatedata, "grid_isdrawn"))
      }
    }
    source.grid_coordinates_delegate = target
    Grid_Redraw
    Grid_DrawPlayerInRoom (game.pov.parent)
  </function>
  <function name="MapPOVCoordinate" parameters="sourcedata, targetdata, name, offset">
    if (DictionaryContains(sourcedata, name)) {
      value = DictionaryItem(sourcedata, name)
      dictionary add (targetdata, name, value + offset)
    }
  </function>

not sure if this is going to help here, but Jay/Pixie would have code that quickly visits all of the rooms in the game, generating a map, upon starting the game, and/or, upon moving to a new section of the game, needing to re-generate a new map for this new section of the game, due to the sections of the game, not able to be connected as a single map (moving without Exits, moving up and down, etc. Well, at least these were the issues with the map in past versions of quest anyways, not sure if Pixie has improved upon them with his new versions of quest)


@ HK

from http://docs.textadventures.co.uk/quest/showing_a_map.html

Click here to view the **Mapping everywhere** section

Mapping everywhere

Restriction: Only works if all rooms are connected.

An alternative way to ensure teleportation works is to make Quest map the whole game from the start.

Create a new function, call it “VisitRoom”, and give it a single parameter, “room”. Paste in this code (the fourth line is commented out, if you remove the slashes at the start, the map will be fully visible from the start):

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)
    }
  }
}

Then in the start script:

VisitRoom (game.pov.parent)

Now you can move the player to any room, confident it is mapped.


Wouldn't this display unvisited rooms on the map?


I found this too. It looks like it may be what really works for Dcoder:

https://textadventures.co.uk/forum/samples/topic/5719/guide-remaking-the-default-custom-map

It's two years old, though...


I believe with Pixie/Jay code, that upon/before moving to a new section, they'd delete/hide the old map, and re-generate the new map for the new section, so you don't get errors when not using Exits (when rooms aren't connected): you generate a new map for each section of the game you go to, this way each section is separate as its own map, and thus no map errors.

Maybe this doesn't work anymore...


From http://docs.textadventures.co.uk/quest/showing_a_map.html (which is all I could find):

See the related sections from Showing a map

Reset the map

Restriction: Best for isolated regions the player cannot return to.

An alternative approach is to erase all the existing map data and start again. Here is the code to move the player to room:

player.grid_coordinates = null
player.parent = room
JS.Grid_ClearAllLayers ()
Grid_Redraw
Grid_DrawPlayerInRoom (game.pov.parent)

Of course, this is not ideal, as the player loses their map every time, and if she can teleport back, will be back to square one with regards to the map.

Save the map

Restriction: Only for isolated regions.*

Instead of reseting the map, we can save it as an attribute.

Say your game is divided into three regions, with no way for the player to walk between them. What you can do when the player teleports from area one to area two, is to save the map for area one, and then grab the previously saved data for area two.

This is not trivial, as you will need some way to tell which area the player is leaving. If you limit the player so she can only leave from a single location this is considerably easier…

Save the map, single departure

Restriction: Only for isolated regions, each with a single room the player can teleport to and from.

If we limited the player to a single point of departure in each region, then we can use that to define the region. As an example, let us suppose a railway, and the station for area one is called “Station One”, etc. Station One then identifies the region, allowing us to save and retrieve the map for the region.

We will do the hard work in a function. Call it “TeleportTo”, and give it a single parameter, “to”, then paste in this code:

from = player.parent
set (player, "saved_map_for_" + from.name, player.grid_coordinates)
if (HasAttribute(player, "saved_map_for_" + to.name)) {
  player.grid_coordinates = GetAttribute(player, "saved_map_for_" + to.name)
}
else {
  player.grid_coordinates = null
}
player.parent = to
JS.Grid_ClearAllLayers ()
Grid_Redraw
Grid_DrawPlayerInRoom (game.pov.parent)

Now it is simply a matter if calling the function. For Station One, you will have some command or action that will move the player to Station Two. The code to do that looks like this:

TeleportTo(Station Two)

To go from Station Two back to Station One, use the same code, but put in Station One.


Thanks guys, I'm looking at/testing some of this stuff...


Let us know how it goes. (Hopefully, it goes smoothly!)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums