API for filling in text boxes from lua?

I’m trying to automatically annotate V5 to add a warning when I encounter The Vaults. I do this manually at the moment because I’ve been known to stumble into V5 before I was ready for it.

So, I have written something that runs the following commands when I see those stairs:

crawl.sendkeys(“!”)
crawl.sendkeys(“V”)

At this point one of these little menus comes up because it needs to maybe parse a 2 digit int.

I can’t find anything in the dcss lua documentation to fill in these text boxes.

Is there a way to do this?

I think it should work to just use sendkeys still, with a terminating enter (\{13} iirc). Those textbox uis are a webtiles wrapper over a console interface that just takes key inputs like everything else, and sendkeys is directly interacting with that interface. Also, fwiw you can give multiple keys to sendkeys in a single string.

1 Thank

I tried using terminating enters before but it didn’t work (in fact, I learned a very valuable lesson about debugging a lua script without conditionals while standing near vault gaurds that time(my very promising DgHu died)).

This is my latest effort

crawl.sendkeys(“!D5{13}! DO NOT GO UNLESS READY. BAD STUFF HAPPENS HERE{13}”)

It just stops at the five without the five showing up on the interface. Could there be a delay in that menu coming up? Or should send keys just work?

I tested this out, and it looks like for lua code specifically, you’ll need to use \r instead of \{13}; in retrospect this makes sense because the latter is a crawl macro thing anyways. So the following works as a macro:

!D5\{13}test\{13}

But when done via lua the corresponding sendkeys code would look something like:

{
function asdf()
    crawl.sendkeys("!D5\rtest\r")
end
}

(and then bind a key to ===asdf for this example.) The backslashes are crucial also, they are missing from your code.

Thank you so much!