spell-dependent conditionals in config


Problems running or configuring the software, commands & options, compiling, different platforms, using the interface, documentation, etc.

User avatar

Vestibule Violator

Posts: 1509

Joined: Wednesday, 21st September 2011, 01:10

Location: St. John's, NL, Canada

Post Monday, 25th June 2012, 06:42

spell-dependent conditionals in config

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?
Won all race/bg, unwon (online): Nem* Hep Uka
Favourites: 15-rune Trog, OgNe/OgIE/OgSu (usually Ash), Ds, Ru, SpEn, Ce of Chei, Qaz

Spider Stomper

Posts: 243

Joined: Sunday, 28th August 2011, 14:04

Post Monday, 25th June 2012, 07:57

Re: spell-dependent conditionals in config

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.

For this message the author CommanderC has received thanks:
rchandra
User avatar

Vestibule Violator

Posts: 1509

Joined: Wednesday, 21st September 2011, 01:10

Location: St. John's, NL, Canada

Post Tuesday, 26th June 2012, 01:43

Re: spell-dependent conditionals in config

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.
Won all race/bg, unwon (online): Nem* Hep Uka
Favourites: 15-rune Trog, OgNe/OgIE/OgSu (usually Ash), Ds, Ru, SpEn, Ce of Chei, Qaz

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 7 guests

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