03-08-10, 10:44 AM | #181 | |
http://pastebin.ca/1828685 |
||
03-08-10, 07:58 PM | #182 | |
|
||
03-08-10, 11:58 PM | #184 | |
btw thanks so much for helping me with this. |
||
03-09-10, 12:15 AM | #185 |
03-09-10, 02:09 PM | #186 | |
Code:
-- Server Clock local hour, minute = GetGameTime() local aptime, ampm = true, "am" if aptime then if hour == 0 then hour = 12 end if hour > 12 then hour = hour - 12 end if hour <= 12 then ampm = "pm" end else ampm = "" end return format(":: %s :: %s%%dur :: %sfps :: %smB :: %sms :: %s:%02d%s ::", gold, durability, fps, memory, latency, hour, minute, ampm) end, update = 1, |
||
03-21-10, 07:24 AM | #187 |
Threat Based Colored Panels
Hi guys, just wondering if anyone could help me.
I'm trying to create a panel that starts black, and then changes color when in combat to show my threat level. I've found the API used for this: API GetThreatStatusColor() I so far have this: Code:
{ name="Stuf.Player.Frame.BG", parent="Stuf.units.player", anchor_to="center", anchor_to="center", width=256, height=32, bg_color="0 0 0", bg_alpha=1, OnUpdate = function(self) local r, g, b = GetThreatStatusColor(status) self.bg:SetTexture(r, g, b, 1) end, }, Lordy. |
|
03-21-10, 12:39 PM | #188 | |
|
||
03-21-10, 04:48 PM | #189 |
Greetings everyone,
I'm interested in creating a small panel parented to my oUF target frame that shows how many people are targeting my target. I'm not sure on the API function for showing how many people are targeting my own target. I've had a look through wowwiki but haven't come up with anything yet. Cheers. Last edited by Dudeface : 03-23-10 at 02:31 AM. |
|
04-13-10, 09:26 AM | #190 | |
Code:
{ parent = UIParent, anchor_to = "TOP", x_off = 0, y_off = -10, height = 100, width = 200, border = true, text = "", OnLoad = function(self) self:RegisterEvent("UNIT_TARGET") end, OnEvent = function(self) local unitsWithSameTarget, colors, colorTag = "" for i=1, MAX_PARTY_MEMBERS do if GetNumRaidMembers() > 0 then unitId = "raid"..i else unitId = "party"..i end -- Check if unit has same target as you. if UnitExists(unitId) and UnitGUID(unitId.."target") == UnitGUID("target") then -- Check if the unit is not dead and not yourself. if not UnitIsDead(unitId) and UnitGUID(unitId) ~= UnitGUID("player") then -- Class coloring. _, unitClass = UnitClass(unitId) colors = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[unitClass] colorTag = format("|cff%02x%02x%02x", colors.r*255, colors.g*255, colors.b*255) -- Append class name to unitsWithSameTarget. unitsWithSameTarget = (unitsWithSameTarget == "") and "" or unitsWithSameTarget..", " unitsWithSameTarget = format("%s%s%s|r", unitsWithSameTarget, colorTag, UnitName(unitId)) end end end if unitsWithSameTarget ~= "" then self.text:SetText(unitsWithSameTarget) self:SetAlpha(1) else self.text:SetText("") self:SetAlpha(0) end end } Last edited by Katae : 04-13-10 at 09:35 AM. |
||
05-08-10, 07:39 AM | #191 |
Awesome addon you have constructed!
im making my own UI, but i have some difficulties making a panel for my actionbars. This is what it looks like at the moment: the panel around the two actionbars in the middle only shows the left and right side of the border. But i cant figure out a way to show the last two borders. here is my code for the panel: Code:
{name = "actionbar", anchor_to = "bottom", width = 400, height = 70, y_off = 5, bg_color = "0 0 0", bg_alpha = 1, level = 3, border = "SOLID", border_color = "CLASS", border_alpha = 1,}, hope you can help me EDIT: found a temporary fix for it: two panels parented to the actionbar panel, works awesome Last edited by zynix : 05-08-10 at 08:53 AM. Reason: found a fix |
|
05-08-10, 02:36 PM | #192 | |
Hey!
Wanted to just start off by thanking you for the awesome addon :3 And since im not to pro at lua, I just wanted to ask a few fairly simple questions. When I make a box of some sort, anywhere, how to I create borders on the right and left sides of the box? And also, how do I make one of the boxes sit on top of another boxes border, without the other border showing in one of the boxes?
/Thanks alot! |
||
05-08-10, 03:38 PM | #193 |
I would create two panels for the box you want, anchor one to left side, and one to the right side
and at the other one, give the border panel a line that says level = "something low" and then the box to place over the border, a higher level. hope it helps |
|
05-08-10, 06:37 PM | #194 |
Hi there,
I'm new to using LUA only addons, but so far I must say I like what I see a lot. Great flexibility, ability to code your own 'mini-addons', and I'm sure there's much more I'll discover along the way. Now here's my problem, I want to reposition my minimap to the top left, 8px from both top and left. I could do this with and addon (currently using itsymm since it does exactly what I need (making the minimap square and removing all sorts of blizzard stuff) and nothing more). But I'ld like to keep most of the layout settings localized in my layout. I've been looking around the web a bit, and found a few sources that looked promising, but after fiddling around with it a bit, nothing is happening. At the moment I'm using the following bit of code; Code:
-- Repositioning Minimap { OnLoad = function() Minimap:ClearAllPoints(); Minimap:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 8, 8); Minimap:SetPoint("BOTTOMRIGHT", "UIParent", "TOPLEFT", 108, 108); end }, I'ld like to position a number of addons and UI elements precisely within my litepanels lua to ensure they're pixelperfect in the right position. Again, this seems like a bright idea to me now, but I'm a complete lua nooby, so I might be completely mistaken. Is this feasible? Is it possible to reposition third party addons (think bartender, omen, recount), and/or blizzard UI elements (minimap) at all within litepanels? And if it is, how would I go about this? Thanks in advance for your reply, An enthusiastic newbie. Edit; Ok, in a bit of an eureka moment I realised that since my code wasn't throwing errors, I was probably doing something right. On a hunch I disabled itsymm, which instantly did the trick. Doh! I've ripped the code that actually does the squaring and hiding of the blizzard stuff from itsy, and placed it in the onLoad for my minimap background frame, and its working just absolutely perfectly. I must say I'm really enjoying playing around with your addon. Sadly it's bedtime for me now, but since I dont really have much to do tomorrow, I'll definitely be continuing my little pet project. Before I continue however, I'ld like to ask your permission about using the hiding loop, the actual squaring, and the mousewheel zoom bits of code in my layout. I've uploaded a screenshot of where I'm at right now, disabled pretty much everything for now as I wanted a clean sheet to work with. The UI design is all me, next steps are getting rid of the fugly clock (for some reason it won't hide nicely with the other minimap elements, I can hide it in-game, but not in the onLoad script even though I'm using the same function.), and modifying your sample statblock to my needs. The unit frames are oUF_P3lim, which I'm using as a starting point, not getting started on oUF though until I get a bit more acquainted with lua in litePanels. At least you have some documentation . Finally, sorry for the rant, I'm just really excited about the possibilities. Last edited by l2032 : 05-08-10 at 09:58 PM. Reason: update |
|
05-15-10, 09:02 AM | #195 | |
Try finding the frames you want to move with /framestack, then do similar to your coding for the minimap within Litepanels. Ofc some addons might have configs (either within their lua or ingame) where you can exactly set their positions, or you could use Align with a fine grid setting to help visually line everything up and then anchor any panels to those elements Hope this helps, let us know how you get on One thing, make sure your spellings are correct if moving/calling element/frames via lua, eg some elements of the minimap are "Minimap....." others are "MiniMap....." took me a while to find a fault in my own minimap coding due to that Last edited by Gylindor : 05-15-10 at 09:14 AM. |
||
05-16-10, 02:33 AM | #196 |
Druid Mana Notice Block
Just wrote this up on my blog but thought I'd shared here.
Basically the block will put a message and play a sound (when not on CD) and do apply the following logic;
Code:
-- mana management { name = "manamgnt", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = 200, text={ string=function() -- If toon is dead return nil if(UnitIsDeadOrGhost("player") == 1) then return nil end -- If Smartervate is being used if(IsAddOnLoaded("Smartervate")) then -- Get Mana Threshold from there threshold = Smartervate:GetManaThreshold() else -- If not 50% threshold = 0.5 end -- Options gcd = 1.109 -- this may need to be decreased based on GCD changes pot = "Crazy Alchemist's Potion" sounddelay = 15 ourUnitClass, ourUnitEngClass = UnitClass("player"); if (ourUnitEngClass == 'DRUID') then current_time = time{year=date("%Y"), month=date("%m"), day=date("%d"), hour=date("%H"), min=date("%M"), sec=date("%S")} if(SoundLocked ~= nil and current_time > SoundLocked) then SoundLocked = nil end if(SmartervateDelay ~= nil and current_time > SmartervateDelay) then SmartervateDelay = nil end -- Get our Max Mana Pool local maxmana = UnitManaMax("player") -- Get our current mana local currentmana = UnitMana("player") -- Get our Percentage local manaperc = ( currentmana / maxmana ) -- Get our Mana Threshhold local manathreshhold = tonumber(threshold) if ( manaperc < manathreshhold) then if (SoundLocked == nil and UnitAffectingCombat("player") == 1) then PlaySound("GAMEHIGHLIGHTFRIENDLYUNIT") PlaySoundFile("Sound\\Spells\\PVPFlagTaken.wav") SoundLocked = current_time + tonumber(sounddelay) -- only play sound every 20 secs end -- Are we in combat? if (UnitAffectingCombat("player") == 1) then -- Yes! Check Our Innervate local start, duration = GetSpellCooldown("Innervate") if ( duration <= gcd ) then -- Innervate is available, notice to use it! return "|cffffd700Use Your Innervate|r" else -- OMG Innervate is used! Check Our Pot pot_startTime, pot_duration, pot_enable = GetItemCooldown(pot) if ( pot_startTime == 0 and pot_duration == 0 ) then -- Pot is available, Notice to use it! return "|cffffd700Use Your " .. pot .. "|r" else -- No pot either? Notice to trigger Smartervate! return "|cffffd700Use Smartervate!! /smv|r" end end else -- Out of combat and below threshhold? have a drink return "|cffffd700You're low on mana, have a drinky!|r" end else return nil end else return nil end end, update = 1, size=20, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } } Code:
lpanels:CreateLayout("UfBar", { -- Left mid-section of the box { name = "BoxL", anchor_to = "BOTTOM", width = 350, height = 90, x_off = -350/2, y_off = 120, gradient = "H", bg_color = "CLASS", gradient_color = "CLASS", bg_alpha = 0, gradient_alpha = 0.2, }, -- Right mid-section { name = "BoxR", anchor_to = "BOTTOM", width = 350, height = 90, x_off = 350/2, y_off = 120, gradient = "H", bg_color = "CLASS", gradient_color = "CLASS", bg_alpha = 0.2, gradient_alpha = 0.0, }, -- Top Left gradient line { name = "LineTL", parent = "BoxL", 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 = "LineTR", parent = "BoxR", anchor_to = "TOP", width = "100%", height = 1, gradient = "H", bg_color = "CLASS", gradient_color = "CLASS", bg_alpha = 0.8, gradient_alpha = 0, }, -- Bottom Left gradient line { name = "LineBL", parent = "BoxL", 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 = "LineBR", parent = "BoxR", anchor_to = "BOTTOM", width = "100%", height = 1, gradient = "H", bg_color = "CLASS", gradient_color = "CLASS", bg_alpha = 0.8, gradient_alpha = 0, }, -- Local Time { name = "LocalTime", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = -46, text={ string=function() -- clock local localtime = format("%.0f",date("%I")) .. "|cffffd700:|r" .. date("%M"); return localtime end, update = 1, size=22, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } }, -- Server Time { name = "ServerTime", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = -68, text={ string=function() -- clock local servertime = GameTime_GetTime(false); return servertime end, update = 1, size=10, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } }, -- FPS { name = "FPS", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = -48, x_off = -60, text={ string=function() -- fps local fps = floor(GetFramerate()) return fps.."|cffffd700FPS|r" end, update = 1, size=10, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } }, -- Latency { name = "LATENCY", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = -48, x_off = 60, text={ string=function() -- latency local latency = select(3,GetNetStats()) return latency.."|cffffd700MS|r" end, update = 1, size=10, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } }, -- Memory { name = "Membory", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = -48, x_off = -120, text={ string=function() -- memory local memory = 0 UpdateAddOnMemoryUsage() for i = 1, GetNumAddOns() do if IsAddOnLoaded(i) then memory = memory + GetAddOnMemoryUsage(i) end end local memory = format("%.1f", memory/1024) return memory.."|cffffd700MB|r" end, update = 1, size=10, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } }, -- durability { name = "durability", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = -48, x_off = 120, text={ string=function() -- durability local durability = 100 for i = 1, 11 do if GetInventoryItemDurability(i) ~= nil then local dur, max = GetInventoryItemDurability(i) local perc = dur / max * 100 if perc < durability then durability = floor(perc) end end end return durability.."|cffffd700%|r" end, update = 1, size=10, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } }, -- haste { name = "haste", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = 60, x_off = 80, text={ string=function() -- haste local haste = GetCombatRating(20) return "|cffffd700"..haste.."|rHST" end, update = 1, size=10, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } }, -- mp5 { name = "mp5", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = 60, x_off = -80, text={ string=function() -- mp5 local mp5, mp5ic = GetManaRegen() mp5 = string.format("%.0f", mp5*5) mp5ic = string.format("%.0f",mp5ic*5) if ( UnitAffectingCombat("player") == 1) then return "|cffffd700"..mp5ic.."|rMP5" else return "|cffffd700"..mp5.."|rMP5" end end, update = 1, size=10, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } }, -- spellpower { name = "spellpower", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = 60, text={ string=function() -- spellpower local spellpower = GetSpellBonusHealing(); return spellpower.."|cffffd700SP|r" end, update = 1, size=10, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } }, -- mana management { name = "manamgnt", parent = "BoxL", anchor_to="TOP", anchor_from="RIGHT", y_off = 200, text={ string=function() -- If toon is dead return nil if(UnitIsDeadOrGhost("player") == 1) then return nil end -- If Smartervate is being used if(IsAddOnLoaded("Smartervate")) then -- Get Mana Threshold from there threshold = Smartervate:GetManaThreshold() else -- If not 50% threshold = 0.5 end -- Options gcd = 1.109 -- this may need to be decreased based on GCD changes pot = "Crazy Alchemist's Potion" sounddelay = 15 ourUnitClass, ourUnitEngClass = UnitClass("player"); if (ourUnitEngClass == 'DRUID') then current_time = time{year=date("%Y"), month=date("%m"), day=date("%d"), hour=date("%H"), min=date("%M"), sec=date("%S")} if(SoundLocked ~= nil and current_time > SoundLocked) then SoundLocked = nil end if(SmartervateDelay ~= nil and current_time > SmartervateDelay) then SmartervateDelay = nil end -- Get our Max Mana Pool local maxmana = UnitManaMax("player") -- Get our current mana local currentmana = UnitMana("player") -- Get our Percentage local manaperc = ( currentmana / maxmana ) -- Get our Mana Threshhold local manathreshhold = tonumber(threshold) if ( manaperc < manathreshhold) then if (SoundLocked == nil and UnitAffectingCombat("player") == 1) then PlaySound("GAMEHIGHLIGHTFRIENDLYUNIT") PlaySoundFile("Sound\\Spells\\PVPFlagTaken.wav") SoundLocked = current_time + tonumber(sounddelay) -- only play sound every 20 secs end -- Are we in combat? if (UnitAffectingCombat("player") == 1) then -- Yes! Check Our Innervate local start, duration = GetSpellCooldown("Innervate") if ( duration <= gcd ) then -- Innervate is available, notice to use it! return "|cffffd700Use Your Innervate|r" else -- OMG Innervate is used! Check Our Pot pot_startTime, pot_duration, pot_enable = GetItemCooldown(pot) if ( pot_startTime == 0 and pot_duration == 0 ) then -- Pot is available, Notice to use it! return "|cffffd700Use Your " .. pot .. "|r" else -- No pot either? Notice to trigger Smartervate! return "|cffffd700Use Smartervate!! /smv|r" end end else -- Out of combat and below threshhold? have a drink return "|cffffd700You're low on mana, have a drinky!|r" end else return nil end else return nil end end, update = 1, size=20, shadow=2, font = "Interface\\AddOns\\ArkInventory\\Fonts\\Emblem.ttf", } } }); lpanels:ApplyLayout(nil, "UfBar") Last edited by upyursh : 05-16-10 at 02:37 AM. |
|
05-24-10, 05:44 AM | #197 |
Stats display
Hello, im trying to get the stats display to work.
At the moment im trying to show money, fps, latency, SP and mp5. the layout for the text im using, is: Code:
{ name = "Stats", anchor_to = "CENTER", anchor_from = "CENTER", y_off = -450, x_off = -750, level = 10, text = { string = function() -- money local gold = format("%.1f|cffffd700g|r",GetMoney()/10000) -- fps local fps = floor(GetFramerate()) -- latency local latency = select(3,GetNetStats()) -- Healing BonusHeal = GetSpellBonusHealing() -- Mp5 base = GetManaRegen() return format(":: %s :: %sFPS :: %sms :: %s sp :: %s mp5", gold, fps, latency, healing, mp5) end, update = 1, size=12, shadow=1, font = "Fonts\\HOOG0557.TTF", }, }, but upon login, i get this error: Code:
Message: Interface\AddOns\LitePanels\layout.lua:209: bad argument #5 to 'format' (string expected, got nil) Time: 05/24/10 13:37:57 Count: 1 Stack: [C]: in function `format' Interface\AddOns\LitePanels\layout.lua:209: in function `string' Interface\AddOns\LitePanels\core.lua:254: in function `MakePanel' Interface\AddOns\LitePanels\core.lua:345: in function `Init' Interface\AddOns\LitePanels\core.lua:364: in function <Interface\AddOns\LitePanels\core.lua:354> Locals: (*temporary) = ":: %s :: %sFPS :: %sms :: %s sp :: %s mp5" (*temporary) = "551.1g" (*temporary) = "1000" (*temporary) = "0" (*temporary) = nil (*temporary) = nil (*temporary) = "string expected, got nil" |
|
05-24-10, 04:07 PM | #198 |
Hi Zynix, I've fixed your code:
Code:
{ name = "Stats", anchor_to = "CENTER", anchor_from = "CENTER", y_off = -450, x_off = -750, level = 10, text = { string = function() -- money local gold = format("%.1f|cffffd700g|r",GetMoney()/10000) -- fps local fps = floor(GetFramerate()) -- latency local latency = select(3,GetNetStats()) -- Healing BonusHeal = GetSpellBonusHealing() -- Mp5 base = GetManaRegen() return format(":: %s :: %sFPS :: %sms :: %s sp :: %s mp5", gold, fps, latency, healing BonusHeal, mp5 base) end, update = 1, size=12, shadow=1, font = "Fonts\\HOOG0557.TTF", }, }, I think that should fix your problem. Last edited by Lordyfrb : 05-24-10 at 04:10 PM. |
|
05-24-10, 05:05 PM | #199 |
@zynix
For one thing, your BonusHeal and base variables are being declared in the global scope, you should make them local. Also, for your format to work at all, change BonusHeal to healing, and change base to mp5. And I think that GetManaRegen() returns two values, try this instead: Code:
local _, mp5 = GetManaRegen() mp5 = mp5 * 5 |
|
05-24-10, 05:18 PM | #200 |
Sorry, I missed that bit. If you are still reading, the code from my addons can be used for any purpose, I'd just like to know about it.
|
|
WoWInterface » AddOns, Compilations, Macros » Released AddOns » LitePanels - An art framework |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|