Zhorgal wrote:Is there a way to automatically setup my skills so I don't have to tell the game I only want to train my weapon skill every time I start a new char?
You can do this by placing custom Lua within your rcfile/init.txt. If a ready() function exists within the rcfile, DCSS will execute it at the beginning of every turn. You can use this hook to conditionally automate your gameplay.
Here is one quickly modified example, with code taken from elliptic's automated DCSS bot,
crawl-ref/source/test/stress/qw.rc, then stripped down for clarity:
(Copy/paste the below code into your rcfile)
- Code:
default_manual_training = true
{
function choose_single_skill(sk)
you.train_skill(sk, 1)
skill_list = {"Fighting","Short Blades","Long Blades","Axes","Maces & Flails",
"Polearms","Staves","Unarmed Combat","Bows","Crossbows",
"Throwing","Slings","Armour","Dodging","Shields","Spellcasting",
"Conjurations","Hexes","Charms","Summonings","Necromancy",
"Translocations","Transmutations","Fire Magic","Ice Magic",
"Air Magic","Earth Magic","Poison Magic","Invocations",
"Evocations","Stealth"}
for i,sk2 in ipairs(skill_list) do
if sk ~= sk2 then
you.train_skill(sk2, 0)
end
end
end
function wskill()
weap = items.equipped_at("Weapon")
if weap then
return weap.weap_skill
else
return "Unarmed Combat"
end
end
function ready()
if you.turns() == 0 then
choose_single_skill(wskill())
end
end
}
My example code here is intentionally not handling corner cases, nor automating as much as qw.rc does. If you want to use more robust automation (with things like persistent options and automatic weapon selection based on race) you can copy the necessary bits straight from qw.
Stone Soup's Lua is poorly documented, but if you are interested in further reading you can grep the l-whatever.cc files in crawl-ref/source to see which functions are exposed for players to call from within the game's Lua interpreter. crawl_clib[] in l-crawl.cc contains many of the essential automation functions, and is a good place to start.