Jump to content

  • Curse Sites
Help

2 Script Questions


  • Please log in to reply
6 replies to this topic

#1 laukond

laukond
  • Members
  • Undeadclass_name
  • EU-Tarren Mill
  • Misery
  • Posts: 11
  • Talents: ./././././.
  • RBG: 1971

Posted 18 November 2012 - 12:21 AM

// 1

I currently use this to hide the various glows on the PlayerFrame:

function PlayerFrame_UpdateStatus()
	
PlayerRestGlow:SetAlpha(0)
PlayerAttackGlow:SetAlpha(0)
PlayerStatusGlow:SetAlpha(0)

end

It works fine when I log in, but stops working after a /reload.
How do I make it work all the time?


// 2

I use this code to hide my tracking button on the minimap and make it available through right-clicking the minimap:

MiniMapTracking:Hide()
local function OnMouseDown(RightButton)
ToggleDropDownMenu(1,nil,MiniMapTrackingDropDown,"cursor")
end
if Minimap:GetScript("OnMouseDown") then
Minimap:HookScript("OnMouseDown",OnMouseDown)
else
Minimap:SetScript("OnMouseDown",OnMouseDown)
end

end

The only problem is that I ping the minimap everytime I right-click it as well.
How do I disable the right-click ping?

#2 Thaya

Thaya
  • Moderators
  • Posts: 2302
  • LocationRussia

Posted 18 November 2012 - 02:21 AM

1. Try to simply remove the function wrapper, just leave the 3 lines in the middle there. I don't think the alphas of those things are changed anywhere else so this will effectively keep them hidden.

If it doesn't work, try making a secure hook:
hooksecurefunc("PlayerFrame_UpdateStatus", function()
	PlayerRestGlow:SetAlpha(0)
	PlayerAttackGlow:SetAlpha(0)
	PlayerStatusGlow:SetAlpha(0)
)

Edited by Thaya, 18 November 2012 - 02:23 AM.

Default UI Scripts - Compilation & how-to

#3 laukond

laukond
  • Members
  • Undeadclass_name
  • EU-Tarren Mill
  • Misery
  • Posts: 11
  • Talents: ./././././.
  • RBG: 1971

Posted 18 November 2012 - 12:44 PM

Hi Thaya, thank you for the reply.

When removing the function line it did not work.
When I copy/pasted the hooksecurefunc you made, it gave me "unexpected symbol near )" in the last line.
I tried ending it with end), that gave no error, but it does not work. :-(

#4 ledoter

ledoter
  • Members
  • Orcclass_name
  • EU-Свежеватель Душ
  • Шквал
  • Posts: 7
  • Talents: Arms

Posted 18 November 2012 - 01:43 PM

hooksecurefunc("PlayerFrame_UpdateStatus", function()
if IsResting("player") then
PlayerStatusTexture:Hide()
PlayerRestIcon:Hide()
PlayerRestGlow:Hide()
PlayerStatusGlow:Hide()
elseif PlayerFrame.inCombat then
PlayerStatusTexture:Hide()
PlayerAttackIcon:Hide()
PlayerRestIcon:Hide()
PlayerAttackGlow:Hide()
PlayerRestGlow:Hide()
PlayerStatusGlow:Hide()
PlayerAttackBackground:Hide() end end)


#5 laukond

laukond
  • Members
  • Undeadclass_name
  • EU-Tarren Mill
  • Misery
  • Posts: 11
  • Talents: ./././././.
  • RBG: 1971

Posted 18 November 2012 - 02:11 PM

That worked Ledoter! Thanks!
I changed the PlayerRestIcon:Hide() to PlayerRestIcon:Show() though :-)

#6 Prozaak

Prozaak
  • Members
  • Posts: 19

Posted 20 November 2012 - 06:00 AM

For the minimap:
Minimap:SetScript("OnMouseUp", function(_, btn)
	if btn=="RightButton" then
		ToggleDropDownMenu(1, nil, MiniMapTrackingDropDown, "cursor", 0, 0)
else
  local x, y = GetCursorPosition()
  x = x / Minimap:GetEffectiveScale()
  y = y / Minimap:GetEffectiveScale()
  local cx, cy = Minimap:GetCenter()
  x = x - cx
  y = y - cy
  if ( sqrt(x * x + y * y) < (Minimap:GetWidth() / 2) ) then
   Minimap:PingLocation(x, y)
  end
  Minimap_SetPing(x, y, 1)
end
end)


#7 laukond

laukond
  • Members
  • Undeadclass_name
  • EU-Tarren Mill
  • Misery
  • Posts: 11
  • Talents: ./././././.
  • RBG: 1971

Posted 20 November 2012 - 10:00 AM

Works like a charm Prozaak, thank you very much! :-)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

<