Jump to content

Photo

Default UI Scripts


  • Please log in to reply
711 replies to this topic

#81 Syncrow

Syncrow
  • Premium
  • Posts: 183

Posted 19 August 2012 - 12:58 AM

Hi guys,
i'm back with another small script, cause i changed my UI so my Chat messes up with my FocusFrame...and so i thought to add a Button to Hide the Chat if not needed!
local f = CreateFrame("Button",nil,UIParent)
f:SetSize(30,30)
f.t=f:CreateTexture(nil,"BORDER")
f.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Minimize-Up.blp")
f.t:SetAllPoints(f)
f:SetPoint("BOTTOM","ChatFrame1ButtonFrame","BOTTOM",0,-35)
f:Show()

local ChatHide = false
--[[although not required, but makes the button more alive
f:SetScript("OnMouseDown", function(self, button)
	if ChatHide  == false then
		if button == "LeftButton" then
			f.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Minimize-Down.blp")
		end
	elseif ChatHide == true then
		if button == "LeftButton" then
			f.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Maximize-Down.blp")
		end
	end
end)

f:SetScript("OnMouseUp", function(self, button)
	if ChatHide  == false then
		if button == "LeftButton" then
			f.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Minimize-Up.blp")
		end
	elseif ChatHide == true then
		if button == "LeftButton" then
			f.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Maximize-Up.blp")
		end
	end
end)
--]]
f:SetScript("OnClick", function(self, button)
	if ChatHide == false then
		f.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Maximize-Up.blp")
		FriendsMicroButton:Hide()
		GeneralDockManager:Hide()
		ChatFrameMenuButton:Hide()
		for i=1, NUM_CHAT_WINDOWS do
			_G["ChatFrame"..i..""]:SetAlpha(0)
			_G["ChatFrame"..i.."ButtonFrame"]:Hide()
		end
		ChatHide = true
	elseif ChatHide == true then
		f.t:SetTexture("Interface\\CHATFRAME\\UI-ChatIcon-Minimize-Up.blp")
		FriendsMicroButton:Show()
		GeneralDockManager:Show()
		ChatFrameMenuButton:Show()
		for i=1, NUM_CHAT_WINDOWS do
			_G["ChatFrame"..i..""]:SetAlpha(1)
			_G["ChatFrame"..i.."ButtonFrame"]:Show()
		end
		ChatHide = false
	end
end)
Posted Image
  • 4

#82 Dzin

Dzin
  • Members
  • Posts: 9

Posted 26 August 2012 - 02:22 PM

Is there a way to move those icons as shown in the screenshot?
Posted Image
  • 0

#83 m0nk

m0nk
  • Members
  • Posts: 304

Posted 26 August 2012 - 08:33 PM

Is there a way to move those icons as shown in the screenshot?
Posted Image


local t=TotemFrame; t:ClearAllPoints(); t:SetPoint("CENTER", UIParent, "CENTER", -300, 105);t:SetScale(1.0)

Type /run before that and mess around with the coords to line it up.
  • 1

Posted Image


#84 Dzin

Dzin
  • Members
  • Posts: 9

Posted 26 August 2012 - 09:00 PM

local t=TotemFrame; t:ClearAllPoints(); t:SetPoint("CENTER", UIParent, "CENTER", -300, 105);t:SetScale(1.0)

Type /run before that and mess around with the coords to line it up.

ty very much, works perfectly.
  • 0

#85 Superlative

Superlative
  • Members
  • Humanclass_name
  • EU-Outland
  • Misery
  • Posts: 51
  • Talents: Shadow 0/2/0/1/2/.
  • RBG: 1894

Posted 26 August 2012 - 10:44 PM

ty very much, works perfectly.

Tips, ("CENTER", PlayerFrame, "CENTER", 0, -100);
  • 0

#86 Djmulletxswe

Djmulletxswe
  • Members
  • Undeadclass_name
  • EU-Stormscale
  • Cyclone / Wirbelsturm
  • Posts: 4
  • Talents: Frost 0/2/0/2/2/2

Posted 31 August 2012 - 05:17 PM

