<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>What&amp;#039;s the point of attributes_unset_(1|2|3)?</title>
        <description> From what I can tell, attributes_unset_(1|2|3) is always nil. What is this field for?</description>
        <link>/forum/read.php?4,71022,71022#msg-71022</link>
        <lastBuildDate>Mon, 14 Sep 2026 23:54:40 +0000</lastBuildDate>
        <generator>Phorum 5.2.23</generator>
        <item>
            <guid>/forum/read.php?4,71022,72275#msg-72275</guid>
            <title>Re: What&#039;s the point of attributes_unset_(1|2|3)?</title>
            <link>/forum/read.php?4,71022,72275#msg-72275</link>
            <description><![CDATA[ Thank you both for your replies!<br />
<br />
The small sample of my finds that I looked at must not have had any negative attributes, since the field(s) were all zero. Clearly that was inadequate -- however, on closer inspection, I see how the fields are used.<br />
<br />
(Inspired by bmuzzin&#039;s latest series, I just set up <a href="https://project-gc.com/Challenges//76415"  rel="nofollow">https://project-gc.com/Challenges//76415</a> for fun.)]]></description>
            <dc:creator>Hügh</dc:creator>
            <category>Script development</category>
            <pubDate>Tue, 04 Apr 2023 19:15:59 +0000</pubDate>
        </item>
        <item>
            <guid>/forum/read.php?4,71022,72273#msg-72273</guid>
            <title>Re: What&#039;s the point of attributes_unset_(1|2|3)?</title>
            <link>/forum/read.php?4,71022,72273#msg-72273</link>
            <description><![CDATA[ When you&#039;re calling &#039;GetFinds&#039;, you need to include &#039;attributes_unset&#039; in the fields (along with &#039;attributes_set&#039;). <br />
<br />
I have a set of C+P functions that I use frequently - here&#039;s the one I use for attributes, if it&#039;s helpful.<br />
<br />
---------------------------------------------------------------------------------------<br />
-- Attributes<br />
---------------------------------------------------------------------------------------<br />
<br />
-- Given a bit index, get the value if that bit was set to 1<br />
-- e.g.  given 4, set the fourth bit from the right to 1.  Result:  8<br />
function bit(p)<br />
    return 2 ^ (p - 1)  -- 1-based indexing<br />
end<br />
<br />
-- Given a bitfield and bitmask, AND the two to determine if the bitmask is set in this field.<br />
function hasbit(x, p)<br />
    return x % (p + p) &gt;= p<br />
end<br />
<br />
function rshift(x, by)<br />
    return math.floor(x / 2 ^by )<br />
end<br />
<br />
function find_has_attribute(find, attribute)        <br />
    local setindex = rshift((attribute-1) % 96, 5)+1<br />
    local bitindex = ((attribute-1) % 32)+1<br />
    local attributeset = (attribute &lt;= 96 and &quot;attributes_set_&quot; or &quot;attributes_unset_&quot;) .. setindex<br />
    local cmp = (value or true)<br />
    return cmp == hasbit(find[attributeset], bit(bitindex))<br />
end]]></description>
            <dc:creator>bmuzzin</dc:creator>
            <category>Script development</category>
            <pubDate>Tue, 04 Apr 2023 17:43:14 +0000</pubDate>
        </item>
        <item>
            <guid>/forum/read.php?4,71022,71279#msg-71279</guid>
            <title>Re: What&#039;s the point of attributes_unset_(1|2|3)?</title>
            <link>/forum/read.php?4,71022,71279#msg-71279</link>
            <description><![CDATA[ I believe those fields are for the negative attributes. It&#039;s in the same format as the positive attributes (attributes_set_[1/2/3]), being an integer where each bit corresponds to one of the attributes.]]></description>
            <dc:creator>sumbloke</dc:creator>
            <category>Script development</category>
            <pubDate>Thu, 02 Mar 2023 01:50:29 +0000</pubDate>
        </item>
        <item>
            <guid>/forum/read.php?4,71022,71022#msg-71022</guid>
            <title>What&#039;s the point of attributes_unset_(1|2|3)?</title>
            <link>/forum/read.php?4,71022,71022#msg-71022</link>
            <description><![CDATA[ From what I can tell, attributes_unset_(1|2|3) is always nil. What is this field for?]]></description>
            <dc:creator>Hügh</dc:creator>
            <category>Script development</category>
            <pubDate>Mon, 20 Feb 2023 23:17:10 +0000</pubDate>
        </item>
    </channel>
</rss>
