--- lib/core/auto.lua.orig 2004-02-24 16:42:10.000000000 -0500 +++ lib/core/auto.lua 2004-05-05 19:16:18.000000000 -0400 @@ -196,6 +196,38 @@ f = gen_rule_fct(r[1]) end return function(object) return not %f(object) end + elseif r.label == "inventory" then + local f + if not r[1] then + f = function(object) return end + else + f = gen_rule_fct(r[1]) + end + return function(object) + local i = 0 + while i < INVEN_WIELD do + if %f(player.inventory(i)) then + return TRUE + end + i = i + 1 + end + end + elseif r.label == "equipment" then + local f + if not r[1] then + f = function(object) return end + else + f = gen_rule_fct(r[1]) + end + return function(object) + local i = INVEN_WIELD + while i < INVEN_TOTAL do + if %f(player.inventory(i)) then + return TRUE + end + i = i + 1 + end + end elseif r.label == "name" then return function(object) if strlower(object_desc(object, -1, 0)) == strlower(%r[1]) then return TRUE end end elseif r.label == "contain" then @@ -737,6 +769,28 @@ return xml:collect(""..n.."") end, }, + ["inventory"] = + { + { + "Check is true if something in player's inventory matches", + "the contained rule", + }, + xml:collect([[...]]), + function () + return xml:collect("") + end, + }, + ["equipment"] = + { + { + "Check is true if something in player's equipment matches", + "the contained rule", + }, + xml:collect([[...]]), + function () + return xml:collect("") + end, + }, } function auto_aux:display_desc(sel) --- lib/core/xml.lua.orig 2004-02-24 16:42:10.000000000 -0500 +++ lib/core/xml.lua 2004-05-05 21:16:22.000000000 -0400 @@ -173,6 +173,34 @@ nextlevel = tab end children_not_flag = not nil + elseif t.label == "inventory" then + if not_flag then + xml.write(TERM_WHITE, tab) + xml.write(ecol, "Nothing in your ") + xml.write(bcol, "inventory") + xml.write(ecol, " matches the following:") + xml.write(TERM_WHITE, "\n") + else + xml.write(TERM_WHITE, tab) + xml.write(ecol, "Something in your ") + xml.write(bcol, "inventory") + xml.write(ecol, " matches the following:") + xml.write(TERM_WHITE, "\n") + end + elseif t.label == "equipment" then + if not_flag then + xml.write(TERM_WHITE, tab) + xml.write(ecol, "Nothing in your ") + xml.write(bcol, "equipment") + xml.write(ecol, " matches the following:") + xml.write(TERM_WHITE, "\n") + else + xml.write(TERM_WHITE, tab) + xml.write(ecol, "Something in your ") + xml.write(bcol, "equipment") + xml.write(ecol, " matches the following:") + xml.write(TERM_WHITE, "\n") + end elseif t.label == "comment" then xml.write(TERM_WHITE, tab) xml.write(TERM_WHITE, "(" .. t[1] .. ")") --- src/squeltch.c.orig 2004-02-24 16:42:15.000000000 -0500 +++ src/squeltch.c 2004-05-05 18:58:35.000000000 -0400 @@ -155,6 +155,8 @@ "level", "skill", "ability", + "inventory", + "equipment", "comment", NULL, };