Repeated actions
DavidePaglieri opened this issue · 4 comments
Would it be possible to add the possibility to repeat an action multiple times in a row?
In alt.org/nethack you can repeat an action multiple times by doing: n20s
for example if you want to perform the search action 20 times in a row.
https://www.reddit.com/r/nethack/comments/933c3s/how_do_i_safely_rest_by_using_a_repeat_command/
This should be possible, although in a slightly non-obvious way, by giving it the right sequence of actions (e.g., ones that end up as 2
, 0
, s
). Did you try that?
No that doesn't work. Currently it takes one keystroke at a time, and I don't think it's chaining subsequent commands.
When I try it says:
Selected action '2' is not in action list. Please try again.
Selected action '0' is not in action list. Please try again.
Then it performs a single search with s
That error message gives a hint as to how to solve this: Add the number actions to the set of actions.
A straightforward way you could do this is by modifying the NLE
in base.py in the following way:
if action == nethack.MiscDirection.SEARCH:
self.nethack.step(ord("2"))
self.nethack.step(ord("5"))
observation, done = self.nethack.step(ord("s"))
However that replaces the standard SEARCH
one-step action. In that case you could create a new action like SEARCH_LONGER
.