def move(actor, parameters):
"""Move the avatar in a given direction."""
- if parameters in actor.universe.contents[actor.get("location")].portals():
- actor.move_direction(parameters)
- else:
- actor.send("You cannot go that way.")
+ for portal in sorted(
+ actor.universe.contents[actor.get("location")].portals()):
+ if portal.startswith(parameters):
+ actor.move_direction(portal)
+ return(portal)
+ actor.send("You cannot go that way.")
def preferences(actor, parameters):
test_abbrev = (
(0, "> ", "h"),
(0, r"h\[elp\].*m\[ove\].*> ", "he mo"),
- (0, r"Move in a specific direction\..*> ", "mov north"),
- (0, r"You exit to the north\..*> ", "m south"),
+ (0, r"Move in a specific direction\..*> ", "mov nor"),
+ (0, r"You exit to the north\..*> ", "m s"),
(0, r"You exit to the south\..*> ", ""),
)
command.look.help: With the look command, you can see where you are.
command.move.description: Move in a specific direction.
-command.move.help: You move in a direction by entering:$(eol)$(eol) move
- north
+command.move.help: Move to another place by supplying the name of a
+ portal/direction or a suitable abbreviation for one,
+ like:$(eol)$(eol) move north$(eol) move s
command.preferences.description: View or change your preferences.
command.preferences.help: If invoked with no parameters, all your current