<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3ACanUseDyeItem</id>
	<title>API:CanUseDyeItem - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3ACanUseDyeItem"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:CanUseDyeItem&amp;action=history"/>
	<updated>2026-10-18T04:54:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:CanUseDyeItem&amp;diff=30210&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:CanUseDyeItem&amp;diff=30210&amp;oldid=prev"/>
		<updated>2026-10-16T19:40:59Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=Dye}}&lt;br /&gt;
Returns whether the player&amp;#039;s rank is high enough to use an item, such as a dye.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
canUse = CanUseDyeItem(location, slot)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;location : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – Where the item is, as a &amp;lt;code&amp;gt;GameData.ItemLocs&amp;lt;/code&amp;gt; value.&lt;br /&gt;
;slot : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – Slot of the item in &amp;lt;code&amp;gt;location&amp;lt;/code&amp;gt;, starting at 1.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;canUse : &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; – &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if the player&amp;#039;s rank is at least the item&amp;#039;s required level.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* Only the level requirement is compared. The client does not check that the item is a dye or that the slot holds an item.&lt;br /&gt;
* &amp;lt;code&amp;gt;GameData.ItemLocs.BANK&amp;lt;/code&amp;gt; is not supported by the slot conversion this function uses.&lt;br /&gt;
* If there is no player object, the Lua state is not available or the argument check fails, the function returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The function needs at least two arguments and only reads the last two.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
None besides the generic &amp;#039;&amp;#039;Invalid Parameters&amp;#039;&amp;#039; message when an argument is not a number.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;default/ea_modifyitem/source/useitemtargeting.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function UseItemTargeting.CanUseDyeItem(sourceLocation, dyeSlot)&lt;br /&gt;
    local canUseDye = false&lt;br /&gt;
    -- Check to see if player is able to use the dye Item first&lt;br /&gt;
    canUseDye = CanUseDyeItem(sourceLocation, dyeSlot)&lt;br /&gt;
&lt;br /&gt;
    --Display a one dialog box with text saying &amp;quot;Your rank is too low to use this dye!&amp;quot;&lt;br /&gt;
    --if they can&amp;#039;t use the dye because of their rank&lt;br /&gt;
    if(canUseDye == false) then&lt;br /&gt;
        ...&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:DyePreview|DyePreview]]&lt;br /&gt;
* [[API:GetDyeTintMasks|GetDyeTintMasks]]&lt;br /&gt;
* [[API:SendUseItem|SendUseItem]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>