item identification macro


Ask fellow adventurers how to stay alive in the deep, dark, dangerous dungeon below, or share your own accumulated wisdom.

User avatar

Tomb Titivator

Posts: 857

Joined: Monday, 31st January 2011, 23:19

Post Thursday, 21st January 2021, 02:26

item identification macro

I wrote a macro to read unidentified scrolls and identify unidentified potions with scroll of identify using the "c" key. Any suggestions on improving the macro are welcome! :)

  Code:
############################################################################
# item identification                                                      #
############################################################################

macros += M c ===identify

:function inventory()
:  return iter.invent_iterator:new(items.inventory())
:end

:function scroll_of_identify_letter()
:  for item in inventory() do
:    if item.class(true) == "scroll" and item.subtype() == "identify" then
:      return items.index_to_letter(item.slot)
:    end
:  end
:end

:function identify()
:  local id_letter = scroll_of_identify_letter()
:  for item in inventory() do
:    if item.class(true) == "scroll" and not item.fully_identified then
:      crawl.sendkeys("r" .. items.index_to_letter(item.slot))
:      return
:    end
:    if item.class(true) == "potion" and not item.fully_identified and id_letter then
:      crawl.sendkeys("r" .. id_letter .. items.index_to_letter(item.slot))
:      return
:    end
:  end
:  crawl.mpr("Unable to identify any scrolls or potions.")
:end

Tomb Titivator

Posts: 808

Joined: Sunday, 23rd June 2013, 15:20

Post Thursday, 21st January 2021, 09:54

Re: item identification macro

Pretty nice. My way to do it is map ?IDs to r so I can spam rr[x] quickly. Next step would be to have it make smart decisions? I never want to randomly ID items. "start with potions, stack size 2-3, never do stack size 5+, if known scrolls are amnesia, uselessness, noise, immolation, fear, teleport but not blink prioritize scrolls"

Slime Squisher

Posts: 368

Joined: Thursday, 11th April 2013, 21:07

Post Saturday, 23rd January 2021, 04:56

Re: item identification macro

It's nice to see your bot is underway~ :)

Some potential improvements:

* An item.quantity check inside the scroll-id bit, to identify the largest available stack
* A check to scroll-id unidentified amulets, since you don't want to wear-id amulets
* A check to scroll-id unidentified scrolls, instead of always read-id'ing them (Presumably you'd want some logic based off of the item.quantity of your ?id stack vs. the target stack?)
* A check to wear-id unidentified rings, when feeling safe? (You'd probably want some logic called from ready() here to either re-equip your previous ring set afterwards, or to auto-equip the best available ring set)
* A check to wear-id unidentified randarts, when feeling safe at the end of a cleared floor?
User avatar

Tomb Titivator

Posts: 857

Joined: Monday, 31st January 2011, 23:19

Post Saturday, 23rd January 2021, 07:53

Re: item identification macro

This is actually cut from a more elaborate bot I'm writing. I'll keep the suggestions in mind and try to improve this when I have time. Thanks! :)

If you're curious, I have the rc file here:

https://github.com/RDiGregorio/crawl

It's still super basic and has a few bugs.

Return to Dungeon Crawling Advice

Who is online

Users browsing this forum: No registered users and 19 guests

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