Thread Tools Display Modes
08-22-20, 09:39 PM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
[BETA] Actionbar Range Help

I have been trying for serveral hours now and cannot seem to get this code to work .
Code:
local function UpdateRange( self, elapsed )
	local rangeTimer = self.rangeTimer
	local icon = self.icon;

	if( rangeTimer == TOOLTIP_UPDATE_TIME ) then
		local inRange = IsActionInRange( self.action );
		if( inRange == false ) then
			-- Red Out Button
			icon:SetVertexColor( 1, 0, 0 );
		else
			local canUse, amountMana = IsUsableAction( self.action );
			if( canUse ) then
				icon:SetVertexColor( 1.0, 1.0, 1.0 );
			elseif( amountMana ) then
				icon:SetVertexColor( 0.5, 0.5, 1.0 );
			else
				icon:SetVertexColor( 0.4, 0.4, 0.4 );
			end
		end
	end
end

do
	hooksecurefunc( "ActionButton_OnUpdate", UpdateRange );
end
Ive tried changing the *ActionButton_OnUpdate* to hooksecurefunc(ActionBarActionButtonMixin, "OnUpdate, UpdateRange) and it dont work.

The only way i got something to happen was by modifying this code:
Code:
function ActionButton_UpdateRangeIndicator(self, checksRange, inRange)
	if ( self.HotKey:GetText() == RANGE_INDICATOR ) then
		if ( checksRange ) then
			self.HotKey:Show();
			if ( inRange ) then
				self.HotKey:SetVertexColor(LIGHTGRAY_FONT_COLOR:GetRGB());
			else
				self.HotKey:SetVertexColor(RED_FONT_COLOR:GetRGB());
			end
		else
			self.HotKey:Hide();
		end
	else
		if ( checksRange and not inRange ) then
			self.HotKey:SetVertexColor(RED_FONT_COLOR:GetRGB());
		else
			self.HotKey:SetVertexColor(LIGHTGRAY_FONT_COLOR:GetRGB());
		end
	end
end
and changing it to
Code:
function ActionButton_UpdateRangeIndicator(self, checksRange, inRange)
	if ( self.HotKey:GetText() == RANGE_INDICATOR ) then
		if ( checksRange ) then
			self.icon:Show();
			if ( inRange ) then
				self.icon:SetVertexColor(LIGHTGRAY_FONT_COLOR:GetRGB());
			else
				self.icon:SetVertexColor(RED_FONT_COLOR:GetRGB());
			end
		end
	else
		if ( checksRange and not inRange ) then
			self.icon:SetVertexColor(RED_FONT_COLOR:GetRGB());
		else
			self.icon:SetVertexColor(LIGHTGRAY_FONT_COLOR:GetRGB());
		end
	end
end
and then all the icon are light grey and look wierd.

If anyone could help with this that would be great if not i guess Ill keep trying till i hopefully get the right combo.

Thanks Coke
  Reply With Quote
08-23-20, 12:27 AM   #2
siweia
A Flamescale Wyrmkin
 
siweia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 126
You may have a look at Tukui.
https://git.tukui.org/Tukz/Tukui/-/c...55e180744636cb
  Reply With Quote
08-23-20, 07:21 AM   #3
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by siweia View Post
Thank you, this help me out alot.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » [BETA] Actionbar Range Help

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off