The script that creates an absolute value of hp/mana gave me an error after the patch, dont have it enabled now though and havent saved the lua error.
And the Arena Enemy Frames script with SetPoint works outside of arena but it doesnt move as a stack anymore so you have to add coordinates for ArenaEnemyFrame2/3, but the problem with that is that the coordinates reset inside of arena for some reason. Anyone got a fix for this?
  • 0

#87 XqzN

XqzN
  • Members
  • Undeadclass_name
  • EU-Kazzak
  • Misery
  • Posts: 7
  • Talents:

Posted 31 August 2012 - 05:39 PM

I've been using this code/script:
Seems like it won't update properly anymore, if anyone can help..
local frame = CreateFrame("FRAME")
frame:RegisterEvent("PARTY_MEMBERS_CHANGED")
frame:RegisterEvent("PLAYER_TARGET_CHANGED")
frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
frame:RegisterEvent("UNIT_FACTION")
local function eventHandler(self, event, ...)
	    if UnitIsPlayer("target") then
		  _, class = UnitClass("target")
			    c = RAID_CLASS_COLORS[class]
    TargetFrameNameBackground:SetVertexColor(0,0,0) --c.r, c.g, c.b
    TargetFrameNameBackground:SetAlpha(0.6)
    else
    TargetFrameNameBackground:SetAlpha(1)
   end
	    if UnitIsPlayer("focus") then
		 _, class = UnitClass("focus")
			   c = RAID_CLASS_COLORS[class]
	   FocusFrameNameBackground:SetVertexColor(0,0,0) --c.r, c.g, c.b
    FocusFrameNameBackground:SetAlpha(0.6)
	  else
	   FocusFrameNameBackground:SetAlpha(1)
	    end
end
frame:SetScript("OnEvent", eventHandler)

  • 0

#88 Failsmich

Failsmich
  • Members
  • Humanclass_name
  • US-Moonrunner
  • Shadowburn
  • Posts: 4
  • Talents: Arms

Posted 01 September 2012 - 02:10 AM

Hey guys,

I've been using a few scripts for a while now. I was wondering if anyone has had the issue I'm currently having. Since 5.0.4 hit, my petframe script has been resetting when I open my map, or level, sometimes randomly.

the script that I use is:
/run PetFrame:ClearAllPoints() PetFrame:SetPoint("LEFT",PlayerFrame,"RIGHT",-315, -10)

Is there something I have left out, or something new that needs to be added? Or is this patch that buggy, and will most likely be fixed around MoP is released?

Edit: dat grammar

Edited by Failsmich, 01 September 2012 - 02:11 AM.

  • 0

#89 Djmulletxswe

Djmulletxswe
  • Members
  • Undeadclass_name
  • EU-Stormscale
  • Cyclone / Wirbelsturm
  • Posts: 4
  • Talents: Frost 0/2/0/2/2/2

Posted 01 September 2012 - 12:07 PM

Hey guys,

I've been using a few scripts for a while now. I was wondering if anyone has had the issue I'm currently having. Since 5.0.4 hit, my petframe script has been resetting when I open my map, or level, sometimes randomly.

the script that I use is:

/run PetFrame:ClearAllPoints() PetFrame:SetPoint("LEFT",PlayerFrame,"RIGHT",-315, -10)

Is there something I have left out, or something new that needs to be added? Or is this patch that buggy, and will most likely be fixed around MoP is released?

Edit: dat grammar


I dont run that as a script but I have the same lines in my autoscript and it works fine for me.

PetFrame:ClearAllPoints()
PetFrame:SetPoint("CENTER",PlayerFrame,"CENTER" ,-200,100)
works like a charm
  • 0

#90 Zub

Zub
  • Junkies
  • Undeadclass_name
  • US-Kel'Thuzad
  • Nightfall
  • Posts: 152
  • Talents: Shadow 1/2/0/1/2/1

Posted 01 September 2012 - 05:47 PM

is it possible to flip the shadow orbs bar and move it to the top of the player frame?
  • 0

#91 Failsmich

Failsmich
  • Members
  • Humanclass_name
  • US-Moonrunner
  • Shadowburn
  • Posts: 4
  • Talents: Arms

Posted 01 September 2012 - 09:20 PM

