Auto Butcher Version 3


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 Friday, 27th December 2013, 17:13

Auto Butcher Version 3

This script will automatically butcher corpses and eat chunks for you!

Just copy this into your RC file and it works! There's NO NEED to fumble around with macros or anything like that. It works with every species: spriggans, mummies, trolls, hill orcs, and more! Just copy it, paste it, and forget it exists! It doesn't interact in any way with any other options you have set so there's no reason not to use it!

It works for trunk at the moment and may not work for earlier versions of Crawl.

  Code:
:function can_eat_chunks()
:  if you.race()=="Spriggan" then return end
:  if you.gourmand() or you.race()=="Kobold" or you.race()=="Felid" then
:    return you.hunger()<6
:  end
:  return you.hunger()<4
:end

:function edible_corpse(item)
:  if not can_eat_chunks() then return end
:  if food.rotting(item) and not you.saprovorous() then return end
:  if food.dangerous(item) then return end
:  return string.find(item.name(),"corpse")
:end

:function over_corpse()
:  for item_under_you in iter.invent_iterator:new(you.floor_items()) do
:    if string.find(item_under_you.name(),"corpse") then return true end
:  end
:end

:function over_edible_corpse()
:  for item_under_you in iter.invent_iterator:new(you.floor_items()) do
:    if edible_corpse(item_under_you) then return true end
:  end
:end

:function walk_over_edible_corpses(item)
:  return edible_corpse(item) and not over_edible_corpse()
:end

:function ready()
:  if not default_options then
:    default_options=options.runrest_stop_message
:    crawl.setopt("confirm_butcher=never")
:    crawl.setopt("auto_eat_chunks=true")
:  end
:  if can_eat_chunks() then
:    crawl.setopt("runrest_stop_message+=corpse")
:  else
:    crawl.setopt("runrest_stop_message="..default_options)
:  end
:  if you.feel_safe() and over_edible_corpse() then
:    crawl.sendkeys("c")
:    crawl.process_command()
:  end
:end

:add_autopickup_func(walk_over_edible_corpses)
Last edited by snow on Friday, 27th December 2013, 20:48, edited 4 times in total.

For this message the author snow has received thanks: 5
Abominae, johlstei, nago, rockygargoyle, Sandman25

Swamp Slogger

Posts: 147

Joined: Thursday, 29th August 2013, 02:22

Post Friday, 27th December 2013, 18:24

Re: Auto Butcher Version 3

So ive never messed with my rc file before so im not sure exactly how it works but I pasted this into my init.txt file in crawl\options and it doesnt seem to be working. im using the downloadable trunk tiles version. is that what i am supposed to do?
User avatar

Tomb Titivator

Posts: 857

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

Post Friday, 27th December 2013, 19:11

Re: Auto Butcher Version 3

You might have another init.txt somewhere and Crawl is finding that one instead.
Try having init.txt in the same folder as crawl.exe instead of in the settings folder.

Ziggurat Zagger

Posts: 3163

Joined: Friday, 6th January 2012, 18:45

Post Friday, 27th December 2013, 19:47

Re: Auto Butcher Version 3

On the main menu, you should see a line near the top of the screen that says, "Read the instructions for legal details. (Read options from <options path>.)" The path and file name in <options path> is what you need to edit.

Shoals Surfer

Posts: 252

Joined: Sunday, 19th May 2013, 21:30

Post Friday, 27th December 2013, 19:59

Re: Auto Butcher Version 3

I tried it. All it seems to do is mark corpses for pickup.
User avatar

Tomb Titivator

Posts: 857

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

Post Friday, 27th December 2013, 20:05

Re: Auto Butcher Version 3

MrPlanck wrote:I tried it. All it seems to do is mark corpses for pickup.


What version of Crawl are you running?

Ziggurat Zagger

Posts: 11111

Joined: Friday, 8th February 2013, 12:00

Post Friday, 27th December 2013, 20:09

Re: Auto Butcher Version 3

It works for me: one 'o' finds a corpse and butchers it, next 'o' eats it and continues autoexplore.

Ziggurat Zagger

Posts: 3163

Joined: Friday, 6th January 2012, 18:45

Post Friday, 27th December 2013, 20:10

Re: Auto Butcher Version 3

I find it ignores corpses that I've stepped on already.
User avatar

Tomb Titivator

Posts: 857

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

Post Friday, 27th December 2013, 20:24

Re: Auto Butcher Version 3

BlackSheep, can you post your RC file? I'm curious if there's some interaction that I didn't think of.

Shoals Surfer

Posts: 252

Joined: Sunday, 19th May 2013, 21:30

Post Friday, 27th December 2013, 20:25

Re: Auto Butcher Version 3

snow wrote:
MrPlanck wrote:I tried it. All it seems to do is mark corpses for pickup.


What version of Crawl are you running?


.14. I was probably doing something wrong.
User avatar

Tomb Titivator

Posts: 857

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

Post Friday, 27th December 2013, 20:27

Re: Auto Butcher Version 3

MrPlanck, there might be an issue with my script. I'm trying to figure out what it could be though. It works perfectly fine for me and Sandman25....

Shoals Surfer

Posts: 252

Joined: Sunday, 19th May 2013, 21:30

Post Friday, 27th December 2013, 20:29

