Skip to content

Idea: repeat action by prefixing it with a number #37

@friedev

Description

@friedev

Some roguelikes, such as NetHack, allow the player to type a number followed by an action, causing them to take that action that number of times, or until interrupted. For example, 50. would cause the hero to wait for 50 turns or until interrupted. (This feature, like the hjkl movement scheme, is an idea borrowed from vim.) This is a flexible system that allows the player to do repetitive actions quickly and safely.

#27 added a special case of this feature, allowing the player to wait until recovered. This is the most common way I use the numeric repeat feature, so I see this as a low-priority feature, but I could imagine some players preferring NetHack's approach. For instance, it could be useful if you wanted to recover some (but not all) of your health, pass a lot of time even after fully healing, walk a certain number of tiles in a direction, or attempt to open a door several times.

Numeric repeat would break Numpad movement with NumLock enabled, since Numlock causes Numpad key presses to send a number, which would now be interpreted as a number of times to repeat an action. Some solutions:

  1. Lock the numeric repeat feature behind an option and disable it by default.
  2. Add a new keybinding to trigger numeric repeat. Pressing this key would open a prompt for a number, and upon receiving the first non-numeric keystroke, would attempt to repeat that action the entered number of times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions