"JS.setCompassDirections" Doesn't Work [SOLVED]

I found the explanation to use this JS function under the Quest documentation here:


(about 2/3 down the page under the heading "SetCompassDirections")

I made a bare-bones game and put the function in question...

JS.setCompassDirections ("northwest;north;northeast;west;east;southwest;whatever;southeast;up;down;in;out")

...in a room's "Before entering", "After entering", and local turn scripts. Note that the south exit has been changed to whatever. Then I changed the whatever exit's alias to "whatever" as per the Quest doc's instructions.

After you enter the room with the changed compass, the exit link "whatever" in the room's description DOES work when you mouseclick it. However, mouseclicking on the compass (on the "whatever" direction) does NOT work, nor does typing "whatever" as a directional command. In both failed cases, Quest responds, "I don't understand your command."

I tried making the whatever exit a non-directional exit, but there was no change. Also added "whatever" to the default go command's regex command pattern with no effect. Any way to make this work? Thanks.

<!--Saved by Quest 5.8.6809.15141-->
<asl version="580">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="JS.setCompassDirections">
  <object name="room">
    <inherit name="editor_room" />
    <isroom />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    <exit alias="north" to="room2">
      <inherit name="northdirection" />
  <object name="room2">
    <inherit name="editor_room" />
    <enter type="script">
      JS.setCompassDirections ("northwest;north;northeast;west;east;southwest;whatever;southeast;up;down;in;out")
    <beforeenter type="script">
      JS.setCompassDirections ("northwest;north;northeast;west;east;southwest;whatever;southeast;up;down;in;out")
    <exit alias="whatever" to="room">
      <inherit name="southdirection" />
    <turnscript name="ChangeCompass">
        JS.setCompassDirections ("northwest;north;northeast;west;east;southwest;whatever;southeast;up;down;in;out")
      <enabled />

This is the text from the Quest doc's instruction for use of JS.setCompassDirections from the link cited in the last post:


Takes a semi-colon separated list of compass direction names and assigns them to the compass buttons. As of Quest 5.7.2, use JS instead, for example:


These names will also then not appear as exits in the “Places and Objects” list. The default is as shown in the example. The compass directions must be specified in the same order and there must be the same number of elements in the list. The exit in the compass rose will only be active if the alias of the exit matches the text you set here.

I'm going to mark this as an issue on Github.

Also added "whatever" to the default go command's regex command pattern with no effect.

That should work.
Can you show the pattern you're changing it to?

Ok, I figured it out. It DOES work if you do the following 4 things:

  1. Put the modified JS.setCompassDirections () in the room's "After entering..." script. This has to be changed/reset in the same manner when the player enters adjoining rooms.

  2. Change the exit's alias to whatever.

  3. Make the exit non-directional.

  4. Add "whatever" to the default go command's regex pattern.

The reason I had trouble was because I did #3 and #4 separately, but not simultaneously. I did not mark this on GitHub, but the Quest documentation should probably be edited to reflect this additional info.

Thanks mrangel for the response. I've been using KV's Nautical Library to do this same thing, but it wasn't designed to change individual rooms' compass directions (although it is still very nice for what it does).

After further experimentation with a mapped game, I've concluded that the altered exit should actually stay directional, but the exit's alt list should have the appropriate directional names added to it. Otherwise, unknown coordinate errors get spewed out. And the new exit aliases should also be added to the default lookdir command.

This is a powerful function -- I don't know why there isn't more interest/discussion regarding this. Maybe I'm just slow to catch on to it?

Log in to post a reply.