Page 1 of 1

Is there a guide to editing the rcfile?

PostPosted: Friday, 19th May 2017, 22:03
by 4Hooves2Appendages
As the topic says. I've never bothered looking into it, but maybe it's time I made my life a bit easier.

Is there a comprehensive guide / documentation for rcfile editing?

Or a collection of useful lines?

Re: Is there a guide to editing the rcfile?

PostPosted: Friday, 19th May 2017, 22:53
by Wark
Options guide at github is a good place to start.

Re: Is there a guide to editing the rcfile?

PostPosted: Saturday, 20th May 2017, 00:16
by Implojin
4Hooves2Appendages wrote:Is there a comprehensive guide / documentation for rcfile editing?

options_guide.txt, although it barely touches on the information needed to use rcfile Lua. That link is only accurate for trunk, since the devteam has been known to add and remove options at will. For any older version, reference the options_guide.txt contained within that distribution.

Regarding the Lua bindings and hooks made available, no real documentation exists. You can write custom Lua in your rcfile and call it within the game, from any of several exposed hooks, using the gamestate information that's exposed to the (c)Lua interpreter. There was an attempt at documentation of the hooks, located here: https://github.com/paulcdejean/crawl-lu ... /README.md, but it's incomplete and probably unreliable.

The best way to see what the DCSS Lua bindings do is to grep the source.
  Code:
git grep -n luaL_reg
from within a clone of the repo will show you the file locations of the libraries containing most of the game's Lua binds, you can browse or grep further from there to find the exposed functions. The functions inside of libraries named _clib[] are typically available for the player to call (these are referenced in the code as clua), the ones registered under _dlib[] are used internally for the game's dungeon generation (dlua) and are typically locked out for player use unless you've activated wizmode.
There are some hooks that do nothing by default, but are exposed so that players can override them with custom behavior. These can mostly be found by grepping for CLua::call , which after a bit further down the rabbit hole will let you locate the actual function names available to override.

Autofight, automagic, and a few other things also run through Lua. The default behaviors there can be replaced or augmented as above.

4Hooves2Appendages wrote:Or a collection of useful lines?

Browsing experienced players' rcfiles is a good place to start, you can also look at qw.rc for ideas.
http://crawl.akrasiac.org/rcfiles/crawl-git/crate.rc
https://github.com/MarvinPA/MarvinPA.rc
https://github.com/HilariousDeathArtist/DCSSConfigFile
https://github.com/gammafunk/dcss-rc
https://github.com/elliptic/qw/blob/master/qw.rc

And if you want one full of outdated options originally intended to slow down sloppy play:
http://crawl.berotato.org/crawl/rcfiles ... mplojin.rc

Re: Is there a guide to editing the rcfile?

PostPosted: Monday, 22nd May 2017, 09:39
by quik
Check out my RC file: http://crawl.xtahua.com/crawl/rcfiles/c ... 19/quik.rc

Most of it is taken from other players' RCs, but it has lots of stuff and it is mostly commented.

Re: Is there a guide to editing the rcfile?

PostPosted: Tuesday, 23rd May 2017, 21:28
by Implojin
quik wrote:Check out my RC file: http://crawl.xtahua.com/crawl/rcfiles/c ... 19/quik.rc

Most of it is taken from other players' RCs, but it has lots of stuff and it is mostly commented.

You have a bunch of stop += lines in your rcfile that look like they were taken from HDA's rcfile, but stop within that rcfile is just an alias for runrest_stop_message, and your rcfile doesn't seem to have any includes or aliases that would define stop to do anything. If you want those stop+= lines to behave as they do in HDA's rc, you should add this near the top of your rc:
  Code:
stop := runrest_stop_message

If you've done this intentionally for some reason, feel free to ignore this post, but I thought you might like to know.

Re: Is there a guide to editing the rcfile?

PostPosted: Tuesday, 23rd May 2017, 22:28
by quik
Implojin wrote:You have a bunch of stop += lines in your rcfile that look like they were taken from HDA's rcfile, but stop within that rcfile is just an alias for runrest_stop_message, and your rcfile doesn't seem to have any includes or aliases that would define stop to do anything.


Thank you for pointing it out. It's a mistake. That part of my file was taken from http://crawl.xtahua.com/crawl/rcfiles/c ... rceMore.rc and it seems that alias isn't defined in there either. I guess it also doesn't work in the original file, if I'm not missing anything.

Anyway, it's fixed in my file now. Thanks again.