Tomb Titivator
Posts: 857
Joined: Monday, 31st January 2011, 23:19
item identification macro
- 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