Port and starboard
So you have this plan for a game, but it is set on a ship or a starship, and north and south do not make any sense. The standard for marine ships is to use forward, starboard, aft and port, so why not implement that for your game? This is actually pretty easy to do using Quest’s built-in language support.
One limitation of the shipwise directions is that you lose four directions. While “northeast” is well established, I think people will find “forwardport” rather odd. Remember that when adding exits to your game!
So what do we need to do? All that is needed is to change about a dozen templates. Each of the templates below already exists in the English language library, so the simplest way to change them is to override each one individually through the GUI. Alternatively, you can paste them straight into code view as shown below; template overrides are matched by name, so it does not matter exactly whereabouts in the file you add them.
In code view, at the very top, it will look like this:
<!--Saved by Quest 5.2.4515.34846--><asl version="520"> <include ref="English.aslx" /> <include ref="Core.aslx" />All the default templates are in English.aslx, and we want to override them. A template you add directly to your own game file will always win over the version in English.aslx, wherever in the file you put it - dynamic templates work the same way. The one place order still matters is if you move your overrides out into a separate library file of their own (see below); that file needs to be included after English.aslx, so its version of each template is the one that ends up registered.
So let us add some templates.
This set changes the directions Quest uses in description when it says “You can go”
<template name="CompassN">forward</template><template name="CompassW">port</template><template name="CompassE">starboard</template><template name="CompassS">aft</template>Also need to change the abbreviated versions.
<template name="CompassNShort">f</template><template name="CompassWShort">p</template><template name="CompassEShort">s</template><template name="CompassSShort">a</template>Quest uses these next two for pattern matching the player input. The specific direction is matched against the templates above.
<template templatetype="command" name="go"><![CDATA[^go to (?<exit>.*)$|^go (?<exit>.*)$|^(?<exit>forward|port|starboard|aft|f|p|a|s|in|out|up|down|o|u|d)$]]></template><template templatetype="command" name="lookdir"><![CDATA[^look (?<exit>forward|port|starboard|aft|f|p|a|s|in|out|up|down|o|u|d)$]]></template>You also need to change the help command. One way is to override the DefaultHelp template (which is not shown here, as it is a lot of text), but you might prefer to create your own help command and do it there. It may be useful to spell out the directions as people are somewhat less familiar with ship directions, and to point out they only have four directions instead of eight.
So what does it look like now? The top of your code should now look like this (this is without the help template):
<!--Saved by Quest 5.2.4515.34846--><asl version="520"> <include ref="English.aslx" /> <template name="CompassN">forward</template> <template name="CompassW">port</template> <template name="CompassE">starboard</template> <template name="CompassS">aft</template> <template name="CompassNShort">f</template> <template name="CompassWShort">p</template> <template name="CompassEShort">s</template> <template name="CompassSShort">a</template> <template name="go"><![CDATA[^go to (?<exit>.*)$|^go (?<exit>.*)$|^(?<exit>forward|port|starboard|aft|f|p|a|s|in|out|up|down|o|u|d)$]]></template> <template name="lookdir"><![CDATA[^look (?<exit>forward|port|starboard|aft|f|p|a|s|in|out|up|down|o|u|d)$]]></template> <include ref="Core.aslx" />Wouldn’t this be easier in a library?
Well, go on then.
Save this file to your game’s folder, and modify the code at the start of the file to this:
<!--Saved by Quest 5.2.4515.34846--><asl version="520"> <include ref="English.aslx" /> <include ref="ShipwiseLib.aslx" /> <include ref="Core.aslx" />One last note. After adding new templates, or a library with templates, you need to save the game, quit Quest, then open it up again to get the templates loaded up properly.
It might be a good idea to implement a command so your game responds to NORTH, EAST, etc., explaining the system. Here is an example of such a command, but you will probably want to tailor it to your game and style.
<command name="compass_directions"> <pattern>w;e;s;n;se;ne;sw;ne;west;south;east;north;northeast;southeast;northwest;southwest</pattern> <script> msg ("This story is set on a ship, and the standard compass directions make no sense in that context. Instead,directions are referenced shipwise. Looking towards the front of the ship, ahead of you is \"forward\" (where north would be on the compass rose to the right) and behind you is \"aft\". To the left is \"port\", and to the right is \"starboard\".") msg ("If you get confused about port and starboard, remember that \"port\" and \"left\" are both four letters long. Or remember that starboard is a corruption of stearboard, an early form of rudder. Most people are right handed so the stearboard was always on the right,") </script></command>Note that this will not work if included in the library above. I suspect it has to be after the core library is loaded. Put it in the main file or a library that appears after Core.aslx in the list.