I dont run that as a script but I have the same lines in my autoscript and it works fine for me.

PetFrame:ClearAllPoints()
PetFrame:SetPoint("CENTER",PlayerFrame,"CENTER" ,-200,100)
works like a charm


I don't have any issues with any other class with a petframe(Hunter, Mage, etc.) Only the Warlock. On an 85, or a lowbie. It refuses to go where I want it. I've even did an autorun script. This whole thing is mind boggling.


Edit: I had a friend of mine work the macro on his Warlock, same problem. Opens map, it resets to default.
  • 0

#92 Zeiyo

Zeiyo
  • Junkies
  • Posts: 1,387

Posted 02 September 2012 - 07:37 AM

i moved my arena frames like this http://i.imgur.com/TEeJ4.jpg and i like it, but when i join arena one of the frames randomly goes further to the right of my screen and they dont align any more, anybody know why, or a way to stop it doing that? :S
  • 0

#93 Ancyfex

Ancyfex
  • Premium Junkies
  • Blood Elfclass_name
  • EU-Daggerspine
  • Cataclysme / Cataclysm
  • Posts: 32
  • Talents:

Posted 02 September 2012 - 10:26 AM

I'm having trouble with this script so I can see percent and health numbers on the unit frames since the last patch, is there anyone good with scripts who can fix it?

Would be much appreciated!

TF=CreateFrame("Frame")TFHB=TargetFrameHealthBar.TextString;TTSB=TextStatusBar_CapDisplayOfNumericValue
FF=CreateFrame("Frame")FFHB=FocusFrameHealthBar.TextString;TTSB=TextStatusBar_CapDisplayOfNumericValue
TF:SetScript("OnUpdate", function(target)TFHB:SetText(TTSB(UnitHealth("target")).."/"..TTSB(UnitHealthMax("target")).." ("..format("%.0f", ((UnitHealth("target")/UnitHealthMax("target"))*100)).."%)") end)
FF:SetScript("OnUpdate", function(focus)FFHB:SetText(TTSB(UnitHealth("focus")).."/"..TTSB(UnitHealthMax("focus")).." ("..format("%.0f", ((UnitHealth("focus")/UnitHealthMax("focus"))*100)).."%)") end)

  • 0

#94 m0nk

m0nk
  • Members
  • Posts: 304

Posted 02 September 2012 - 11:22 AM

is it possible to flip the shadow orbs bar and move it to the top of the player frame?


I'm not sure on rotating it, but to move it do the below.

/framestack and mouseover your Shadow Orbs frame to find out what the frame is called.

Then use
local t=TotemFrame; t:ClearAllPoints(); t:SetPoint("CENTER", PlayerFrame, "CENTER", 0, -100);t:SetScale(1.0)

But change "TotemFrame" to the name of that frame and type /run before the script and mess around with coords if needed.
  • 0

Posted Image


#95 Djmulletxswe

Djmulletxswe
  • Members
  • Undeadclass_name
  • EU-Stormscale
  • Cyclone / Wirbelsturm
  • Posts: 4
  • Talents: Frost 0/2/0/2/2/2

Posted 02 September 2012 - 01:58 PM

i moved my arena frames like this [cant quote the url cuz im new] and i like it, but when i join arena one of the frames randomly goes further to the right of my screen and they dont align any more, anybody know why, or a way to stop it doing that? :S


That was the problem i were talking about a few posts ago, they seem to reset to their original position upon entering arena. If anyone has a fix plez share
  • 0

#96 Thaya

Thaya
  • Moderators
  • Humanclass_name
  • EU-Silvermoon
  • Cyclone / Wirbelsturm
  • Posts: 4,275
  • Talents: Destruction 0/2/0/1/0/0/0
  • 2v2: 1338
  • LocationRussia

Posted 02 September 2012 - 05:23 PM

I'm a bit busy irl at the moment and too burned out over this game to look at what exactly they changed in the API. I'll sort it all out by expansion release however and I plan to make an addon focused on modifying and improving the default UI rather than completely replacing elements of it, with ingame and/or very basic LUA configuration. Most of these scripts will be included in it.

For those struggling with arena frames resetting positions - for now you can use this workaround, it's inelegant but it works: after you setpoint() your frames, simply overwrite the setpoint() function with a blank.

