Page 1 of 1

Autopickup stackable items even when not selected

PostPosted: Sunday, 29th March 2015, 16:07
by PAnacea
Especially when playing a char that relies on few ranged weapons for special situations - say, one that carries curare needles and tomahawks of dispersal only -, it is very annoying that one cannot select which egos should be picked up precisely. However, since there is no more weight limit, situations like this can easily be made less annoying if stackable items are autopicked even when they're not selected as such, but currently in inventory. I already implemented this in Lua for myself, and it's made ranged combat much more comfortable to manage. I'm not sure if it makes sense to extend this to potions and such, but then again, the only drawback is a few lost turns, and those who go for speed records likely use auto-anything functions much less in the first place.

Re: Autopickup stackable items even when not selected

PostPosted: Sunday, 29th March 2015, 17:14
by Siegurt
I'm sure people would like and use a LUA version of this, if you care to post it.

Re: Autopickup stackable items even when not selected

PostPosted: Sunday, 29th March 2015, 17:40
by dpeg
PAnacea: This is a really good idea and should come with the game (i.e. as default)!

Re: Autopickup stackable items even when not selected

PostPosted: Sunday, 29th March 2015, 17:44
by Siegurt
Yes, it's been brought up before, I think the response then was "Yeah, this is a good idea, now someone needs to go do it"

Re: Autopickup stackable items even when not selected

PostPosted: Sunday, 29th March 2015, 17:55
by Kate
This is already built in for potions and scrolls (except it wasn't working, but now it is), extending it to branded ammo sounds good too.

Re: Autopickup stackable items even when not selected

PostPosted: Sunday, 29th March 2015, 18:23
by Berder
I would also like not to pick up items that I've already dropped. That is, if I drop a stack of enchant weapon scrolls, I would like to have it disable enchant weapon scrolls from autopickup without having to do that manually.

Re: Autopickup stackable items even when not selected

PostPosted: Sunday, 29th March 2015, 20:01
by dpeg
Berder: That sounds reasonable, too. I wonder if that should always work, or be an option...

Re: Autopickup stackable items even when not selected

PostPosted: Sunday, 29th March 2015, 20:07
by PAnacea
Siegurt: No problem, not exactly pretty though. It'd be nice if there was a "stackable" flag and a way to get the basename (i. e. "23 needles of confusion" -> "needle of confusion"), that way it could be applied to all of the inventory dynamically. If I ever get into development, extending the CLua is probably where I'll start :P

  Code:
function ready()
      missiles_have = {["bolt"]={},["arrow"]={},["sling bullet"]={},["needle"]={},["stone"]={},["large rock"]={},["throwing net"]={},["tomahawk"]={},["javelin"]={}}
      for it in iter.invent_iterator:new(items.inventory()) do
         if it.class(true) == "missile" then
            missiles_have[it.subtype(true)][tostring(it.ego(true))] = true
         end
      end
end

add_autopickup_func(function(it, name)
      if it.class(true) == "missile" then
         return missiles_have[it.subtype(true)][tostring(it.ego(true))]
      end
end)


You can do a lot of things in the rcfile, I'm just always careful I'm not taxing the server too much... for instance, scanning the inventory in every ready() - is that bad? There aren't any documents that tell you about the constraints. Which is why I'd prefer if something that universally useful would be implemented by someone who knows what they're doing, I keep crashing my webtiles server games and feel bad about it.

Edit: I forgot to mention, ammo may not be set to overriden in the known items dialog for that system to work! (White text.) In that case, the autopickup function is never called, it's just true or false depending on settings for all items of a subtype.

Edit2: Also, there's currently a bug where the game returns it.ego() = nil for some ammo. It's already been fixed in git and should be rolled out soon, until then the script things those are unbranded arrows.

Re: Autopickup stackable items even when not selected

PostPosted: Sunday, 29th March 2015, 21:40
by jejorda2
A few times i've ended up with too many items at the end of a portal vault and wished I had left, say, 200 plain arrows outside while keeping 200 in my inventory, so I can drop the ones in my inventory to carry something important out (like cure mutation.) Sometimes having all of something in my inventory is not the best.

I can usually think through this before entering a portal, but sometimes there is pressure to enter quickly.