Function ready no longer works?

I have this bit of code but it is not working. I am able to run the function troll_fighter_set_skills directly from the console but not from the ready function.

Does the ready function no longer work?

{

function troll_fighter_set_skills()
	if you.race() == "Troll" and you.class() == "Fighter" then
		you.train_skill("Unarmed Combat", 2)
		you.set_training_target("Dodging",9.9)
		you.set_training_target("Fighting",19.9)
		you.set_training_target("Shields",16.6)
		you.set_training_target("Shapeshifting",23.3)
		-- you.set_training_target("Unarmed Combat",15)
	end
end

function ready()
    if you.turns() == 0 then
        troll_fighter_set_skills()
    end
end
}

I paste this into a blank rc file on cao trunk and it worked fine on a new TrFi; could you give more information about the circumstances under which you’re trying this, and maybe a link to your full rc if it’s online?

1 Thank

This is rad. I always wanted to do something like this. Just having a default of all 0s would be amazing.

Here is the pastebin: DCSS rc with ready - Pastebin.com

I don’t understand why this is conflicting with the code I took from Berder. I tried to see if I had two ready functions but there doesn’t seem to be.

I’m splatting Troll Fighters left and right. Always setting the same targets for skills. I wanted something to take the load off. And I do know it works.

Yeah, I tend to get stuck in a rut for a few hours splatting things. It becomes a chore to just keep on adding the skill targets. I tend to plan out the first 10 lvls and then adapt to what I get after that. So I bet my RC file is just going to be littered with things like this eventually. Along with a default of all 0s so I don’t have to 0 out skill I don’t want that are defaulted.

I think the culprit is probably the includes that are towards the end (long after your own ready()). At least looking on CAO, HDamage.rc appears to supply a ready() itself. Haven’t checked the others.

How do I add my ready after the one in HDamage? I tried something like this:

include += HDamage.rc
include += HDAtravel.rc
include += HDAForceMore.rc

{

function troll_fighter_set_skills()
	if you.race() == "Troll" and you.class() == "Fighter" then
		you.train_skill("Unarmed Combat", 2)
		you.set_training_target("Dodging",9.9)
		you.set_training_target("Fighting",19.9)
		you.set_training_target("Shields",16.6)
		you.set_training_target("Shapeshifting",23.3)
		-- you.set_training_target("Unarmed Combat",15)
	end
end

function ready()
	crawl.mpr("OLA")
    if you.turns() == 0 then
        troll_fighter_set_skills()
    end
   AnnounceDamage()
end
}

But it didn’t work as expected (ready defined in HDamage continues to be called.

Still not sure what’s going on, but I did paste this fragment all by itself on a trunk account on CAO and it seems to work as expected. If you have more things in your rc, perhaps start with just this fragment and keep adding until it breaks?

I realized that it must have to do with the way includes are added.

Anyway, if someone wants to use this, here it is:

<
function untrain_all_skills()
	skill_list = {"Fighting","Short Blades","Long Blades","Axes","Maces & Flails",
                "Polearms","Staves","Unarmed Combat",
                "Throwing","Slings","Armour","Dodging","Shields","Spellcasting",
                "Conjurations","Hexes","Charms","Summonings","Necromancy",
                "Translocations","Transmutations","Fire Magic","Ice Magic",
                "Air Magic","Earth Magic","Alchemy","Invocations",
                "Evocations","Stealth"}
	for i, sk in ipairs(skill_list) do
		you.train_skill(sk, 0)
	end
end

function troll_fighter_set_skills()
	if you.race() == "Troll" and you.class() == "Fighter" then
		you.train_skill("Unarmed Combat", 2)
		you.set_training_target("Dodging",9.9)
		you.set_training_target("Fighting",19.9)
		you.set_training_target("Shields",16.6)
		you.set_training_target("Shapeshifting",23.3)
	end
end

function djinni_set_skills()
	if you.race() == "Djinni" then
		untrain_all_skills()
		you.train_skill("Spellcasting", 2)
		you.train_skill("Fighting", 2)
	end
end

function ready()
    if you.turns() == 0 then
        troll_fighter_set_skills()
		djinni_set_skills()
    end
   AnnounceDamage()
end
>

AnnounceDamage is because I'm also using HDamage. What I'm doing locally is to include my file after including HDamage
1 Thank