canceling auto explore


Ask fellow adventurers how to stay alive in the deep, dark, dangerous dungeon below, or share your own accumulated wisdom.

User avatar

Tomb Titivator

Posts: 857

Joined: Monday, 31st January 2011, 23:19

Post Saturday, 2nd January 2021, 06:17

canceling auto explore

I'm trying to have auto explore move only one step before canceling. I'm trying to write something similar to this, but with a completely different strategy:

https://github.com/elliptic/qw

Is there a way to cancel exploration and traveling with LUA, as if you pressed a key? Ultimately, the goal is to use runrest_ignore_monster to ignore all monsters, then use my own checks in LUA for when to stop exploration or travel.

Note that I see there is a you.stop_activity(), and a crawl.delay(x). However, I can't get these to work to stop after one step.

Any suggestions?

Alternatively, if the explore and travel functions are in LUA, I could copy them and make the modifications I need, using that instead of the built in ones.

Slime Squisher

Posts: 368

Joined: Thursday, 11th April 2013, 21:07

Post Saturday, 2nd January 2021, 11:06

Re: canceling auto explore

You're looking for chk_interrupt_activity["travel"].

https://doc.dcss.io/modules/Hooks.html# ... t_activity

Pseudocode:

  Code:
chk_interrupt_activity["travel"] = function (iname, cause, extra)
    if conditions() then
        return true
    end
end


The clua exposures of Crawl's interrupt tables are not commonly used by players, or by anyone as far as I can tell. (When I looked this up last year to write an EXPLORE_GREEDY interrupt for ff.rc, the best info I could find was a post by dshaligram from pre-git DCSS!), so you should go into this expecting to encounter even more clua bugs than usual.


P.S.: I'd be curious to see the script you're working on, if you feel like posting a github link?
User avatar

Tomb Titivator

Posts: 857

Joined: Monday, 31st January 2011, 23:19

Post Saturday, 2nd January 2021, 13:02

Re: canceling auto explore

I haven't gotten very far yet, but I'll post something here when I make more progress. Thanks!

More information about what I'm trying to do here:

The biggest problem with automating crawl is retreating. I believe, however, you can set your weapon to !a, use setopts to ignore monsters, then auto travel to the previous level, interrupting after every turn to reassess the situation. I'm guessing that I could also set waypoints before starting each fight, retreat to those waypoints, then begin the auto travel... lots of ideas here... I do think the game can be automated with a 100% win rate if enough thought is put into it, though!

Slime Squisher

Posts: 368

Joined: Thursday, 11th April 2013, 21:07

Post Saturday, 2nd January 2021, 13:16

Re: canceling auto explore

You're very welcome, I look forward to seeing whatever script you might come up with. :)

Just as an FYI, if you start overriding the behavior of autoexplore, you're probably also going to need to implement your own pathfinding: Crawl doesn't expose pathfinding through clua.

There's a dijkstra's example here and an a* example here, although I won't vouch for the correctness of either implementation.
Last edited by Implojin on Saturday, 2nd January 2021, 13:17, edited 1 time in total.

Zot Zealot

Posts: 1004

Joined: Thursday, 16th August 2018, 21:19

Post Saturday, 2nd January 2021, 13:17

Re: canceling auto explore

autoretreat would be really nice.

You do have to take into account where the monsters are imo, since the closes stair is sometimes behind a monster.
User avatar

Tomb Titivator

Posts: 857

Joined: Monday, 31st January 2011, 23:19

Post Saturday, 2nd January 2021, 13:19

Re: canceling auto explore

Yes, that's why I'm thinking to use LUA to set your weapon to !a and check for the prompt to code around bumping into monsters. There's probably a better way, still working out the details.

EDIT

Sadly, the function set in chk_interrupt_activity["travel"] seems to only be called when travel is interrupted, and not every step? Anyway, I'm thinking of setting travel exclusions on monster locations, then clearing them after doing one step of travel, to avoid bumping into them.
Last edited by snow on Saturday, 2nd January 2021, 13:38, edited 1 time in total.

Slime Squisher

Posts: 368

Joined: Thursday, 11th April 2013, 21:07

Post Saturday, 2nd January 2021, 13:22

Re: canceling auto explore

Re: waypoints: One issue I had when trying to automate waypoints was that travelling between them didn't work when monsters were in view.

This was last year, though, so maybe it's been changed? You'd have to test.


edit: I also think that the game can be automated to a near-100% winrate. Seeing the code of a bot that does so with all combos would be interesting!

(While developing my script, I've had to make conscious choices about what *not* to automate so that it doesn't clear too much without human interaction. It's a fine line between "helper script" and "full-on-crawlbot", and that line gets really blurry as you add handlers for more crawl behavior.)
Last edited by Implojin on Saturday, 2nd January 2021, 13:43, edited 1 time in total.
User avatar

Tomb Titivator

Posts: 857

Joined: Monday, 31st January 2011, 23:19

Post Saturday, 2nd January 2021, 13:40

Re: canceling auto explore

Yeah, that's why I'm planning on ignoring all monsters with crawl.setopt("runrest_ignore_monster = .*:-1") then unignoring them with crawl.setopt("runrest_ignore_monster = .*:0"), between steps, and adding travel exclusions on between steps to avoid bumping into them. It's really elaborate, but should work! The only problem is stopping between each step of travel. If I can get that done, everything else is easy. I tried using chk_interrupt_activity["travel"] but it was only being called when I was interrupted by finding an item or something.

One obnoxious option would be to set a slow travel rate, and automate it by holding down the macro key, but that introduces a whole bunch of problems where you have to clear the input buffer and stuff, and it seems like a terrible work around for something that should be possible otherwise, I hope anyway....

Slime Squisher

Posts: 368

Joined: Thursday, 11th April 2013, 21:07

Post Saturday, 2nd January 2021, 13:51

Re: canceling auto explore

edit: Welp, I tried a couple of the more obvious ways to write the behavior you're describing ( including an inequality of you.turns() ) but using chk_interrupt_activity doesn't appear to work for this because, as you've said, the interrupts don't fire until something happens; see /dat/dlua/userbase.lua for the code details of why

I still feel like the behavior you're asking about *should* be possible, but I don't immediately see how.


Anyway, I've successfuly worked around this previously in my script by rolling my own pathfinding for local pathing instead of trying to trick crawl into using autoexplore for local pathing. You could do the same thing here, if you wanted, even though it's more code to setup.
Last edited by Implojin on Saturday, 2nd January 2021, 14:35, edited 1 time in total.
User avatar

Tomb Titivator

Posts: 857

Joined: Monday, 31st January 2011, 23:19

Post Saturday, 2nd January 2021, 14:01

Re: canceling auto explore

I've also tried adding runrest stop messages, and outputting them when running starts, that doesn't work either.
User avatar

Tomb Titivator

Posts: 857

Joined: Monday, 31st January 2011, 23:19

Post Friday, 8th January 2021, 10:19

Re: canceling auto explore

It looks like there's a super simple way to do what I was trying to do! The travel_one_unsafe_move option can be used to help bots retreat :)

For this message the author snow has received thanks:
Implojin

Slime Squisher

Posts: 368

Joined: Thursday, 11th April 2013, 21:07

Post Friday, 8th January 2021, 15:40

Re: canceling auto explore

Neat!

Return to Dungeon Crawling Advice

Who is online

Users browsing this forum: No registered users and 14 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.