Seting up starting skills by default


If it doesn't fit anywhere else, it belongs here. Also, come here if you just need to get hammered.

Spider Stomper

Posts: 216

Joined: Saturday, 25th March 2017, 16:51

Post Saturday, 22nd April 2017, 09:04

Seting up starting skills by default

I am a very bad player. Thus, I die a lot due to stupid decisions, rash judgement or simply lack of patience, especially, in the first 10 XL levels or so. Thus, I tend to start many chars. 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?
User avatar

Crypt Cleanser

Posts: 732

Joined: Monday, 24th April 2017, 11:46

Post Monday, 24th April 2017, 13:22

Re: Seting up starting skills by default

I guess this amount of tedium you have to go through each time is one of the punishments for getting yourself killed...
Maɟaŋ

Slime Squisher

Posts: 368

Joined: Thursday, 11th April 2013, 21:07

Post Monday, 24th April 2017, 14:25

Re: Seting up starting skills by default

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.

For this message the author Implojin has received thanks: 3
stoneychips, TeshiAlair, Zhorgal

Return to Crazy Yiuf's Corner

Who is online

Users browsing this forum: No registered users and 163 guests

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