# csdc
explore_greedy = true
explore_stop = items,greedy_items,greedy_pickup
explore_stop += greedy_sacrificeable
explore_stop += greedy_visited_item_stack,stairs,shops,altars,gates
explore_auto_rest = true
auto_eat_chunks = true
-- To use this create a macro with the following function call in game
-- ===animate
-- you can customize this level of hungriness
auto_butcher = hungry
: function animate()
: local is_safe = (first_monster == nil)
: local mp, max_mp = you.mp()
: local hp, max_hp = you.hp()
:
: local you_are_deep_dwarf = string.find(you.race(), "Deep Dwarf")
: local you_are_mummy = string.find(you.race(), "Mummy")
:
: local near_starving = ( string.find(you.hunger_name(), "near starving") )
: local starving = ( string.find(you.hunger_name(), "starving") and not string.find(you.hunger_name(), "near") )
: local should_rest = not_full(hp, mp, max_hp, max_mp)
:
: local can_cast_regen = known_spells["Regeneration"] and (mp>3) and (spells.fail("Regeneration") < 20)
: local you_know_sublimation = known_spells["Sublimation of Blood"] and (spells.fail("Sublimation of Blood") < 20) and (mp>3)
: local you_know_animate_skeleton = known_spells["Animate Skeleton"] and (spells.fail("Animate Skeleton") < 20) and (mp>1)
: local you_know_animate_dead = known_spells["Animate Dead"] and (spells.fail("Animate Dead") < 20) and (mp>4)
:
:
: if should_rest then
: crawl.mpr("should rest.")
: if can_cast_regen then
: crawl.mpr("Autocasting Regen.")
: sendkeys('zr')
: end
: sendkeys('5')
: end
:
: if ( on_corpses() and (you_know_sublimation or you_know_animate_skeleton or you_know_animate_dead) ) then
: crawl.mpr("Autocasting zu")
: sendkeys('zu')
: sendkeys('*e')
: if (string.find(crawl.messages(10), escape("You travel at normal speed"))) then
: sendkeys('*e')
: end
: end
: sendkeys('o')
:
: end
<
--function not_full(hp, mp, max_hp, max_mp)
-- return ((hp < max_hp) or (mp < max_mp))
--end
function not_full(hp, mp, max_hp, max_mp)
local you_are_mummy = string.find(you.race(), "Mummy")
local you_are_deep_dwarf = string.find(you.race(), "Deep Dwarf")
return ( you.slowed()
or you.poisoned()
or you.confused()
or you.exhausted()
or ((hp < max_hp) or (mp < max_mp)) )
end
function on_corpses()
local fl = you.floor_items()
for it in iter.invent_iterator:new(fl) do
if (string.find(it.name(), "corpse") or string.find(it.name(), "skeleton")) then
--and not string.find(it.name(), "rotting")
--and not string.find(it.name(), "plague") then
return true
end
end
return false
end
function floor_items()
return iter.invent_iterator:new(you.floor_items())
end
function sendkeys(command)
crawl.flush_input()
crawl.sendkeys(command)
-- coroutine.yield(true)
crawl.flush_input()
end
--Escapes the special characters in a string for pattern matching
function escape(str)
--Escapes parens and dash "()-"
local escaped = str:gsub('[%(%)%-]','%\%1')
--Removes any coloration parts of the string
return (escaped:gsub('<[^<]*>',''))
end
local function init_spells()
local spell_list = {}
for _, spell_name in ipairs(you.spells()) do
spell_list[spell_name] = true
end
return spell_list
end
known_spells = init_spells()
>
#########################
# Good Beginner Options #
#########################
default_manual_training = true
autofight_stop = 50
show_more = false
#################
# Lua Functions #
#################
-----------------------------------------------------------------------------------
-- Armour/Weapon autopickup by rwbarton, enhanced by HDA with fixes from Bloaxor --
-----------------------------------------------------------------------------------
{
add_autopickup_func(function(it, name)
if name:find("throwing net") then return true end
local class = it.class(true)
local armour_slots = {cloak="Cloak", helmet="Helmet", gloves="Gloves", boots="Boots", body="Armour", shield="Shield"}
if (class == "armour") then
if it.is_useless then return false end
sub_type = it.subtype()
equipped_item = items.equipped_at(armour_slots[sub_type])
if (sub_type == "cloak") or (sub_type == "helmet") or (sub_type == "gloves") or (sub_type == "boots") then
if not equipped_item then
return true
else
return it.artefact or it.branded or it.ego
end
end
if (sub_type == "body") then
if equipped_item then
local armourname = equipped_item.name()
if equipped_item.artefact or equipped_item.branded or equipped_item.ego or (equipped_item.plus > 2) or armourname:find("dragon") or armourname:find("troll") then
return it.artefact
else
return it.artefact or it.branded or it.ego
end
end
return true
end
if (sub_type == "shield") then
if equipped_item then
return it.artefact or it.branded or it.ego
end
end
end
end)
}
-------------------------
-- Dynamic Force Mores --
-------------------------
{
last_turn = you.turns()
fm_patterns = {
{name = "XL5", cond = "xl", cutoff = 5, pattern = "adder|gnoll"},
-- {name = "XL8", cond = "xl", cutoff = 8, pattern = "ogre|centaur|orc wizard|scorpion|worker ant"},
-- {name = "XL15", cond = "xl", cutoff = 15, pattern = "two-headed ogre|centaur warrior|orc (warlord|knight)"},
-- {name = "50mhp", cond = "maxhp", cutoff = 50, pattern = "orc priest|electric eel"},
-- {name = "60mhp", cond = "maxhp", cutoff = 60, pattern = "acid dragon|steam dragon|manticore"},
-- {name = "70mhp", cond = "maxhp", cutoff = 70, pattern = "meliai"}
} -- end fm_patterns
active_fm = {}
-- Set to true to get a message when the fm change
notify_fm = false
function init_force_mores()
for i,v in ipairs(fm_patterns) do
active_fm[#active_fm + 1] = false
end
end
function update_force_mores()
local activated = {}
local deactivated = {}
local hp, maxhp = you.hp()
for i,v in ipairs(fm_patterns) do
local msg = "(" .. v.pattern .. ").*into view"
local action = nil
local fm_name = v.pattern
if v.name then
fm_name = v.name
end
if not v.cond and not active_fm[i] then
action = "+"
elseif v.cond == "xl" then
if active_fm[i] and you.xl() >= v.cutoff then
action = "-"
elseif not active_fm[i] and you.xl() < v.cutoff then
action = "+"
end
elseif v.cond == "rf" then
if active_fm[i] and you.res_fire() >= v.cutoff then
action = "-"
elseif not active_fm[i] and you.res_fire() < v.cutoff then
action = "+"
end
elseif v.cond == "rc" then
if active_fm[i] and you.res_cold() >= v.cutoff then
action = "-"
elseif not active_fm[i] and you.res_cold() < v.cutoff then
action = "+"
end
elseif v.cond == "relec" then
if active_fm[i] and you.res_shock() >= v.cutoff then
action = "-"
elseif not active_fm[i] and you.res_shock() < v.cutoff then
action = "+"
end
elseif v.cond == "rpois" then
if active_fm[i] and you.res_poison() >= v.cutoff then
action = "-"
elseif not active_fm[i] and you.res_poison() < v.cutoff then
action = "+"
end
elseif v.cond == "rcorr" then
if active_fm[i] and you.res_corr() then
action = "-"
elseif not active_fm[i] and not you.res_corr() then
action = "+"
end
elseif v.cond == "rn" then
if active_fm[i] and you.res_draining() >= v.cutoff then
action = "-"
elseif not active_fm[i] and you.res_draining() < v.cutoff then
action = "+"
end
elseif v.cond == "fly" then
if active_fm[i] and not you.flying() then
action = "-"
elseif not active_fm[i] and you.flying() then
action = "+"
end
elseif v.cond == "mhp" then
if active_fm[i] and maxhp >= v.cutoff then
action = "-"
elseif not active_fm[i] and maxhp < v.cutoff then
action = "+"
end
end
if action == "+" then
activated[#activated + 1] = fm_name
elseif action == "-" then
deactivated[#deactivated + 1] = fm_name
end
if action ~= nil then
local opt = "force_more_message " .. action .. "= " .. msg
crawl.setopt(opt)
active_fm[i] = not active_fm[i]
end
end
if #activated > 0 and notify_fm then
mpr("Activating force_mores: " .. table.concat(activated, ", "))
end
if #deactivated > 0 and notify_fm then
mpr("Deactivating force_mores: " .. table.concat(deactivated, ", "))
end
end
local last_turn = nil
function force_mores()
if last_turn ~= you.turns() then
update_force_mores()
last_turn = you.turns()
end
end
init_force_mores()
}
##################
# Ready Function #
##################
{
local need_skills_opened = true
function ready()
force_mores()
-- Skill menu at game start by rwbarton
if you.turns() == 0 and need_skills_opened then
need_skills_opened = false
crawl.sendkeys("m")
end
end
}
#############
# Interface #
#############
autofight_throw = false
autofight_throw_nomove = false
show_travel_trail = true
travel_delay = -1
rest_delay = -1
auto_sacrifice = true
show_game_time = true
warn_hatches = false
jewellery_prompt = false
equip_unequip = true
allow_self_target = never
confirm_butcher = never
easy_eat_gourmand = true
sort_menus = true : equipped, identified, basename, qualname, charged
hp_warning = 50
auto_hide_spells = true
wall_jump_move = false
##############
# Autopickup #
##############
ae := autopickup_exceptions
# fab
ae += scroll of amnesia
ae += >scroll of holy word
ae ^= wand of paralysis
# ae += >wand of lightning
# ae += >wand of confusion
# ae += >wand of digging
# ae += >wand of disintegration
# ae += >wand of polymorph
# ae += >wand of flame
# ae += >wand of enslavement
ae += ring of stealth
ae += >ring of positive energy
ae += >ring of fire
ae += >ring of ice
ae += >ring of magical power
ae += >ring of strength
ae += >ring of intelligence
ae += >ring of dexterity
ae += >ring of wizardry
ae +=