facebookresearch / nle

The NetHack Learning Environment
Other
940 stars 113 forks source link

CTRL characters in action space #281

Closed kolbytn closed 2 years ago

kolbytn commented 3 years ago

🚀 Feature

ctrl characters in the action space to allow full functionality of wizard mode

Motivation

I was using scrolls and potions to identify objects and increase my character level, but then I realized I could be using wizard mode to do these. For example ctrl-i/\t will identify items and #levelchange will change a character's level (the latter requires the use of crtl-j/\n). I can enter into wizard mode, but I can only use the wizard commands that do not require ctrl characters.

Alternatives

An alternative way to execute all wizard commands.

Additional context

I'm using nle via minihack.

Is there another way to do this that I am missing?

heiner commented 3 years ago

Hey Kolby,

Thanks for your interest in NLE!

I have refrained from changing the action space in the duration of the NetHack Competition. The competition will end soon, at which point I'm happy to add wizard commands like C("i") to actions.py.

Notice that not all wizard commands have keyboard shortcuts.

In the meantime, you can instead execute these commands by inputting a sequence of actions corresponding to their "extended command" name, starting with # (EXTCMD) and ending in \r (MORE).

I will leave this issue open for now and close it once we merged a PR with the wizard actions.

kolbytn commented 3 years ago

Thank you for the information. I had tried using #levelchange\r but the game responds with "Never mind." instead of asking how many levels to go up. I assumed this was because I needed to be using \n instead of \r, but I guess there is something else wrong. Do you know the correct way to use this command?

heiner commented 3 years ago

I don't think it's a question of '\r' vs '\n' (I believe this is the distinction between "return" and "enter" on a keyboard). I suspect what you see might be related to NLE auto-answering some prompts in certain situations, see the last two arguments here.

If you share a ttyrec file where you tried this, we can also take a look. The read_tty.py script, while rather low-level, can help visualizing what happened.

heiner commented 2 years ago

Closing as we added all available wizard actions. Please reopen if this is still an issue.