Page 1 of 1

spell-dependent conditionals in config

PostPosted: Monday, 25th June 2012, 06:42
by rchandra
Is there a way to see in the config file which spells you have with something like 'if "animate skeleton" in you.spells()'? I thought I saw MarvinPA post an rcfile with such but couldn't find it.

And is the "you" object fully comprehensible from somewhere in the code, or would one have to read through a lot of files?

Re: spell-dependent conditionals in config

PostPosted: Monday, 25th June 2012, 07:57
by CommanderC
rchandra wrote:Is there a way to see in the config file which spells you have with something like 'if "animate skeleton" in you.spells()'? I thought I saw MarvinPA post an rcfile with such but couldn't find it.


I think this lua function does what you want:
  Code:
local function has_spell(spell)
  for i,j in pairs(you.spells()) do
    if j == spell then return true end
  end
  return false
end


rchandra wrote:And is the "you" object fully comprehensible from somewhere in the code, or would one have to read through a lot of files?

The array you_clib in l_you.cc.

Re: spell-dependent conditionals in config

PostPosted: Tuesday, 26th June 2012, 01:43
by rchandra
works perfectly, thanks!

If anybody else needs this, don't forget to prefix the lua lines with colons if you're putting it in autopickup_exceptions or such.