Modify this script to take restrictions into account?


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

Mines Malingerer

Posts: 36

Joined: Monday, 31st October 2011, 01:38

Post Sunday, 15th May 2016, 23:28

Modify this script to take restrictions into account?

I've got this really useful script that I found somewhere a while back, sitting in my init.txt. It's designed to make you autopickup certain types of armour if you aren't wearing any of its type already:

  Code:
{
add_autopickup_func(function(it, name)
  if it.class(true) == "armour" then
    local good_slots = {cloak="Cloak", helmet="Helmet", gloves="Gloves",
                        boots="Boots"}
    st, _ = it.subtype()
    if good_slots[st] ~= nil and items.equipped_at(good_slots[st]) == nil then
      return true
    end
  end
end)
}


Problem is, it isn't 'smart' enough to exclude armour types that my current character can't wear due to a restriction, most commonly due to race (e.g. can't wear helmets as a Minotaur). Is it possible for this script to be tweaked to take these into account, based at least on the PC's race, or even better, based on (somehow) being able to know what restrictions are currently in place dynamically (maybe from a mutation), to make it more robust?

For this message the author ClefAria has received thanks:
chequers
User avatar

Halls Hopper

Posts: 89

Joined: Monday, 11th April 2016, 21:48

Post Monday, 16th May 2016, 01:19

Re: Modify this script to take restrictions into account?

There's a very serious autopickup routine here, it might give you ideas or be usable wholecloth.

https://github.com/mattias/DCSSConfigFi ... d.rc#L4923

I recommend using UC 2 at the end though, not 3.
remove handsome distillation

For this message the author pumpyscump has received thanks:
andreas

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 27 guests

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