LoadAddOn("Blizzard_ArenaUI")

ArenaEnemyFrame1:ClearAllPoints()
ArenaEnemyFrame1:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
ArenaEnemyFrame1.SetPoint = function() end
This will mean all future calls of SetPoint won't do anything at all - it's not going to be possible to move the frame until you reload ui, and will prevent any other code from doing that (whatever event resets their position won't be able to anymore).

Also, arena frames aren't connected to one another anymore so you will need to move each separately.

Edited by Thaya, 02 September 2012 - 05:25 PM.

  • 1
Default UI Scripts - Compilation & how-to

#97 Thaya

Thaya
  • Moderators
  • Humanclass_name
  • EU-Silvermoon
  • Cyclone / Wirbelsturm
  • Posts: 4,275
  • Talents: Destruction 0/2/0/1/0/0/0
  • 2v2: 1338
  • LocationRussia

Posted 02 September 2012 - 06:13 PM

Also, the way number strings are handled is changed in 5.0, they attempt to localize numbers now. Some of the old functions were changed/moved around and so the absolute hp values script didn't work anymore.

Correct code:
hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function()
	PlayerFrameHealthBar.TextString:SetText(AbbreviateLargeNumbers(UnitHealth("player")))
	PlayerFrameManaBar.TextString:SetText(AbbreviateLargeNumbers(UnitMana("player")))

	TargetFrameHealthBar.TextString:SetText(AbbreviateLargeNumbers(UnitHealth("target")))
	TargetFrameManaBar.TextString:SetText(AbbreviateLargeNumbers(UnitMana("target")))

	FocusFrameHealthBar.TextString:SetText(AbbreviateLargeNumbers(UnitHealth("focus")))
	FocusFrameManaBar.TextString:SetText(AbbreviateLargeNumbers(UnitMana("focus")))
end)

  • 2
Default UI Scripts - Compilation & how-to

#98 Zeiyo

Zeiyo
  • Junkies
  • Posts: 1,387

Posted 02 September 2012 - 06:58 PM

thanks will try
  • 0

#99 Djmulletxswe

Djmulletxswe
  • Members
  • Undeadclass_name
  • EU-Stormscale
  • Cyclone / Wirbelsturm
  • Posts: 4
  • Talents: Frost 0/2/0/2/2/2

Posted 05 September 2012 - 09:47 PM

thx thaya, the absolute value hp/mana works fine again and my frames arent moving around
  • 0

#100 Vengeance

Vengeance
  • Junkies
  • Humanclass_name
  • US-Sargeras
  • Shadowburn
  • Posts: 111
  • Talents: Subtlety 0/2/2/0/0/.

Posted 06 September 2012 - 03:28 PM

Here's my old script for absolute values + percentages on frames. Updated to work with 5.0.

Looks like:
Posted Image

FrameList = {"Player", "Target", "Focus"}
function UpdateHealthValues(...)
    for i = 1, select("#", unpack(FrameList)) do
        local FrameName = (select(i, unpack(FrameList)))
        local Health = AbbreviateLargeNumbers(UnitHealth(FrameName))
        local HealthMax = AbbreviateLargeNumbers(UnitHealthMax(FrameName))
        local HealthPercent = (UnitHealth(FrameName)/UnitHealthMax(FrameName))*100
        _G[FrameName.."FrameHealthBar"].TextString:SetText(Health.."/"..HealthMax.." ("..format("%.0f",HealthPercent).."%)")
    end
end
hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", UpdateHealthValues)

And for non add-on users:
Macro 1:
/script z={"Player", "Target", "Focus"};l=AbbreviateLargeNumbers;t="TextStatusBar_UpdateTextStringWithValues";

Macro 2:
/script function a(...)for i=1,3 do f=(select(i,unpack(z)))h=UnitHealth(f)m=UnitHealthMax(f) _G[f.."FrameHealthBar"].TextString:SetText(l(h).."/"..l(m).." ("..format("%.0f",(h/m)*100).."%)")end;end hooksecurefunc(t,a)

Edited by Vengeance, 06 September 2012 - 04:58 PM.

  • 2




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

<