For feedback and suggestions regarding the autofight (tab-key) process.



Suggested Enhancements

Pause Tab on New Monster Appearance

As a chronic autofight abuser, holding down tab has killed me many times due to the appearance of unexpected new creatures. It would be a good idea for the 'tab' key to not work (one time) if the prior message to the console was “come into view.” or “comes into view.”, indicating the first appearance of a creature.

The current work-around is to use the following settings which create issues with autoexplore.

force_more_message=comes into view.
force_more_message=come into view.

This pause would require an additional method to be checked immediately after the check against hp_is_low() in the hit_closest() and hit_adjacent() functions.

The new method, check_view_for_monster() would check the prior message posted to the console and compare.

I do not know the code base, but I would assume messages posted to the user console have a numeric id associated with them in addition to their outgoing textual component.

The code to this would be to store a global numeric variable (last_message_id) that is initialized to 0.

pseudocode as I do not know lua; This hinges on console messages having some sort of unique identifier.


    last_console_message = crawl.get_last_console_message()
    if (global_last_message_id !=
      global_last_message_id =
      return last_console_message.text ENDS_WITH "into view."
  return false

The option to turn this off would be autofight_check_view.

Repeatable Autofight

Since shift-direction (or /-direction) triggers repeated travel until something notable happens, shift-tab (or /-tab) should repeat autofight until one of these things happen:

  • A new enemy appears
  • Autofight fails (due to no visible enemies, presumably)
  • Autofight would require entering a travel exclusion
  • HP drops too low, to a percentage configurable in options but defaulting at perhaps 50%.
  • Player status changes, due to buffs running out or an enemy hexing the player.

This would dramatically reduce the number of keystrokes needed to melee trivial enemies and groups of enemies. — jejorda2 2011-06-21 17:27

It would also greatly reduce the risk of inadvertently continuing to autofight in a dangerous situation as is so easy to do.

Add autofight to in-game command list

Currently it is not listed.

Implemented Suggestions

Disable Autofight Option

Add an option to disable autofight when your HP drops below a certain percentage (this, if possible, being set by the user, otherwise it should be at 20%). The fact is, some play styles are so repetitive that it is easy to autofight yourself into a ghost or an ogre if one pops up while you're fighting another creature. A workaround for this is to put a force_more on “comes into view” or “low hitpoint warning”, but that probably 4 times out of 5 that would be a false alarm (the latter being particularly annoying when waiting out poison). Crawl's interface generally seems to be geared towards not allowing the user to kill themselves through simple inattention - hence the fact that you cannot just walk into deep water, and even get prompted while doing so with expiring levitation. Certainly having your HP at 20% is a better consequence for tabbing a ghost than getting killed, especially since it gives you a chance to actually use your escape items. No, this isn't a problem for everybody, but on the other hand, neither is walking into water or lava - the interface safety net should be there just the same.

As for the message it can give when your HP is too low, something to the effect of “You're too injured to blindly rush at opponents!” -IonFrigate


This has been implemented in autofight.lua in v0.10 using the option autofight_stop = ##. At this time, autofight_stop=## is not listed in init.txt in any form (read: (un)commented). Per autofight.lua, the value defaults to 30%.

Mantis bug with candidate patch to add entry to init: 5241

Combine hit_closest and hit_adjacent

Mantis bug with candidate patch to resolve this: 5240

The only difference between hit_closest and hit_adjacent in autofight.lua is a single line. Recommendation to reduce code maintenance : abstract the hit_closest and hit_adjacent methods to call a single utility method which takes a boolean is_adjacent that is checked at the point of difference.

function hit_closest()

function hit_adjacent()

function hit_abstract(is_adjacent)
  local x, y, info = get_target()
  if you.confused() then
    crawl.mpr("You are too confused!")
  elseif hp_is_low() then
    crawl.mpr("You are too injured to fight blindly!")
  elseif info == nil then
    crawl.mpr("No target in view!")
  elseif info.can_hit == 3 then
  elseif info.can_hit == 2 then
  elseif info.can_hit == 1 then
  elseif is_adjacent then
    crawl.mpr("No target in range!")    
Logged in as: Anonymous (VIEWER)
dcss/brainstorm/interface/autofight.txt · Last modified: 2012-07-18 16:39 by Borrovan
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki