Viewing Issue Simple Details Jump to Notes ] Wiki ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005634 [DCSS] Bug Report trivial always 2012-05-04 06:33 2016-04-13 01:44
Reporter blackflame View Status public  
Assigned To wheals
Priority normal Resolution done  
Status resolved   Product Branch 0.10 ancient branch
Summary 0005634: Autofight with tab doesn't work properly if vi keys are disabled.
Description When the no_vi_command_keys,txt file is included in init.txt, melee autofighting seems to stop working. Ranged autofight still works, but when I try tab-fighting in melee, I get an "unknown command" message. Turned vi keys back on, and it works fine. This is on 0.10 tiles, Windows XP. Apologies if this has already been reported, I didn't see it anywhere.
Additional Information
Tags No tags attached.
Attached Files ? file icon 0001-Fix-for-0005634-allow-and-properly-map-numpad-in-mac.patch [^] (4,563 bytes) 2013-05-06 02:30 [Show Content]

- Relationships
has duplicate 0006639closedneil Dvorak breaks autofight.lua 

-  Notes
SkaryMonk (reporter)
2013-02-18 11:24
edited on: 2013-02-18 11:25

I tried the solution suggested in, [^] namely copying the entire autofight.lua into my rc, but it didn't work. I received this error message:

Lua error: ...launch/crawl-web-0.11-b634444/dat/clua/autofight.lua:234: attempt
_to perform arithmetic on global 'AUTOFIGHT_STOP' (a nil value)

(This was obviously in webtiles version 0.11-b634444, not 0.10 as with the original reporter.)

rriegs (reporter)
2013-02-23 04:47

I've used things like this in some of my scripts:

local function get_command(cmd)
   local key = crawl.get_command(cmd)
   key = key:gsub("uppercase ", "")
   key = key:gsub("Numpad ", "")
   return key:gsub("Ctrl-", "*")

local g_cmd_move_left = get_command("CMD_MOVE_LEFT")

Autofight could be updated to use these instead, and Dvorak / no vi keys would cause a lot less trouble. (I realize the fiat omission of Numpad isn't correct, but much preferable to interpreting a heap of funny characters as commands.) Even better, crawl.get_command() or some variant could return strings that are directly parsable by crawl.sendkeys(), or crawl.process_command() could be made directly available for inputs such as "CMD_MOVE_LEFT".
dylex (reporter)
2013-05-06 02:37

I've attached one way to partially fix this problem, but primarily it highlights that this is actually just one of a number of places where vi navigation keys are assumed, including curses and tile keys. This solution also does not work for other commands (like, evoke and fire, both still used from autofight).

The approach of using process_command to pass "CMD_MOVE_LEFT" would be better, but because keys are processed in process_key in two ways (an immediate lookup, and the macro buffer) it's hard to find a single solution. Another way to solve this would be pass negative integers to process_key, which is already supported by key_to_command, but then all the key enum values would need to be exported to lua.

I'm willing to put more work into some approach if the developers have an opinion, but it really is a pretty awful and widespread bug as it stands.
Medar (developer)
2015-11-05 16:18
edited on: 2015-11-07 09:56

The workaround of copying the entire autofight.lua (and possibly also automagic.lua) to RC seems to work, if you use < and > for in-lining lua instead of { and }.

Doesn't seem to be quite that simple, see: [^]

Timbermaw (reporter)
2015-11-20 22:51

This is pretty annoying, I tried to rebind my y key but then it will conflict with the auto-fight script.
Is customizing the script the only option? Can't the auto-fight script just use the move commands instead of the hotkeys? (i assume this is what is happening)
wheals (administrator)
2016-04-13 01:44

Fixed in [^]

- Issue History
Date Modified Username Field Change
2012-05-04 06:33 blackflame New Issue
2013-02-18 01:01 neil Relationship added has duplicate 0006639
2013-02-18 11:24 SkaryMonk Note Added: 0021066
2013-02-18 11:25 SkaryMonk Note Edited: 0021066
2013-02-23 04:47 rriegs Note Added: 0021121
2013-05-06 02:30 dylex File Added: 0001-Fix-for-0005634-allow-and-properly-map-numpad-in-mac.patch
2013-05-06 02:37 dylex Note Added: 0022558
2015-11-05 16:18 Medar Note Added: 0029738
2015-11-07 09:56 Medar Note Edited: 0029738
2015-11-20 22:51 Timbermaw Note Added: 0029815
2016-04-13 01:44 wheals Note Added: 0030376
2016-04-13 01:44 wheals Status new => resolved
2016-04-13 01:44 wheals Fixed in Branch => 0.18 development branch
2016-04-13 01:44 wheals Resolution open => done
2016-04-13 01:44 wheals Assigned To => wheals

Mantis 1.1.8[^]
Copyright © 2000 - 2009 Mantis Group
Powered by Mantis Bugtracker