About ready() and autoexplore


Problems running or configuring the software, commands & options, compiling, different platforms, using the interface, documentation, etc.

Shoals Surfer

Posts: 295

Joined: Tuesday, 14th April 2015, 19:56

Location: France

Post Friday, 18th May 2018, 21:20

About ready() and autoexplore

Hi, I am trying to do a bit of rcfile magic, and would like to update my auto_butcher settings while autoexplore is running.
What I gather is happening : When I press 'o', autoexplore takes the wheel and the ready() function is only called at the end of exploration, not during it.
What I could do about it : Write a my_autoexplore() function and macro it to 'o'. I do not want to do that.

Is my assumption about what's happening correct ? Is my solution the only one ? Is there another function that is called after each autoexplore step, or a function that returns what the next autoexplore step would be ?
3 runes : MiMo^Ru, HOFi^Beogh, TrMo^Yredelemnul, GrFi^Ru
4 runes : DDFi^Makhleb
5 runes : GrEE^Vehumet
15 runes : MiFi^Ru, NaWz^Sif Muna
I mostly play offline or online on CXC

Dungeon Master

Posts: 112

Joined: Thursday, 27th November 2014, 19:12

Post Saturday, 7th July 2018, 01:31

Re: About ready() and autoexplore

I've been digging into the crawl Lua api to document it (final results coming soon). But I know enough to answer your question now.

What you gather is happening is correct. ready() is only called when there is no pending input and you are not currently processing a delay (any multi turn action is a delay internally; autoexplore processes as a TravelDelay).

Autoexplore is implemented in C++ and not in clua, so it is not extensible in the way you'd like (redefine a Lua function). The best that's available are the pair of callback hooks ch_start_running and ch_stop_running. Crawl will call these when you start/stop running or resting, with a single string parameter that is either "travel", "interlevel", "explore", "explore_greedy", or "".

You can define these functions to have something update automatically at the start/end of autoexplore.

Shoals Surfer

Posts: 295

Joined: Tuesday, 14th April 2015, 19:56

Location: France

Post Saturday, 7th July 2018, 03:10

Re: About ready() and autoexplore

Wow thanks a lot for taking the time to reply to this old thread :D
Unfortunately what I want to do is change options while in the middle of autoexploring, which you're telling me is impossible (short of rewriting autoexplore in Lua).
Thank you very much for the info though, at least now I know :)
3 runes : MiMo^Ru, HOFi^Beogh, TrMo^Yredelemnul, GrFi^Ru
4 runes : DDFi^Makhleb
5 runes : GrEE^Vehumet
15 runes : MiFi^Ru, NaWz^Sif Muna
I mostly play offline or online on CXC

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 2 guests

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