Adding a synonym to the 'go' command? / Add global 'walk' command-verb

Hello, is there a way to add global synonyms to the 'go direction' command?

I'd like the player to be able to type either 'walk north' or 'go north' and they will move north, for all compass directions.

Right now the only workaround I found is making individual custom commands in each room that starts a script to move the player in the appropriate direction/exit:
ie: Room: Scene 1A Steppe Valley: // Pattern: walk south // Script: MoveObject (player, Scene 1B River Bank)

While this gets the results I want, there must be a more efficient way to add another keyword for global movement across the game, rather than repeatedly adding individual custom movement commands in each room.

Any ideas or solutions?

I deep-dived the forums and google and tutorials and documentation and haven't been able to find any clear insight.

Any help appreciated thank you! :)


I just saw something similar to this in the Libraries and codes forum. A someone named EightOne made a bunch of libraries for updating the editor. One was a "Use global" for making "Use" also work to open, switch, etc. objects.

https://textadventures.co.uk/forum/samples/topic/qwkhq0q1luutclrbspo7yq/8ne-useallround-2-6-use-the-use-verb-global-for-opening-closing-switching

Maybe you could find a way to modify this library so that it swapped out "Go" for "Use" and had your custom commands.

The only thing I can think is that "Go" might work with a different function burried in the system somewhere.

But maybe another option would be to figure out what the existing "Go" code is, and create your own function that reads "walk" and executes the existing "go" script? Then you'd just set the go attribute in your room to call that function?

Mrangel will know. I'm pretty new to all this... but here's hoping that my two novice ideas at least provide some brain-fodder if not some actual resolution.


"But maybe another option would be to figure out what the existing "Go" code is, and create your own function that reads "walk" and executes the existing "go" script?"

This was my thinking too, revisited the documentation and finally figured it out. Here it is for anyone in future:
Command: walk #exit#
Script: game.pov.parent = exit.to


I think you just want to modify the language in this case.

The language file English.aslx contains the line:

  <template templatetype="command" name="go"><![CDATA[^go to (?<exit>.*)$|^go (?<exit>.*)$|^(?<exit>north|east|south|west|northeast|northwest|southeast|southwest|in|out|up|down|n|e|s|w|ne|nw|se|sw|o|u|d)$]]></template>

If you copy this into your game in full code view (I'd suggest putting it immediately after the <include lines), and change go to (go|walk) it should work as you expect. Or even (go|walk|run). Although I think it would actually be more efficient (and easier to update in future) to make it:

  <template templatetype="command" name="go"><![CDATA[^(go|walk)( to)? (?<exit>.*)$|^(?<exit>north|east|south|west|northeast|northwest|southeast|southwest|in|out|up|down|n|e|s|w|ne|nw|se|sw|o|u|d)$]]></template>

If you're in the web editor and can't change the templates, you could make a command walk which just acts as a proxy, calling go.

Pattern: walk #exit#
Script:

do (go, "script", QuickParams("exit", exit))

This would just invoke the core "go" command; so it will work correctly for all exits, including ones that are locked or have other features.


Thank you mrangel, this helps a ton!


The aptly named Mrangel to the rescue again!

I took notes :-)


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

Support

Forums