Re: Auto Butcher Version 3

snow wrote:MrPlanck, there might be an issue with my script. I'm trying to figure out what it could be though. It works perfectly fine for me and Sandman25....


I think the key was using autoexplore, which I had not been using
User avatar

Tomb Titivator

Posts: 857

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

Post Friday, 27th December 2013, 20:31

Re: Auto Butcher Version 3

Oh, it's working for you now? Yes, butchering is done while exploring (with the "o" key).
User avatar

Tomb Titivator

Posts: 857

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

Post Friday, 27th December 2013, 20:52

Re: Auto Butcher Version 3

I've modified the script so it now works when you start exploring on a corpse. Previously, it only butchered once you stopped exploring on a corpse and not when you started exploring on a corpse.

Swamp Slogger

Posts: 147

Joined: Thursday, 29th August 2013, 02:22

Post Friday, 27th December 2013, 21:15

Re: Auto Butcher Version 3

could it make a difference if im clicking the autoexplore button on the interface instead of pressing 'o'

Tomb Titivator

Posts: 853

Joined: Thursday, 29th August 2013, 18:39

Post Friday, 27th December 2013, 21:19

Re: Auto Butcher Version 3

This seems great! I have some questions, sorry for being a crawl lua noob.

How does the ready() function get invoked? I don't see it called anywhere, is it a special name?

This seems great but not quite everything I want, though you've given me the impetus to improve it if I can. I'm at work so I can't play with it now. Does it stop autoexplore when you eat something? I think ideally it would autoexplore again, since there isn't generally any decision-making to be done after eating. At some point I'd like to figure out the right way to combine auto-sac with this. At present will it backtrack over corpses I've already stepped on if I become hungry? (This is tricky too, gotta determine not just if a corpse is rotted but if it will have rotted by the time you get there.)
User avatar

Tomb Titivator

Posts: 857

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

Post Friday, 27th December 2013, 21:53

Re: Auto Butcher Version 3

It works fine with auto_sacrifice and eating doesn't stop exploration. Specifically, you sacrifice the corpses if you can't eat their chunks at the moment.
If you step over a corpse, and don't do anything with it, and get hungry, you will backtrack and grab it.
ready() is a lua hook. Crawl calls it so you don't have to.
User avatar

Tomb Titivator

Posts: 857

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

Post Friday, 27th December 2013, 21:58

Re: Auto Butcher Version 3

variouselite wrote:could it make a difference if im clicking the autoexplore button on the interface instead of pressing 'o'

This shouldn't be an issue. If it's not working then Crawl can't find your init file and you could just create one in the same folder as crawl.exe.

Spider Stomper

Posts: 215

Joined: Monday, 21st May 2012, 20:09

Post Friday, 27th December 2013, 22:15

Re: Auto Butcher Version 3

This is working great for me. Thanks a bunch!
Wir saufen, und wir sind noch da!

Swamp Slogger

Posts: 147

Joined: Thursday, 29th August 2013, 02:22

Post Friday, 27th December 2013, 22:49

Re: Auto Butcher Version 3

well it works now, not sure what changed other than dying and starting a new char. great job man, very helpful.

*edit* WTH, that char died, i start a new one, and now it doesnt work again.. very confused.

*edit 2* ok.... so i saved and exited, restarted and reloaded the char and now it works again. 0_o

Spider Stomper

Posts: 224

Joined: Monday, 19th November 2012, 04:56

Post Monday, 30th December 2013, 00:30

Re: Auto Butcher Version 3

This is really awesome, only it marks (or rather, doesnt un-mark) and butchers rotted corpses for me. Even so this is awesome :D

Cocytus Succeeder

Posts: 2229

Joined: Sunday, 18th December 2011, 13:31

Post Monday, 30th December 2013, 19:04

Re: Auto Butcher Version 3

Awesome script - I'm using in 0.13 and it works greatly.

I've only one remark to do: this script automatically butcher a corpse even when you manually move on it if hungry.
This can be really dangerous when you are escaping from something and you've break LOS, because you waste precious turns, and quite annoying while you move on big badass' corpse (e.g. uniques) and you worship Oka/Trog/Makh because you lose quite a bit of piety.

So, I'm asking if is possible to change this issue - for example, starting autobutchering only if moving with autoexplore.

To be exhaustive, there's another small issue: as already pointed out, the script search also for rotting corpse, which is pointless for 90% of races. Probably is possible to force this behaviour only with saprovore races, but this is a small problem (only waste of turns).
screw it I hate this character I'm gonna go melee Gastronok
User avatar

Tomb Titivator

Posts: 857

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

Post Tuesday, 31st December 2013, 00:10

Re: Auto Butcher Version 3

It's possible to have it only butcher after exploring with ch_stop_running().

The issue is, though, if you're standing on a corpse when you press "o." To avoid using macros (since I've found 90% of people won't touch a script that involves setting a macro because it's too much effort) I'd have to capture inputs and flush them if they're not "o" then, if the input is "o," check if a corpse is under you and such. I might take a shot at it.

As for searching for rotting corpses, I don't know if it's currently possible to check if a corpse is about to rot or not. How does auto_sacrifice do it?

Return to Dungeon Crawling Advice

Who is online

Users browsing this forum: No registered users and 51 guests

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