Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated actions #14

Open
DavidePaglieri opened this issue May 24, 2024 · 4 comments
Open

Repeated actions #14

DavidePaglieri opened this issue May 24, 2024 · 4 comments

Comments

@DavidePaglieri
Copy link

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/

@heiner
Copy link
Owner

heiner commented May 24, 2024

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?

@DavidePaglieri
Copy link
Author

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

@heiner
Copy link
Owner

heiner commented May 26, 2024

That error message gives a hint as to how to solve this: Add the number actions to the set of actions.

@mklissa
Copy link
Collaborator

mklissa commented Jun 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants