Thread Tools Display Modes
09-03-09, 10:23 PM   #1
Katae
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 208
Originally Posted by Untoucheable View Post
Hi!

First of all I love your addon. I am having problems with getting a clock to work though. I don't even know how to get started. Any chance you could give me an example or something to work with?
I actually just wrote a clock module for a stats layout I was working on the other day. Pick it apart if you like: http://pastebin.com/f486e5824

Last edited by Katae : 09-05-09 at 07:24 PM. Reason: broken link
  Reply With Quote
09-19-09, 09:47 AM   #2
Pixol
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 13
Simply Clock/WG Timer Display

Originally Posted by Katae View Post
I actually just wrote a clock module for a stats layout I was working on the other day. Pick it apart if you like: http://pastebin.com/f486e5824
Awesome add-on. I see a lot of potential in this once I learn more about lua.
I never figured out why your lua code never worked for me... But it gave me a good start for the Clock and WG timer codes. Not sure how they are in terms of efficiency but it appears to work fine, I have yet to test the clock in PM range and yet to test the WG timer in progress and in an instance away from map, but I guess it should get the timer from our BG queueing window.

Code:
-- Left mid-section of the box
{	name = "BoxLx",
	anchor_to = "TOP",
	width = 140,		height = 20,
	x_off = -140/2,		y_off = -60,
	gradient = "H",
	bg_color = "CLASS",	gradient_color = "CLASS",
	bg_alpha = 0,		gradient_alpha = 0.2,
},
-- Right mid-section
{	name = "BoxRx",		parent = "BoxLx",
	anchor_to = "LEFT",	anchor_from = "RIGHT",
	width = "100%",		height = "100%",
	gradient = "H",
	bg_color = "CLASS",	gradient_color = "CLASS",
	bg_alpha = 0.2,		gradient_alpha = 0,
},
-- Top Left gradient line
{	name = "LineTLx",
	parent = "BoxLx",	anchor_to = "TOP",
	width = "100%",		height = 1,
	gradient = "H",
	bg_color = "CLASS",	gradient_color = "CLASS",
	bg_alpha = 0,		gradient_alpha = 0.8,
},
-- Top right line
{	name = "LineTRx",
	parent = "BoxRx",	anchor_to = "TOP",
	width = "100%",		height = 1,
	gradient = "H",
	bg_color = "CLASS",	gradient_color = "CLASS",
	bg_alpha = 0.8,		gradient_alpha = 0,
},
-- Bottom left line
{	name = "LineBLx",
	parent = "BoxLx",	anchor_to = "BOTTOM",
	width = "100%",		height = 1,
	gradient = "H",
	bg_color = "CLASS",	gradient_color = "CLASS",
	bg_alpha = 0,		gradient_alpha = 0.8,
},
-- Bottom right line
{	name = "LineBRx",
	parent = "BoxRx",	anchor_to = "BOTTOM",
	width = "100%",		height = 1,
	gradient = "H",
	bg_color = "CLASS",	gradient_color = "CLASS",
	bg_alpha = 0.8,		gradient_alpha = 0,
},




{	name = "Clock", parent = "BoxLx", anchor_to = "CENTER", anchor_from="RIGHT",
	text = {
		string = function()
			-- Clock
			local hour, min, sec, pm = GetGameTime()
			if hour > 12 then hour = hour - 12; pm = true elseif hour == 0 then hour = 12 end
			local timehour = format("%02.f",hour)
			local timemin = format("%02.f",min)
			local timeframe = format("%s", pm and " PM" or " AM")

			-- WG Timer
			local wgtimeinseconds = GetWintergraspWaitTime() or nil
			if wgtimeinseconds == nil then
				wgtime = "In Progress"
			else
			--local wghour = floor(wgtimeinseconds/3600)
			--local wgmin = floor(wgtimeinseconds/60 - (wghour*60)
			--local wgsec = floor(wgtimeinseconds - wghour*3600 - wgmin *60)				
			local wgtime = format("%02.f:%02.f:%02.f",floor(wgtimeinseconds/3600), floor(wgtimeinseconds/60 - floor(wgtimeinseconds/3600)*60), floor(wgtimeinseconds - floor(wgtimeinseconds/60)*60))
			end


			return "Clock:"..timehour..":"..timemin..""..timeframe.."::: Wintergrasp: "..wgtime..""
		end, update = 1, font = "Fonts\\FRIZQT__.TTF", size = 10, alpha = 1.0, justify_h = "right", justify_v = "bottom", y_off = -2,
	},


--This part below seems to be acting funny for me when removing my mouse from the area, the tooltip takes a while to disappear and sometimes disappears instantly.
	OnEnter = function(self)
		GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT")
		GameTooltip:ClearLines()
		
		local hour, min, pm = GetGameTime()
		if hour > 12 then hour = hour - 12; pm = true elseif hour == 0 then hour = 12 end
		local rtime = hour..":"..format("%02.f",min)..(pm and "pm" or "am")
		local ltime = format("%01.f",date("%I"))..":"..date("%M")..strlower(date("%p"))
		
		local wgtime = GetWintergraspWaitTime() or nil
		if wgtime == nil then
			wgtime = "In Progress"
		else
			local hour = tonumber(format("%01.f", floor(wgtime/3600)))
			local min = format(hour>0 and "%02.f" or "%01.f", floor(wgtime/60 - (hour*60)))
			local sec = format("%02.f", floor(wgtime - hour*3600 - min *60))				
			wgtime = (hour>0 and hour..":" or "")..min..":"..sec
		end
		
		GameTooltip:AddLine(date("%A, %B %d"),0.4,0.78,1)
		GameTooltip:AddLine(" ")
		GameTooltip:AddDoubleLine("Local Time",ltime,0.75,0.9,1,1,1,1)
		GameTooltip:AddDoubleLine("Realm Time",rtime,0.75,0.9,1,1,1,1)
		GameTooltip:AddLine(" ")
		GameTooltip:AddDoubleLine("Time to Wintergrasp",wgtime,0.75,0.9,1,1,1,1)
		GameTooltip:Show()
	end,
	OnLeave = HideTT,
	OnClick = function(_,b) (b == "RightButton" and ToggleTimeManager or ToggleCalendar)() end

},
All code credited to Katae, I modified it to work for me since I couldn't get the original one to work.
Edit:
So after adding in the tooltip part, I noticed mousing over back and forth, the tooltip doesn't disappear instantaneously, in fact, sometimes it seems random as if it takes forever until it disappears when moving my mouse up and down. left and right mousing motion seems better it seems.
Also after enabling tooltip, is there a function supported to disable mouse clicks? say if I were to remove the OnClick function?

Thanks

Last edited by Pixol : 09-19-09 at 10:23 AM.
  Reply With Quote
09-19-09, 10:57 AM   #3
Katae
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 208
Originally Posted by Pixol View Post
So after adding in the tooltip part, I noticed mousing over back and forth, the tooltip doesn't disappear instantaneously
I forgot to add the "HideTT" function I have in my original code, which is attached to OnLeave. Sorry about that. Change it to this code so it works properly.
Code:
function() ToggleFrame(GameTooltip) end
Originally Posted by Pixol View Post
Also after enabling tooltip, is there a function supported to disable mouse clicks? say if I were to remove the OnClick function?
Mouse interaction is enabled automatically for OnClick, OnEnter, and OnLeave. None of those actions would do anything otherwise.

Also, I wonder if it didn't work because of my font, did you remove that bit?

Last edited by Katae : 10-10-09 at 12:34 AM.
  Reply With Quote
10-05-09, 01:37 AM   #4
Pseudopod
A Deviate Faerie Dragon
Join Date: Apr 2008
Posts: 16
Question

I took this lua text from the "LuaTexts" thread in EJ, which collects some lua stuff for Pitbull. Since it's a bit different to import that to LitePanels, I'm wondering what's the correct way to update this info:

Code:
local base, posBuff, negBuff = UnitRangedAttackPower("player");
local ap = base + posBuff + negBuff;
local cr,arpp, hrp = GetRangedCritChance(), GetCombatRatingBonus(25), GetCombatRatingBonus(7)
local cr = format("%.2f", cr)
local hrp = format("%.2f", hrp)
local arpp = format("%.2f", arpp)

return "AP: "..ap.." crit: "..cr.."% ArP: "..arpp.."% hit: "..hrp.."%"
end
So it's supposed to show your current ranged attack power, crit, armor penetration & hit. Of those four, at least RAP & crit will change during combat, and ArP too if you have e.g. an item that procs ArP. I'm interested in getting them show without much delay, but without unnecessary updating. I've put it for now in your money/fps/memory/latency script so that "update = 1," but I figure that might not be the best way to do it?
  Reply With Quote
10-05-09, 02:45 AM   #5
Katae
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 208
Originally Posted by Pseudopod View Post
I'm interested in getting them show without much delay, but without unnecessary updating. I've put it for now in your money/fps/memory/latency script so that "update = 1," but I figure that might not be the best way to do it?
It would be possible to RegisterEvent to UNIT_STATS, UNIT_DAMAGE, COMBAT_RATING_UPDATE (tested with /eventtrace, and at least ArP triggers this) in your OnLoad function, then assign your variables and output the string to the text object within the OnEvent function.

I don't think it would be necessary to check if specific stats have changed, since your variable assignments are pretty light already. I imagine that these events may, at times, fire more than a 1 sec timer during a raid scenario, but I don't believe it would make a noticeable impact on performance.

Last edited by Katae : 10-05-09 at 12:14 PM.
  Reply With Quote
10-07-09, 08:36 PM   #6
Katae
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 208
Made big changes to the layout and profile system with 1.5 and edited some of my posts to reflect them. Older layout code should still work with this version.
  Reply With Quote
10-11-09, 09:20 AM   #7
Canities
A Wyrmkin Dreamwalker
Join Date: Oct 2007
Posts: 54
Hi,
Ive juist updated to the latest version and i'm having an issue with my code and cant figure out whats wrong with it.

The error mrssage i get is:
ID: -1
Error occured in: Global
Count: 1
Message: ..\AddOns\LitePanels\layout.lua line 473:
unexpected symbol near ')'

the full code is here: Pastebin Link (ps line 473 in my layout lua is line 189 on the pastebin)

Any help would be greatly appreciated.

Cani
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Released AddOns » LitePanels - An art framework


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